summaryrefslogtreecommitdiff
path: root/poc.py
diff options
context:
space:
mode:
authorjvoisin2015-06-30 17:28:16 +0200
committerjvoisin2015-06-30 17:28:16 +0200
commitd37e79625075b65449d79d546df3afcbe7698c16 (patch)
tree670adc32062da4a58053fdc7dc0a3668d4f876c5 /poc.py
parent97b60696b0a676a297cd8212f67507e7bebd21af (diff)
Python bindings, fuck yeah!
Diffstat (limited to 'poc.py')
-rw-r--r--poc.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/poc.py b/poc.py
new file mode 100644
index 0000000..1ddbefd
--- /dev/null
+++ b/poc.py
@@ -0,0 +1,27 @@
1import fnmatch
2import glob
3import os
4import sys
5
6try:
7 import yara
8except ImportError:
9 print 'Please install python-yara'
10 sys.exit(0)
11
12if len(sys.argv) != 2:
13 print 'Usage: %s folder_to_scan' % sys.argv[0]
14
15rules = yara.compile('malwares.yara')
16
17for root, dirnames, filenames in os.walk(sys.argv[1]):
18 for filename in fnmatch.filter(filenames, '*.ph*'):
19 fname = os.path.join(root, filename)
20 if os.stat(fname).st_size:
21 matches = rules.match(os.path.join(root, filename), fast=True)
22 if matches:
23 matches=matches.pop()
24 print str(matches) + fname
25 print '\n'.join(hex(m[0]) + ':' + m[1] + ': ' + m[2] for m in matches.strings)
26
27