Skip to content

Commit

Permalink
fixes for 'all' param, autopep
Browse files Browse the repository at this point in the history
  • Loading branch information
HynekPetrak committed Feb 23, 2022
1 parent 14d1dbf commit ae91709
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Binary file modified dist/test_log4shell
Binary file not shown.
28 changes: 13 additions & 15 deletions test_log4shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,9 @@ def main():
for line in sys.stdin:
analyze_directory(line.rstrip("\r\n"), blacklist)
elif f == "all":
if os.name == 'nt':
if os.name != 'nt':
log.info("[E] 'all' is available only on MS Windows")
else:
try:
import win32file
import win32api
Expand All @@ -1259,19 +1261,16 @@ def main():
drives = drives.split('\000')[:-1]
drives = [d for d in drives if win32file.GetDriveType(
d) == win32file.DRIVE_FIXED]
if drives:
log.info("[I] Going to scan all detected local drives: " +
", ".join(drives))
for drive in drives:
analyze_directory(drive, blacklist)
else:
log.info("[I] No local drives detected")
except Exception as ex:
drives = None
log.info(f"[E] pywin32 exception: {ex}")
else:
log.info("[E] 'all' is available only on MS Windows")

if drives:
log.info("[I] Going to scan all detected local drives: " +
", ".join(drives))
for drive in drives:
analyze_directory(drive, blacklist)
else:
log.info("[I] No local drives detected")
else:
analyze_directory(f, blacklist)

Expand All @@ -1297,12 +1296,11 @@ def main():
"container": "",
"path": host_info['cmdline'],
"status": epilog_status,
"message": time.time()-report_progress.start_time, # runtime
"pom_version": analyze_directory.dirs_checked, # folders
"product": process_file.files_checked, # files
"message": time.time()-report_progress.start_time, # runtime
"pom_version": analyze_directory.dirs_checked, # folders
"product": process_file.files_checked, # files
})


if "csv_out" in args:
if args.csv_out:
fn = args.csv_out
Expand Down

0 comments on commit ae91709

Please sign in to comment.