Fixes #53 somewhat

pull/138/head
lanjelot 4 years ago
parent 1303350893
commit 2b78b342fc

@ -24,7 +24,6 @@ __pyver__ = '%d.%d.%d' % sys.version_info[0:3]
__banner__ = 'Patator %s (%s) with python-%s' % (__version__, __git__, __pyver__)
# README {{{
'''
INTRODUCTION
------------
@ -931,7 +930,6 @@ import random
from decimal import Decimal
from base64 import b64encode
from datetime import timedelta, datetime
from struct import unpack
import socket
import subprocess
import hashlib
@ -962,11 +960,13 @@ PY3 = sys.version_info >= (3,)
if PY3: # http://python3porting.com/problems.html
def b(x):
return x.encode('ISO-8859-1', errors='ignore')
def B(x):
return x.decode(errors='ignore')
else:
def b(x):
return x
def B(x):
return x
@ -1017,7 +1017,8 @@ if sys.platform.startswith('win'):
forking.Popen = _Popen
from multiprocessing.managers import SyncManager
# imports }}}
# }}}
# utils {{{
def expand_path(s):
@ -1855,8 +1856,8 @@ Please read the README inside for more examples and usage information.
biggest, _ = max(group_sizes.items(), key=itemgetter(1))
for i, ks in self.iter_groups:
r = []
r = []
for k in ks:
pset, _ = psets[k]
r.append(pset)
@ -2134,7 +2135,8 @@ Please read the README inside for more examples and usage information.
else:
i, _, _ = select([sys.stdin], [], [], .1)
if not i: return
if not i:
return
command = i[0].readline().strip()
if command == 'h':
@ -3018,10 +3020,12 @@ class POP_login(TCP_Cache):
def connect(self, host, port, ssl, timeout):
if ssl == '0':
if not port: port = 110
if not port:
port = 110
fp = POP3(host, int(port), timeout=int(timeout))
else:
if not port: port = 995
if not port:
port = 995
fp = POP3_SSL(host, int(port)) # timeout=int(timeout)) # no timeout option in python2
return TCP_Connection(fp, fp.welcome)
@ -3128,10 +3132,12 @@ class IMAP_login:
def execute(self, host, port='', ssl='0', user=None, password=None):
if ssl == '0':
if not port: port = 143
if not port:
port = 143
klass = IMAP4
else:
if not port: port = 993
if not port:
port = 993
klass = IMAP4_SSL
with Timing() as timing:
@ -4160,7 +4166,6 @@ class VNC:
else:
raise VNC_Error('Unknown response: %r (code: %s)' % (resp, code))
def gen_key(self, key):
newkey = []
for ki in range(len(key)):
@ -4312,7 +4317,8 @@ def generate_srv():
continue
for line in open(f):
match = re.match(r'([a-zA-Z0-9]+)\s', line)
if not match: continue
if not match:
continue
for w in re.split(r'[^a-z0-9]', match.group(1).strip().lower()):
ret.extend(['_%s.%s' % (w, i) for i in ('_tcp', '_udp')])
return ret
@ -4331,10 +4337,12 @@ class HostInfo:
if self.name:
line = ' '.join(self.name)
if self.ip:
if line: line += ' / '
if line:
line += ' / '
line += ' '.join(map(str, self.ip))
if self.alias:
if line: line += ' / '
if line:
line += ' / '
line += ' '.join(self.alias)
return line
@ -4434,7 +4442,8 @@ class Controller_DNS(Controller):
else:
i = 0
d = '.'.join(name.split('.')[i:])
if d not in domains: domains[d] = 0
if d not in domains:
domains[d] = 0
domains[d] += 1
for domain, count in sorted(domains.items(), key=lambda a: a[0].split('.')[-1::-1]):
@ -4447,7 +4456,8 @@ class Controller_DNS(Controller):
nets[ip] = [ip]
else:
n = ip.make_net('255.255.255.0')
if n not in nets: nets[n] = []
if n not in nets:
nets[n] = []
nets[n].append(ip)
for net, ips in sorted(nets.items()):

Loading…
Cancel
Save