Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed smtp starttls issue #327

Merged
merged 2 commits into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/brute/smtp/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def login(user, passwd, target, port, timeout_sec, log_in_file, language, retrie
server = smtplib.SMTP(target, int(port), timeout=timeout_sec)
else:
server = smtplib.SMTP(target, int(port))
server.starttls()
output = server.ehlo(name="test")
if starttls in output[1].lower():
server.starttls()
exit = 0
break
except:
Expand All @@ -75,7 +77,7 @@ def login(user, passwd, target, port, timeout_sec, log_in_file, language, retrie
flag = 0
except smtplib.SMTPException as err:
pass
if flag is 0:
if flag == 0:
info(messages(language, "user_pass_found").format(
user, passwd, target, port))
data = json.dumps({'HOST': target, 'USERNAME': user, 'PASSWORD': passwd, 'PORT': port, 'TYPE': 'smtp_brute',
Expand Down Expand Up @@ -119,7 +121,9 @@ def __connect_to_port(port, timeout_sec, target, retries, language, num, total,
server = smtplib.SMTP(target, int(port), timeout=timeout_sec)
else:
server = smtplib.SMTP(target, int(port))
server.starttls()
output = server.ehlo(name="test")
if starttls in output[1].lower():
server.starttls()
server.quit()
exit = 0
break
Expand Down Expand Up @@ -280,17 +284,17 @@ def start(target, users, passwds, ports, timeout_sec, thread_number, num, total,
# wait for threads
kill_switch = 0
kill_time = int(
timeout_sec / 0.1) if int(timeout_sec / 0.1) is not 0 else 1
timeout_sec / 0.1) if int(timeout_sec / 0.1) != 0 else 1
while 1:
time.sleep(0.1)
kill_switch += 1
try:
if threading.activeCount() is 1 or kill_switch is kill_time:
if threading.activeCount() == 1 or kill_switch == kill_time:
break
except KeyboardInterrupt:
break
thread_write = int(open(thread_tmp_filename).read().rsplit()[0])
if thread_write is 1 and verbose_level is not 0:
if thread_write == 1 and verbose_level != 0:
data = json.dumps({'HOST': target, 'USERNAME': '', 'PASSWORD': '', 'PORT': '', 'TYPE': 'smtp_brute',
'DESCRIPTION': messages(language, "no_user_passwords"), 'TIME': now(), 'CATEGORY': "brute",
'SCAN_ID': scan_id, 'SCAN_CMD': scan_cmd}) + "\n"
Expand Down