-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathgtube_header.py
41 lines (36 loc) · 1.54 KB
/
gtube_header.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import king_phisher.client.plugins as plugins
GTUBE = 'XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X'
WARNING_BANNER = """\
**************************************************
* The GTUBE Plugin Is Enabled! *
**************************************************
"""
class Plugin(plugins.ClientPlugin):
authors = ['Spencer McIntyre']
classifiers = ['Plugin :: Client :: Email']
title = 'GTUBE Header'
description = """
Add the Generic Test for Unsolicited Bulk Email (GTUBE) string as a X-GTUBE
header and append it to the end of all text/* parts of the MIME messages
that are sent.
This will cause messages to be identified as SPAM.
"""
homepage = 'https://github.com/securestate/king-phisher-plugins'
reference_urls = ['https://spamassassin.apache.org/gtube/']
req_min_version = '1.10.0'
version = '1.0'
def initialize(self):
mailer_tab = self.application.main_tabs['mailer']
self.signal_connect('message-create', self.signal_message_create, gobject=mailer_tab)
self.signal_connect('send-precheck', self.signal_send_precheck, gobject=mailer_tab)
return True
def signal_message_create(self, mailer_tab, target, message):
message['X-GTUBE'] = GTUBE
for part in message.walk():
if not part.get_content_type().startswith('text/'):
continue
part.payload_string = part.payload_string + '\n' + GTUBE + '\n'
def signal_send_precheck(self, mailer_tab):
# we're just going to print the warning banner so the user is aware
mailer_tab.tabs['send_messages'].text_insert(WARNING_BANNER)
return True