fixed timer context
This commit is contained in:
parent
1fedcae279
commit
5716d1c438
1 changed files with 5 additions and 5 deletions
10
ctiger.py
10
ctiger.py
|
@ -220,7 +220,8 @@ class Purge(object):
|
|||
def __getitem__(self, pkt):
|
||||
return pkt
|
||||
|
||||
def do_hop(self, mon_if, ichan) -> None:
|
||||
def do_hop(self, mon_if, chans) -> None:
|
||||
ichan = choice(chans)
|
||||
log.debug('Hopping on: {0}'.format(ichan))
|
||||
os.system(f'iw dev {self.mon_if} set channel {str(ichan)}')
|
||||
log.debug('Channel set to {0}'.format(ichan))
|
||||
|
@ -236,12 +237,11 @@ class Purge(object):
|
|||
log.info('Channel list: {0}'.format(chlist))
|
||||
thread = threading.current_thread()
|
||||
print(f'name={thread.name}, daemon={thread.daemon}')
|
||||
timer = threading.Timer(14.7, self.do_hop,
|
||||
args=(mon_if, chans))
|
||||
while True:
|
||||
with lock:
|
||||
ichan = choice(chans)
|
||||
with threading.Timer(14.7, self.do_hop,
|
||||
args=(mon_if, ichan)) as timer:
|
||||
timer.start()
|
||||
timer.start()
|
||||
|
||||
def send_pkt(self, bssid) -> None:
|
||||
self.bssid = bssid
|
||||
|
|
Loading…
Reference in a new issue