How to decrypt Jenkins 8mha values

冷暖自知 提交于 2020-02-20 08:57:11

问题


If we look at the Jenkins job logs, we can see that the text contained there, is exactly the same as what is displayed in the browser when you look into the Console Output EXCEPT for the URL that in the log files is encoded with something with the tag [8mha:

Does anyone know how can we "decrypt" it?

Already tried a simple base64 but it doesn't work.

This is one of those strings

[8mha:AAAAqR+LCAAAAAAAAP9b85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyTVzHb1RttJBUeZGJg8GdhyUvPSSzJ8GJhLi3JKGIR8shLLEvVzEvPS9YNLijLz0q0rihik0IxzhtAgwxgggJGJgaGiAMiQL2HQ0c/KT9J3zkhNzs4vLVE1MtAFYpfEkkQg5ZuYl5ieWgRkBbgF65sa6QMAtVXQDbEAAAA=[0m

回答1:


That string is ansi-/ color-coded log output. To view the plain text version, you can utilize https://github.com/mmalecki/ansispan. So, the given String

    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] { (prepare)
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] }
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] // stage
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] stage
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] { (deployApplication)
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] }
    [8mha:AAAAaB+LCAAAAAAAAP9b85aBtbiIwTG/KF0vKzUvOzOvODlTryCnNB3I0ivPL8pOy8kv18vKT9JLzs8rzs9J1QuHCgaV5jlDhPzyS1IZIICRiYGhoohBKqM0pTg/D64Hh8ICAFt0h+h/AAAA[0m[Pipeline] // stage

will result in

    [Pipeline] { (prepare)
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (deployApplication)
    [Pipeline] }
    [Pipeline] // stage



回答2:


https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/blob/master/README.md

Short answer here,

It's not encrypted, it still BASE64 string,

Example,

Started by user [8mha:////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA=[0madmin

Can be split to the following parts,

A string: Started by user

Preamber: \u001B[8mha:

Base64 string: ////4H+H6gi+RzqRXgbuxDkiDNvJYq3pMCu17+YXxGOB+mHbAAAAlx+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzWEgZu/dLi1CL9xJTczDwAj6GcLcAAAAA=

Postamber: \u001B[0m

A string: admin

Convert the base64 string to bytes, trim the first 40 bytes (https://github.com/LarrysGIT/Extract-Jenkins-Raw-Log/issues/1) and save as .gz file. Now you can extract real content from the .gz file.

In this case, the content is type Java serialization data, version 5 following

¬í sr !hudson.console.ModelHyperlinkNote xr hudson.console.HyperlinkNote6=«±=’pÅ I lengthL urlt Ljava/lang/String;xr hudson.console.ConsoleNote xp t /user/admin



来源:https://stackoverflow.com/questions/26635416/how-to-decrypt-jenkins-8mha-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!