-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsendDisclosure.py
68 lines (46 loc) · 2.39 KB
/
sendDisclosure.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import smtplib
import json
import time
import sys
##Configs
gmail_user = '[email protected]'
gmail_password = 'xxxxx' # You will need to generate a Google app password for this to work
GMAIL_USERNAME = '[email protected]' #This is the alias your emails will be sent from, could be the same as gmail_user if you wish
email_subject = 'Responsible Security Disclosure'
def sendDisclosure(data):
#Make connection to gmail server, once
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_user, gmail_password)
print 'Connection to gmail successful!'
except:
print 'Something went wrong when connecting to gmail...'
data = json.loads(data)
for site in data:
insert_site = site['vulnerableSite']['url']
emails = site['vulnerableSite']['emails']
if type(emails) is unicode:
emails = [emails]
for email in emails:
recipient = str(email)
headers = "\r\n".join(["from: " + GMAIL_USERNAME,
"subject: " + email_subject,
"to: " + recipient,
"mime-version: 1.0",
"content-type: text/html"])
body_of_email = 'During the course of a security research project I was completing, your site ' + insert_site + \
' was discovered to have a serious security' \
' vulnerability present. The goal of this email is to responsibly disclose ' \
'this issue to you so your technical team can mitigate the issue as soon as possible and minimize any impact.' \
' If you have an active bug bounty program you would like me to report additional details through please reply with contact information.' \
' Technical Details: The source code of your site is exposed at the root of your site at ' + insert_site + '/.git/'
content = headers + "\r\n\r\n" + body_of_email
try:
time.sleep(10) #Just so we dont freak Google out
server.sendmail(GMAIL_USERNAME, recipient, content)
print 'Email sent to: ' + recipient
except:
print 'Something went wrong...' + str(sys.exc_info()[0])
#Close the gmail sever connection
server.close()