-
Notifications
You must be signed in to change notification settings - Fork 11
/
scan.py
31 lines (26 loc) · 1.4 KB
/
scan.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
#! /usr/bin/env python
import subprocess
import sys, threading, Queue
import os
import string
import urlparse
import os.path
import re, time, datetime
def scanning(path):
os.chdir(path)
# currentdir = os.getcwd()[:-3]
start_time = time.time()
script_path = os.path.dirname(os.path.abspath( __file__ ))
with open(script_path + "/scanlogs/Clam-report.log", "w") as f:
print "\n=============== ClamAV Antivirus Engine is running! Please Wait ==============="
f.write("======================================ClamAV======================================\n\n")
f.write(datetime.datetime.now().strftime("%A, %d %B %Y %I:%M:%S%p") + "\n\n")
f.write("--------------------------------------------------------------------------------------------------------------------\n\n")
process = subprocess.Popen("clamscan -r --stdout --infected --scan-html=yes --scan-pdf=yes --scan-archive=yes --algorithmic-detection=yes" , shell=True, stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, ''):
sys.stdout.write(line)
f.write(line)
f.write("\nclamscan -r --stdout --infected --scan-html=yes --scan-pdf=yes --scan-archive=yes -i --algorithmic-detection=yes " + os.getcwd() + "\n\n")
finish_time = time.time() - start_time, "seconds"
f.write("Scanning time with ClamAV engine was: " + str(finish_time) + "\n\n")
print "================================================================================"