Skip to content

Commit f53bb4e

Browse files
authored
Merge pull request #442 from kimocoder/claude/scan-repo-analysis-o0Xmt
fix(airodump): fix three critical bugs in file cleanup and CSV parsing
2 parents cde2ac8 + 60f137a commit f53bb4e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

wifite/tools/airodump.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,15 @@ def delete_airodump_temp_files(cls, output_file_prefix):
143143
os.remove(fil)
144144

145145
# Remove .cap and .xor files from pwd
146-
for fil in os.listdir('.'):
147-
if fil.startswith('replay_') and fil.endswith('.cap') or fil.endswith('.xor'):
148-
os.remove(fil)
146+
cwd = os.getcwd()
147+
for fil in os.listdir(cwd):
148+
if fil.startswith('replay_') and (fil.endswith('.cap') or fil.endswith('.xor')):
149+
os.remove(os.path.join(cwd, fil))
149150

150151
# Remove replay/cap/xor files from temp
151152
temp_dir = Configuration.temp()
152153
for fil in os.listdir(temp_dir):
153-
if fil.startswith('replay_') and fil.endswith('.cap') or fil.endswith('.xor'):
154+
if fil.startswith('replay_') and (fil.endswith('.cap') or fil.endswith('.xor')):
154155
os.remove(os.path.join(temp_dir, fil))
155156

156157
def get_targets(self, old_targets=None, apply_filter=True, target_archives=None):
@@ -227,7 +228,7 @@ def get_targets_from_csv(csv_filename):
227228
import csv
228229

229230
with open(csv_filename, "rb") as rawdata:
230-
encoding = chardet.detect(rawdata.read())['encoding']
231+
encoding = chardet.detect(rawdata.read())['encoding'] or 'utf-8'
231232

232233
with open(csv_filename, 'r', encoding=encoding, errors='ignore') as csvopen:
233234
lines = []

0 commit comments

Comments
 (0)