feat: Duplicate entry prevention

Added method to prevent duplicate entries.
This commit is contained in:
anoduck 2024-01-27 13:39:36 -05:00
parent a76b04fa2a
commit 9bcb62731b
2 changed files with 11 additions and 5 deletions

View file

@ -15,6 +15,9 @@
- massive refactoring of how variables are passed.
- fixed chan_hop argument error
- fixed signal_handler undefined log error
- removed globalization of scan_df
- added duplicate prevention for csv valid file
- removed cause of annoying duplicate entry.
** 0.4.1
*** 2024.01.26
- Fixing interface name resolution error in @__init__@.

View file

@ -278,9 +278,13 @@ class Purge(object):
dbm_signal = pkt.dBm_AntSignal
pkt_chan = self.extract_channel(pkt[Dot11])
self.log.debug('Extracted channel: {0}'.format(pkt_chan))
scan_df.loc[bssid] = [self.macaddr, dbm_signal,
pkt_chan, 'N/A']
scan_df.to_csv(self.valid_file, mode='a')
pkg_df = pd.read_csv(self.valid_file, index_col=0)
if bssid in pkg_df.index:
self.log.info('Duplicate CTS from {0}'.format(bssid))
return
self.scan_df.loc[bssid] = [self.macaddr, dbm_signal,
pkt_chan, 'N/A']
self.scan_df.to_csv(self.valid_file, mode='a', index=False)
self.log.info('Results written to {0}'.format(valid_file))
def probe_prn(self, pkt):
@ -299,8 +303,7 @@ class Purge(object):
self.log = log
log.info('mac revealer started')
log.info('setting up class attributes')
global scan_df
scan_df = get_df()
self.scan_df = get_df()
log.info('acquired Dataframe')
mon_if, macaddr = self.get_interface()
self.mon_if = mon_if