Skip to content

Commit b431a08

Browse files
Update vulnscan.py to define sensitive paths for scanning; refactor main execution logic
Signed-off-by: Shahm Najeeb <[email protected]>
1 parent 69e9391 commit b431a08

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

CODE/vulnscan.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@
2828
config.get("VulnScan Settings", "threshold", fallback=0.6)) # Probability cutoff to consider a file sensitive
2929

3030
# Paths
31-
ROOT_DIR = r"C:/" # Folder to scan
31+
SENSITIVE_PATHS = [
32+
r"C:\Users\%USERNAME%\Documents",
33+
r"C:\Users\%USERNAME%\Desktop",
34+
r"C:\Users\%USERNAME%\Downloads",
35+
r"C:\Users\%USERNAME%\AppData\Roaming",
36+
r"C:\Users\%USERNAME%\AppData\Local",
37+
r"C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data",
38+
r"C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles",
39+
r"C:\Users\%USERNAME%\OneDrive",
40+
r"C:\Users\%USERNAME%\Dropbox",
41+
r"C:\Users\%USERNAME%\Google Drive",
42+
]
3243
SAVE_DIR = r"VulnScan_Files" # Backup folder
3344
MODEL_PATH = r"vulnscan/Model_SenseMacro.4n1.pth" # Your trained model checkpoint
3445
REPORT_JSON = "report.json"
@@ -144,7 +155,7 @@ def scan_directory(root):
144155

145156

146157
# ================== MAIN ==================
147-
if __name__ == "__main__":
158+
def main():
148159
log.info(f"Scanning directory: {ROOT_DIR} - This will take some time...")
149160
sensitive = scan_directory(ROOT_DIR)
150161

@@ -174,3 +185,14 @@ def scan_directory(root):
174185
log.debug(f"Files copied into: {SAVE_DIR}")
175186
log.debug(f"JSON report saved as: {REPORT_JSON}")
176187
log.debug(f"CSV report saved as: {REPORT_CSV}")
188+
189+
190+
if __name__ == "__main__":
191+
log.info(f"Starting VulnScan with {NUM_WORKERS} thread workers and {len(SENSITIVE_PATHS)}...")
192+
for path in SENSITIVE_PATHS:
193+
expanded_path = os.path.expandvars(path)
194+
if os.path.exists(expanded_path):
195+
ROOT_DIR = expanded_path
196+
main()
197+
else:
198+
log.warning(f"Path does not exist and will be skipped: {expanded_path}")

0 commit comments

Comments
 (0)