-
-
Save DoubleYouEl/e3de97293ce3d5452b3be7a336a06ad7 to your computer and use it in GitHub Desktop.
def decode(msg): | |
text = "" | |
for i in range(0, len(msg), 2): | |
text += unrot(msg[i: i + 2], i // 2) # add position as extra parameter | |
return text | |
def unrot(pair, pos, key=ord('x')): | |
if pos % 2 == 0: # "even" position => 2nd char is offset | |
pair = pair[1] + pair[0] # swap letters in pair | |
offset = (ord('g') - ord(pair[0])) * 16 # treat 1st char as offset | |
return chr(sum(ord(c) for c in pair) - key - offset) # map to original character | |
if __name__ == '__main__': | |
import sys | |
print(decode(sys.argv[1])) |
Hello. I need to decode a SPAMCAUSE looong string . How can i do this ?
Hello. I need to decode a SPAMCAUSE looong string . How can i do this ?
It depends: how long is this long string? You could copy-paste it into the python code and use it as value to assign to a variable (instead of passing it as an argument).
You could just use this main program, instead of using the sys.argv
-approach:
spamcause = <your very long string between quotes>
print(decode(spamcause))
an other way to use this script:
- feed spamcause header in a file whithout "X-VR-SPAMCAUSE: "
- then run
python3 ./ovh-spam-cause.py $(cat /tmp/temp-file) | sed -e "s/;/\n/g"
Here's an online version : https://f3hj7s.csb.app
Hi, I have been using the online version which was working fine @revolunet -> Thx by the way !
But things have changed since a couple of weeks. I can't decode anymore, the code changed. any idea how to fix this ?
Thanks in advance :)
Here's an online version : https://f3hj7s.csb.app
i just came to know your online version i was using python script. But i'm afraid that it is not working anymore it had been some update. if you can try with this source:
dmFkZTFe/e7/NBcbdIzTiTd9iacMG74sllyWk8AUVYUN6FnPcWkWUvzuZYciE1WOqPM1IEphrIPmIRc+FzW1CIZ0dEsLixCUfXZjhSQFGV4g3SdxBEt2s0XD0+cb5zDgrffQLdLtkAd2v46gQBK2Nnt5M8ch//tKN5r+kHSaSh8p1lwcwTZi111GuKnpyvH1IblBkvty3LTt+zTq+NrbC1iwQOs7a7uclX2p7tKhfXfXKQvZm8FG/mkEWz2jx6AM6rw0XldvaK+zhGwlKjjU8hi5/aa9AgO8QpIsnrU/BGgTuD/DOpDDgA/K3hFha1PcRD1Mn0gP40HSOYH/PxB122wRmrXmlS4n933nbB5IV+uSWESSiS4Gt4BzsfV/3eL1Z17W9LbCXkMpe/08haZyLw9Bn2DHVvaI1uf/Eu8XORuTvFOg4wnsWBImD3LU0S9La5F53zAgNU6GFdXqnvhtPhxRibn5Fczeuzj2O/+580lUO/yGEw2CyLi1Vo/SoVE6+WFpj7DICwKiO+o/rfyb4ulp01Y4FYs1yOsk9AmVs2IOr+/eVyLVGRlkfIWbIB/d62KLog6ooC/TBFyfgdyku36VOnlg/MfjC4G+RxvhA2TNgO0Vbpw9vvADYNqMGG+tqVoFHkBRpgSLkTuLAx3PI2KoG/BW8NFq3QWJg40wI2k6UeHCHw
Hello,
Can your share code at github ?
The offset characters (c..g) are alternatingly appended and prepended. So instead of just checking if one of them is in the pair, it is necessary to differentiate between, e.g., fh and hf, by keeping track of even or odd pairs.