forked from patrickwardle/knockknock
/
whitelist.py
59 lines (41 loc) · 1.25 KB
/
whitelist.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
56
57
58
59
import json
#project imports
import utils
#whitelisted files
WHITE_LISTED_FILES = 'whitelists/whitelistedFiles.json'
#whitelisted commands
WHITE_LISTED_COMMANDS = 'whitelists/whitelistedCommands.json'
#whitelisted browser extensions
WHITE_LISTED_EXTENSIONS = 'whitelists/whitelistedExtensions.json'
#global white list
# ->hashes/info of known good files
whitelistedFiles = []
#global white list
# ->commands
whitelistedCommands = []
#global white list
# ->browser extensions
whitelistedExtensions = []
#todo make this a class with iVars instead of globals
#load whitelists
def loadWhitelists():
#global files
global whitelistedFiles
#global commands
global whitelistedCommands
#global
global whitelistedExtensions
#open/load whitelisted files
with open(utils.getKKDirectory() + WHITE_LISTED_FILES) as file:
#load
whitelistedFiles = json.load(file)
#open/load whitelisted commands
with open(utils.getKKDirectory() + WHITE_LISTED_COMMANDS) as file:
#load
# ->note, commands are in 'commands' array
whitelistedCommands = json.load(file)['commands']
#open/load whitelisted commands
with open(utils.getKKDirectory() + WHITE_LISTED_EXTENSIONS) as file:
#load
# ->note, commands are in 'commands' array
whitelistedExtensions = json.load(file)