Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
derv82
GitHub Repository: derv82/wifite2
Path: blob/master/wifite/model/attack.py
412 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
import time
5
6
class Attack(object):
7
'''Contains functionality common to all attacks.'''
8
9
target_wait = 60
10
11
def __init__(self, target):
12
self.target = target
13
14
def run(self):
15
raise Exception('Unimplemented method: run')
16
17
def wait_for_target(self, airodump):
18
'''Waits for target to appear in airodump.'''
19
start_time = time.time()
20
targets = airodump.get_targets(apply_filter=False)
21
while len(targets) == 0:
22
# Wait for target to appear in airodump.
23
if int(time.time() - start_time) > Attack.target_wait:
24
raise Exception('Target did not appear after %d seconds, stopping' % Attack.target_wait)
25
time.sleep(1)
26
targets = airodump.get_targets()
27
continue
28
29
# Ensure this target was seen by airodump
30
airodump_target = None
31
for t in targets:
32
if t.bssid == self.target.bssid:
33
airodump_target = t
34
break
35
36
if airodump_target is None:
37
raise Exception(
38
'Could not find target (%s) in airodump' % self.target.bssid)
39
40
return airodump_target
41
42
43