Spaces:
Sleeping
Sleeping
Create analyze_email_main.py
Browse files- analyze_email_main.py +22 -0
analyze_email_main.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from parse_email import parse_email
|
| 2 |
+
from header_analyzer import analyze_headers
|
| 3 |
+
from body_analyzer import analyze_body
|
| 4 |
+
from url_analyzer import analyze_urls
|
| 5 |
+
|
| 6 |
+
def analyze(file_path):
|
| 7 |
+
headers, body, urls = parse_email(file_path)
|
| 8 |
+
|
| 9 |
+
results = []
|
| 10 |
+
results.extend(analyze_headers(headers))
|
| 11 |
+
results.extend(analyze_body(body))
|
| 12 |
+
results.extend(analyze_urls(urls))
|
| 13 |
+
|
| 14 |
+
if not results:
|
| 15 |
+
return ["No issues detected. Email looks safe."]
|
| 16 |
+
return results
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
file_path = "sample.eml" # replace with actual .eml file path
|
| 20 |
+
findings = analyze(file_path)
|
| 21 |
+
for f in findings:
|
| 22 |
+
print(f)
|