Skip to content

Commit b637831

Browse files
committed
improved email regex
1 parent 6de4a72 commit b637831

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

fingerprint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Email: "\\b[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+\\b"
1+
Email: "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b"
22
Phone: "\\b\\+\\d{1,3}[-.]?\\d{3}[-.]?\\d{4}\\b"
33
Aadhar: "\\b\\d{4}[-.]?\\d{4}[-.]?\\d{4}\\b"
44
Amazon MWS Auth Token: "amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"

hawk_scanner/commands/fs.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from hawk_scanner.internals import system
55
import os
66
import concurrent.futures
7+
import time
78

89
def process_file(file_path, key, results):
910
matches = system.read_match_strings(file_path, 'fs')
@@ -28,20 +29,29 @@ def execute(args):
2829
fs_config = sources_config.get('fs')
2930
if fs_config:
3031
for key, config in fs_config.items():
31-
path = config.get('path') or os.getcwd()
32+
if 'path' not in config:
33+
system.print_error(f"Path not found in fs profile '{key}'")
34+
continue
35+
path = config.get('path')
3236
if not os.path.exists(path):
33-
path = os.getcwd()
37+
system.print_error(f"Path '{path}' does not exist")
38+
3439
exclude_patterns = fs_config.get(key, {}).get('exclude_patterns', [])
40+
start_time = time.time()
3541
files = system.list_all_files_iteratively(path, exclude_patterns)
3642

3743
# Use ThreadPoolExecutor for parallel processing
44+
file_count = 0
3845
with concurrent.futures.ThreadPoolExecutor() as executor:
3946
futures = []
4047
for file_path in files:
48+
file_count += 1
4149
futures.append(executor.submit(process_file, file_path, key, results))
4250

4351
# Wait for all tasks to complete
4452
concurrent.futures.wait(futures)
53+
end_time = time.time()
54+
system.print_info(f"Time taken to analyze {file_count} files: {end_time - start_time} seconds")
4555
else:
4656
system.print_error("No filesystem 'fs' connection details found in connection.yml")
4757
else:

hawk_scanner/internals/system.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from rich.console import Console
22
from rich.table import Table
3-
import random
43
import yaml
54
import re
65
import os

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
VERSION = "0.1.3"
2+
13
from setuptools import setup, find_packages
24

35
with open("readme.md", "r") as f:
@@ -8,7 +10,7 @@
810

911
setup(
1012
name='hawk_scanner',
11-
version='0.1.2',
13+
version=VERSION,
1214
description='A powerful scanner to scan your Filesystem, S3, MySQL, Redis, Google Cloud Storage and Firebase storage for PII and sensitive data.',
1315
long_description=long_description,
1416
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)