-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextscan.py
31 lines (24 loc) · 969 Bytes
/
textscan.py
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
import vt
import time
client = vt.Client("0daeef21df5299edce887dd5ef54be2c58f19dc8d70603925a17a856914af35f")
def scan_text_and_check_keywords(text, keywords):
analysis = client.scan_url(text) # You can use scan_url for text-based scans
while True:
analysis = client.get_object(f"/analyses/{analysis.id}")
print(analysis.status)
if analysis.status == "completed":
break
time.sleep(30)
report = client.get_object(f"/analyses/{analysis.id}/url")
scanned_text = report.attributes.last_analysis_stats
print(f"Scanned Text: {scanned_text}")
# Check for keywords in the scanned text
found_keywords = []
for keyword in keywords:
if keyword.lower() in scanned_text.lower():
found_keywords.append(keyword)
if found_keywords:
print(f"Found keywords: {', '.join(found_keywords)}")
else:
print("No keywords found in the scanned text.")
client.close()