forked from Irish-Film-Institute/IFIscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviruscheck.py
More file actions
executable file
·50 lines (40 loc) · 899 Bytes
/
viruscheck.py
File metadata and controls
executable file
·50 lines (40 loc) · 899 Bytes
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
40
41
42
43
44
45
46
47
#!/usr/bin/env python
'''
Requires ClamAV to be installed
'''
import sys
import subprocess
import argparse
def parse_args(args_):
'''
Parse command line arguments.
'''
parser = argparse.ArgumentParser(
description='Runs a virus scan using ClamAV on your input directory'
' Written by Eoin O\'Donohoe.'
)
parser.add_argument(
'input', help='Input directory'
)
parsed_args = parser.parse_args(args_)
return parsed_args
def clamscan(input_dir):
'''
Calls ClamAV.
'''
scan = subprocess.call([
'clamscan',
'-r',
'-v',
input_dir
])
def main(args_):
'''
Launches functions that performs a virus check.
'''
args = parse_args(args_)
input_dir = args.input
print "Running scan.........."
clamscan(input_dir)
if __name__ == '__main__':
main(sys.argv[1:])