-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscanLocal.py
55 lines (42 loc) · 1.67 KB
/
scanLocal.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import datetime
from detection import Scanner
from detection.db import DB
import os
from detection import FileManager, FileCache
from detection import PatternChecker
from detection.honeypots.patterns import InlineStylePatterns
start = datetime.datetime.now()
def analyseFile(src):
print ('\n######################################## %s' % src)
scanner = Scanner.Scanner(None, 3)
result = FileManager.downloadFile(src)
if result == None:
return
scanner.analyseCode(result[0], result[1], result[2])
db = DB.DB('~/OpenWPM/data', scanner.scripts)
db.printScripts()
#analyseFile('file:detection/examples/inlineScript9.js')
for subdir, dirs, files in os.walk('detection/examples/test'):
for file in files:
# if file.startswith('pubads_impl'):
filepath = 'file:' + subdir + os.sep + file
analyseFile(filepath)
#s
#file = open(os.path.join('detection/tests/honeypots','index.html'))
#data = file.read()
#
#inlineStylePatterns = InlineStylePatterns.InlineStylePatterns()
#
#for pattern in inlineStylePatterns.patterns:
# for patternValue in pattern[2]:
# PatternChecker.checkPattern(data, patternValue, 'SCANlocal')
#print "@@@@@@@@@@@@@@@@Inline patterns @@@@@@@@@@@@@@@@@@@@@@@@@@"
#for parentPat in inlineStylePatterns.parentPatterns:
# for patternPatValue in parentPat[2]:
# if PatternChecker.checkPattern(data, patternPatValue, 'SCANlocalParent'):
# print "yes %s" % parentPat[1]
end = datetime.datetime.now()
delta = end - start
datetime.timedelta(0, 8, 562000)
delta2 = divmod(delta.days * 86400 + delta.seconds, 60)
print ("Min. Sec. %s %s" % (delta2[0], delta2[1]))