-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyScan.py
More file actions
39 lines (35 loc) · 1.23 KB
/
KeyScan.py
File metadata and controls
39 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from utils import *
import sys
from colorama import Fore, Back, Style, init
def main():
if len(sys.argv) == 1:
print("Error! No input path found...")
return
else:
matching_files = []
for path in sys.argv[1:]:
files, unscanned_folders = getFilesContent(path)
print("=============INFO=============")
print(f"Files found: {len(files)}")
print(f"Folders not scanned: {len(unscanned_folders)}")
for unscanned_folder in unscanned_folders:
print(f"\t-{unscanned_folder}")
print("\n===========SCANNING===========")
if files != None:
for index, file in enumerate(files, start=1):
print(f"{file['path']}\t-\t{index}/{len(files)}")
file = scanFile(file)
if file['scanned']:
matching_files.append(file)
print("\n===========RESULTS============")
for i, file in enumerate(matching_files, start=1):
if file['regex_matches_found'] == [] and file['tag_matches_found'] == []:
print(f"No matches found for: {file['path']}")
else:
print(Fore.CYAN + f"Matches found for: {file['path']}")
print(Fore.CYAN + f"FILENAME: {file['name']}")
printMatches(file)
if i != len(matching_files):
print("\n------------------")
if __name__ == '__main__':
main()