-
Notifications
You must be signed in to change notification settings - Fork 0
/
subset.py
141 lines (108 loc) · 3.39 KB
/
subset.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import os
import json
import argparse
import sources
import sinks
import storages
import proxys
import keyloggers
from core.Register import *
from core.Controller import Controller
from front.TUIFront import TUIFront
parser = argparse.ArgumentParser()
parser.add_argument(
'-c', '--config',
default=os.path.expanduser('~') + "/.config/subset/config",
help="configuration file")
parser.add_argument(
'-gen', '--generate',
action='store_true',
help="generate storage")
parser.add_argument(
'-a', '--add',
action='store_true',
help="add elem to domain")
parser.add_argument(
'-r', '--remove',
action='store_true',
help="remove elem from domain")
parser.add_argument(
'--reset',
action='store_true',
help="reset all elements")
parser.add_argument(
'-s', '--select',
action='store_true',
help="select elem from domain")
parser.add_argument(
'-l', '--list',
action='store_true',
help="list domain elementas")
parser.add_argument(
'-i', '--index',
type=int,
default=-1,
help="elem index")
parser.add_argument(
'-d', '--domain',
type=str,
default="",
help="domain, by default it is taken from configuration file")
parser.add_argument(
'-u', '--user',
type=str,
default="",
help="user")
parser.add_argument(
'--keylogger',
action='store_true',
help="keylogger")
parser.add_argument(
'--tui',
action='store_true',
help="tui")
args = parser.parse_args()
if __name__ == "__main__":
file = open(args.config, "r+")
config = json.loads(file.read())
file.close()
storage_t_ = REG_NAMESPACE[Type.STORAGE][config["storage"]
["type"]]["instance"]
proxy_t_ = REG_NAMESPACE[Type.PROXY][config["proxy"]["type"]]["instance"]
DOMAIN = config["default_domain"] if args.domain == "" else args.domain
USER = config["user"] if args.user == "" else args.user
if args.generate:
storage_t_.create_storage(config, config["domains"])
local = storage_t_(config["storage"])
proxy = proxy_t_(config["proxy"])
for domain in config["domains"].keys():
if config["domains"][domain]["shared"]:
proxy.update_shared_domain(
config["user"], domain, local.get_domain(domain))
local = storage_t_(config["storage"])
proxy = proxy_t_(config["proxy"])
controller = Controller(config, REG_NAMESPACE, proxy, local)
if args.tui:
tui = TUIFront(config, REG_NAMESPACE, local)
if args.keylogger:
key = REG_NAMESPACE[Type.KEYLOGGER][config["default_keylogger"]]["instance"](
config, REG_NAMESPACE, controller)
key.start()
tui.run()
if args.keylogger:
key = REG_NAMESPACE[Type.KEYLOGGER][config["default_keylogger"]]["instance"](
config, REG_NAMESPACE, controller)
key.run()
VALUE, sch = REG_NAMESPACE[Type.SOURCE][config["domains"]
[DOMAIN]["default_source"]]["instance"]().get()
if args.add:
controller.add(DOMAIN, args.index, VALUE)
if args.remove:
controller.remove(DOMAIN, args.index)
if args.select:
controller.select(USER, DOMAIN, args.index)
if args.list:
controller.show(USER, DOMAIN, sch)
if args.reset:
controller.reset(DOMAIN)
controller.__del__()