cleaning up purge class from redundants

This commit is contained in:
anoduck 2024-01-26 15:48:15 -05:00
parent 04555e1a88
commit c0841553b4

View file

@ -191,7 +191,7 @@ class NetDev:
mon_if = self.mon_crtd
return mon_if
elif self.mon_type == 'switch':
self.switch_if(self.interface, self.macaddr)
self.switch_if(self.macaddr)
mon_if = self.interface
return mon_if
else:
@ -246,10 +246,7 @@ class Purge(object):
chop.start()
def send_pkt(self, bssid) -> None:
self.bssid = bssid
log.debug('Extracted bssid: {0}'.format(bssid))
# idval = [16383, 32767, 65535]
# durid = choice(idval)
durid = 65535
log.debug('Selected durid: {0}'.format(durid))
log.debug('Sending packet with: {0}'.format(macaddr))
@ -285,18 +282,18 @@ class Purge(object):
return retval
def cts_prn(self, pkt):
log.info('Intercepted CTS from {0}'.format(self.bssid))
bssid = pkt[Dot11FCS].addr2
log.info('Intercepted CTS from {0}'.format(bssid))
dbm_signal = pkt.dBm_AntSignal
pkt_chan = self.extract_channel(pkt[Dot11])
log.debug('Extracted channel: {0}'.format(pkt_chan))
scan_df.loc[self.bssid] = [macaddr, dbm_signal,
pkt_chan, 'N/A']
scan_df.loc[bssid] = [macaddr, dbm_signal,
pkt_chan, 'N/A']
scan_df.to_csv(self.valid_file, mode='a')
log.info('Results written to {0}'.format(valid_file))
def probe_prn(self, pkt):
bssid = pkt[Dot11FCS].addr2
self.bssid = bssid
log.info('Intercepted probe-req from {0}'.format(bssid))
log.debug('Extracted bssid: {0}'.format(bssid))
log.info('Sending RTS frame to {0}'.format(bssid))
@ -305,10 +302,6 @@ class Purge(object):
def mac_revealer(self, interface, mon_type, valid_file, channels):
log.info('mac revealer started')
self.interface = interface
self.mon_type = mon_type
self.valid_file = valid_file
self.channels = channels
log.info('setting up class attributes')
global scan_df
scan_df = get_df()
@ -316,7 +309,6 @@ class Purge(object):
mon_if = self.get_interface()
log.debug('mon_if: {0}'.format(mon_if))
log.debug('return type: {0}'.format(type(mon_if)))
self.mon_if = mon_if
log.info('interface {0} is up and running.'.format(self.mon_if))
probe_sniff = AsyncSniffer(
iface=mon_if, prn=self.probe_prn,