-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOpenRelayTestEmail.py
More file actions
69 lines (52 loc) · 2.19 KB
/
Copy pathOpenRelayTestEmail.py
File metadata and controls
69 lines (52 loc) · 2.19 KB
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
69
import random
# Generate a valid Social Security Number
def generate_ssn():
ssn = ""
for i in range(9):
digit = random.randint(1, 9)
ssn += str(digit)
return ssn
def validate_ssn(ssn):
# Validate the length is 9 characters
if len(ssn) != 9:
return False
# No group can be all zeros
if ssn[:3] == "000" or ssn[3:5] == "00" or ssn[5:] == "0000":
return False
# Cannot start with '9'
if ssn[0] == "9":
return False
# First group cannot be comprised of only 6
if ssn[:3] == "666":
return False
if not 987654320 <= int(ssn) <= 987654329:
return False
return True
def generate_and_validate_ssn():
valid_ssn = False
while not valid_ssn:
ssn = generate_ssn()
valid_ssn = validate_ssn(ssn)
return ssn
varSMTPServer = input("Enter the IP address of the SMTP server: ")
varSenderEmail = input("Input the sending email (can be anything): ")
varReceivingEmail = input("Input the receiving email address: ")
response = input("Press 1 to send a test email or 2 to test with socials: ")
if response == "1":
varBody = input("Input text to include in the body (e.g., SMTP Openrelay): ")
command = f"swaks --to {varReceivingEmail} --from {varSenderEmail} --header 'Subject: OpenRelay test {varSMTPServer}' --body '{varBody}' --server {varSMTPServer}"
print(command)
# Execute the swaks command
elif response == "2":
varNumberofSocials = int(input("How many socials would you like to generate? "))
print(f"Generating {varNumberofSocials} socials and outputting to file {varNumberofSocials}-ssn.txt")
with open(f"{varNumberofSocials}-ssn.txt", "w") as file:
for _ in range(varNumberofSocials):
ssn = generate_and_validate_ssn()
formatted_ssn = f"{ssn[:3]}-{ssn[3:5]}-{ssn[5:]}"
file.write(formatted_ssn + "\n")
command = f"swaks --to {varReceivingEmail} --from {varSenderEmail} --header 'Subject: OpenRelay test {varSMTPServer}' --body @{varNumberofSocials}-ssn.txt --server {varSMTPServer}"
print(command)
# Execute the swaks command
else:
print("Incorrect selection. Please try again.")