-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall
More file actions
executable file
·59 lines (44 loc) · 1.1 KB
/
Copy pathinstall
File metadata and controls
executable file
·59 lines (44 loc) · 1.1 KB
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
#!/bin/python3
import os
import sys
print("--- 2columnS installation script ---")
if os.getuid() != 0:
print("ERROR - Root privileges required")
sys.exit(1)
print("\t Installing kernel module")
os.system("cd kernel && make && sudo insmod firewall.ko")
print("\t Kernel module installed")
print("\t Installing user space daemon")
with open('/etc/systemd/system/2columnS.service', 'w') as f:
f.write(f'''
[Unit]
Description=2columnS - a ML based NIDS
[Service]
User=root
WorkingDirectory={os.getcwd()}/user/
ExecStart={os.getcwd()}/user/userspace
Restart=no
Environment="DISPLAY=:0" "XAUTHORITY=/home/seed/.Xauthority"
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
''')
os.system('sudo systemctl daemon-reload')
with open(f'{os.getcwd()}/user/rules.json', 'w') as rules:
rules.write('''
{
"lock": "false",
"rules": [
{
"source": "*",
"destination": "*",
"port": 22,
"protocol": 6,
"action": 1
}
],
"default": "ACCEPT"
}
''')
print("\t User space daemon installed")
print("--- installation complete ---")