-
Notifications
You must be signed in to change notification settings - Fork 313
/
ubuntu-unattended-setup
executable file
·96 lines (67 loc) · 4.1 KB
/
ubuntu-unattended-setup
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
#!/usr/bin/env python3
import os
import sys
from settings import settings
def exit_if_not_root():
if os.getuid() != 0:
sys.exit("[!} Error: this script must be run as root.")
def read_deps_file(deps_file):
with open(deps_file) as fd:
return ' '.join([ line.strip() for line in fd ])
if __name__ == '__main__':
exit_if_not_root()
default_wordlist = os.path.join(settings.dict['paths']['directories']['wordlists'], settings.dict['core']['eaphammer']['general']['default_wordlist'])
wordlist_source = settings.dict['core']['eaphammer']['general']['wordlist_source']
root_dir = settings.dict['paths']['directories']['root']
local_dir = settings.dict['paths']['directories']['local']
openssl_source = settings.dict['core']['eaphammer']['general']['openssl_source']
openssl_version = settings.dict['core']['eaphammer']['general']['openssl_version']
openssl_build_options = settings.dict['core']['eaphammer']['general']['openssl_build_options']
openssl_build_prefix = os.path.join(local_dir, 'openssl/local')
openssl_bin = settings.dict['paths']['openssl']['bin']
dh_file = settings.dict['paths']['certs']['dh']
print('\n[*] Removing stub files...\n')
os.system('find {} -type f -name \'stub\' -exec rm -f {{}} +'.format(root_dir))
print('\ncomplete!\n')
print('\n[*] Installing Kali dependencies...\n')
os.system('export DEBIAN_FRONTEND=noninteractive && apt -yq install %s' % read_deps_file('kali-dependencies.txt'))
print('\n[*] complete!\n')
print('\n[*] Downloading OpenSSL_{}...\n'.format(openssl_version.replace('.', '_')))
os.system('wget {} -O {}/openssl.tar.gz'.format(openssl_source, local_dir))
print('\n[*] complete!\n')
print('\n[*] Extracting OpenSSL_{}...\n'.format(openssl_version.replace('.', '_')))
os.system('cd {} && tar xzf openssl.tar.gz'.format(local_dir))
os.system('mv {}/openssl-OpenSSL_{} {}/openssl'.format(local_dir, openssl_version.replace('.', '_'), local_dir))
os.system('cd {} && rm -f openssl.tar.gz'.format(local_dir))
print('\n[*] complete!\n')
print('\n[*] Compiling OpenSSL locally to avoid interfering with system install...\n')
os.system('cd {}/openssl && ./config --prefix={} enable-ssl2 enable-ssl3 enable-ssl3-method enable-des enable-rc4 enable-weak-ssl-ciphers no-shared'.format(local_dir, openssl_build_prefix))
os.system('cd {}/openssl && make'.format(local_dir))
os.system('cd {}/openssl && make install_sw'.format(local_dir))
print('\n[*] complete!\n')
print('\n[*] Create DH parameters file with default length of 2048...\n')
os.system('{} dhparam -out {} 2048'.format(openssl_bin, dh_file))
print('\ncomplete!\n')
print('\n[*] Compiling hostapd...\n')
os.system("cd %s && cp defconfig .config" % settings.dict['paths']['directories']['hostapd'])
os.system("cd %s && make hostapd-eaphammer_lib" % settings.dict['paths']['directories']['hostapd'])
print('\n[*] complete!\n')
print('\n[*] Compiling hcxtools...\n')
os.system("cd %s && make" % settings.dict['paths']['directories']['hcxtools'])
print('\n[*] complete!\n')
print('\n[*] Compiling hcxdumptool...\n')
os.system("cd %s && make" % settings.dict['paths']['directories']['hcxdumptool'])
print('\n[*] complete!\n')
print('\n[*] Downloading default wordlist...\n')
os.system("wget %s -O %s.tar.gz" % (wordlist_source, default_wordlist))
print('\n[*] complete!\n')
print('\n[*] Extracting default wordlist...\n')
os.system("cd %s && tar xzf %s.tar.gz" % (settings.dict['paths']['directories']['wordlists'], default_wordlist))
print('\n[*] complete!\n')
print('\n[*] Retrieving Responder from teh interwebz...\n')
os.system("cd %s && git clone https://github.com/lgandx/Responder.git" % (settings.dict['paths']['directories']['local']))
print('\n[*] complete!\n')
print('\n[*] Creating symlink to captive portal template directory...\n')
os.symlink(settings.dict['paths']['wskeyloggerd']['usr_templates'],
settings.dict['paths']['wskeyloggerd']['usr_templates_sl'])
print('\n[*] complete!\n')