Skip to content

Commit ce0cebf

Browse files
authored
Merge pull request #444 from kimocoder/claude/scan-repo-analysis-o0Xmt
fix: resolve two medium-severity issues
2 parents add91c4 + e127263 commit ce0cebf

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

wifite/tools/airodump.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,14 @@ def get_targets(self, old_targets=None, apply_filter=True, target_archives=None)
224224
def get_targets_from_csv(csv_filename):
225225
"""Returns list of Target objects parsed from CSV file."""
226226
targets2 = []
227-
import chardet
228227
import csv
229228

230-
with open(csv_filename, "rb") as rawdata:
231-
encoding = chardet.detect(rawdata.read())['encoding'] or 'utf-8'
229+
try:
230+
import chardet
231+
with open(csv_filename, "rb") as rawdata:
232+
encoding = chardet.detect(rawdata.read())['encoding'] or 'utf-8'
233+
except ImportError:
234+
encoding = 'utf-8'
232235

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

wifite/util/logger.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ def initialize(cls, log_file: Optional[str] = None, verbose: int = 0, enabled: b
7878
if log_dir and not os.path.exists(log_dir):
7979
os.makedirs(log_dir, mode=0o700)
8080

81-
# Write header
82-
with open(log_file, 'a') as f:
81+
# Write header — open with explicit 0o600 so the log file
82+
# is owner-readable only, regardless of the process umask.
83+
fd = os.open(log_file, os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0o600)
84+
with os.fdopen(fd, 'a') as f:
8385
f.write(f"\n{'='*80}\n")
8486
f.write(f"Wifite2 Log - {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
8587
f.write(f"{'='*80}\n")

0 commit comments

Comments
 (0)