This commit is contained in:
Mariusz B. / mgeeky 2021-10-17 18:38:06 +02:00
parent ba1d37dda9
commit 5f80f17a94

View File

@ -868,6 +868,7 @@ Results will be unsound. Make sure you have pasted your headers with correct spa
self.results['SpamAssassin Spam Report'] = self.testSpamAssassinSpamReport()
self.results['Message Feedback Loop'] = self.testMSFBL()
self.results['Other interesting headers'] = self.testInterestingHeaders()
self.results['OVH\'s X-VR-SPAMCAUSE'] = self.testSpamCause()
return {k: v for k, v in self.results.items() if v}
@ -887,6 +888,41 @@ Results will be unsound. Make sure you have pasted your headers with correct spa
parts = fqdn.split('.')
return '.'.join(parts[-2:])
@staticmethod
def decodeSpamcause(msg):
text = []
for i in range(0, len(msg), 2):
text.append(SMTPHeadersAnalysis.unrotSpamcause(msg[i: i + 2]))
return str.join('', text)
@staticmethod
def unrotSpamcause(pair, key=ord('x')):
offset = 0
for c in 'cdefgh':
if c in pair:
offset = (ord('g') - ord(c)) * 16
break
return chr(sum(ord(c) for c in pair) - key - offset)
def testSpamCause(self):
(num, header, value) = self.getHeader('X-VR-SPAMCAUSE')
if num == -1: return []
result = ''
value = SMTPHeadersAnalysis.flattenLine(value).replace(' ', '').replace('\t', '')
decoded = SMTPHeadersAnalysis.decodeSpamcause(value)
result = decoded
if len(result) == 0:
return []
return {
'header' : header,
'value': value,
'analysis' : result
}
def testMSFBL(self):
(num, header, value) = self.getHeader('X-MSFBL')
if num == -1: return []