Support for Python3

That was fun.
This commit is contained in:
derv82
2018-03-31 23:02:00 -04:00
parent 1ad17472b2
commit 3eddcaa59f
23 changed files with 103 additions and 63 deletions

View File

@@ -30,7 +30,7 @@ class Client(object):
def __str__(self):
''' String representation of a Client '''
result = ''
for (key,value) in self.__dict__.iteritems():
for (key,value) in self.__dict__.items():
result += key + ': ' + str(value)
result += ', '
return result
@@ -39,4 +39,4 @@ class Client(object):
if __name__ == '__main__':
fields = 'AA:BB:CC:DD:EE:FF, 2015-05-27 19:43:47, 2015-05-27 19:43:47, -67, 2, (not associated) ,HOME-ABCD'.split(',')
c = Client(fields)
print c
print('Client', c)

View File

@@ -186,7 +186,7 @@ class Handshake(object):
bssids = set()
# Check if we have all 4 messages for the handshake between the same MACs
for (client_target, num) in target_client_msg_nums.iteritems():
for (client_target, num) in target_client_msg_nums.items():
if num == 4:
# We got a handshake!
bssid = client_target.split(',')[0]
@@ -358,7 +358,6 @@ class Handshake(object):
if __name__ == '__main__':
hs = Handshake('./tests/files/handshake_exists.cap', bssid='A4:2B:8C:16:6B:3A')
hs.analyze()
print "has_hanshake() =", hs.has_handshake()
print("has_hanshake() =", hs.has_handshake())

View File

@@ -98,4 +98,4 @@ class Interface(object):
if __name__ == '__main__':
mac = Interface.get_mac()
print 'wlan0mon mac address:', mac
print('wlan0mon mac address:', mac)

View File

@@ -31,7 +31,7 @@ class CrackResult(object):
text = fid.read()
try:
json = loads(text)
except Exception, e:
except Exception as e:
Color.pl('{!} error while loading %s: %s' % (name, str(e)))
json.append(self.to_dict())
with open(name, 'w') as fid:

View File

@@ -147,5 +147,5 @@ if __name__ == '__main__':
t = Target(fields)
t.clients.append("asdf")
t.clients.append("asdf")
print t.to_str()
print(t.to_str())

View File

@@ -45,8 +45,8 @@ if __name__ == '__main__':
w.dump()
w = CrackResultWPA('AA:BB:CC:DD:EE:FF', 'Test Router', 'hs/capfile.cap', 'Key')
print '\n'
print('\n')
w.dump()
w.save()
print w.__dict__['bssid']
print(w.__dict__['bssid'])