Skip to content

Commit

Permalink
remove open calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
noptrix committed Jan 19, 2021
1 parent ddda292 commit 914969b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions docs/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
files ) and brute it


===> 1.3.4

[x] remove open() calls


===> 1.3.3

[x] use mmap to read wordlist files
Expand Down
20 changes: 6 additions & 14 deletions sshprank.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


__author__ = 'noptrix'
__version__ = '1.3.3'
__version__ = '1.3.4'
__copyright = 'santa clause'
__license__ = 'MIT'

Expand Down Expand Up @@ -483,30 +483,22 @@ def run_threads(host, ports, val='single'):
e.submit(crack_login, host, port, opts['user'], opts['pass'])

with ThreadPoolExecutor(opts['lthreads']) as exe:
if 'userlist' in opts:
uf = open(opts['userlist'], 'r', encoding='latin-1')
if 'passlist' in opts:
pf = open(opts['passlist'], 'r', encoding='latin-1')
if 'combolist' in opts:
cf = open(opts['combolist'], 'r', encoding='latin-1')

if 'userlist' in opts and 'passlist' in opts:
for u in uf:
pf = open(opts['passlist'], 'r', encoding='latin-1')
for p in pf:
for u in opts['userlist']:
for p in opts['passlist']:
exe.submit(crack_login, host, port, u.rstrip(), p.rstrip())
pf.close()

if 'userlist' in opts and 'passlist' not in opts:
for u in uf:
for u in opts['userlist']:
exe.submit(crack_login, host, port, u.rstrip(), opts['pass'])

if 'passlist' in opts and 'userlist' not in opts:
for p in pf:
for p in opts['passlist']:
exe.submit(crack_login, host, port, opts['user'], p.rstrip())

if 'combolist' in opts:
for line in cf:
for line in opts['combolist']:
try:
l = line.split(':')
exe.submit(crack_login, host, port, l[0].rstrip(), l[1].rstrip())
Expand Down

0 comments on commit 914969b

Please sign in to comment.