Skip to content

Instantly share code, notes, and snippets.

@DoubleYouEl
Forked from lkraider/spam_decode.py
Last active May 20, 2026 12:38
Show Gist options
  • Select an option

  • Save DoubleYouEl/e3de97293ce3d5452b3be7a336a06ad7 to your computer and use it in GitHub Desktop.

Select an option

Save DoubleYouEl/e3de97293ce3d5452b3be7a336a06ad7 to your computer and use it in GitHub Desktop.
X-OVH-SPAMCAUSE decoder
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]))
@DoubleYouEl

Copy link
Copy Markdown
Author

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.

@danpietro

Copy link
Copy Markdown

Hello. I need to decode a SPAMCAUSE looong string . How can i do this ?

@DoubleYouEl

Copy link
Copy Markdown
Author

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).

@danpietro

danpietro commented Nov 17, 2022 via email

Copy link
Copy Markdown

@DoubleYouEl

Copy link
Copy Markdown
Author

You could just use this main program, instead of using the sys.argv-approach:

spamcause = <your very long string between quotes>
print(decode(spamcause))

@mqu

mqu commented Mar 24, 2023

Copy link
Copy Markdown

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"

@revolunet

Copy link
Copy Markdown

Here's an online version : https://f3hj7s.csb.app

@Krusty07

Copy link
Copy Markdown

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 :)

@arbiyassine17

Copy link
Copy Markdown

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

@dexter74

dexter74 commented May 26, 2025

Copy link
Copy Markdown

Hello,
Can your share code at github ?

@daSilva-drs

Copy link
Copy Markdown

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

Same here. Recently been seeing this in Telenet and Orange. Any update?

@arbiyassine17

Copy link
Copy Markdown

hello brothers,
any update concerning that ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment