Compare commits

...

2 Commits

Author SHA1 Message Date
Jordan ERNST a910f30889 Add SMB2 support 2022-04-21 21:08:07 +02:00
Jordan ERNST 5c44f7c770 Default print PEAS files 2022-04-21 20:54:32 +02:00
1 changed files with 23 additions and 15 deletions

View File

@ -133,37 +133,42 @@ def listen_http(files_dir):
port = ask_port(80)
ips = get_ips()
print('The HTTP server is about to start.\nAvailable endpoints:')
print('The HTTP server is about to start.\nA good start ;) :')
for iname in ips:
if port == 80:
print(f' -> {iname}: http://{ips[iname]}/')
print(f' -> {iname}: http://{ips[iname]}/linpeas.sh')
else:
print(f' -> {iname}: http://{ips[iname]}:{port}/')
print(f' -> {iname}: http://{ips[iname]}:{port}/linpeas.sh')
cmd = ['python', '-m', 'http.server', '-d', files_dir, str(port)]
if port < 1024 and not is_sudo():
print('Listening on any port under 1024 requires root permissions.')
cmd = ['sudo', 'python', '-m', 'http.server', '-d', files_dir, str(port)]
else:
cmd = ['python', '-m', 'http.server', '-d', files_dir, str(port)]
cmd.insert(0, 'sudo')
subprocess.call(cmd)
def listen_smb(files_dir):
def listen_smb(files_dir, version):
port = ask_port(445)
ips = get_ips()
print('The HTTP server is about to start.\nAvailable endpoints:')
print('The HTTP server is about to start.\nA good start ;) :')
for iname in ips:
if port == 445:
print(f' -> {iname}: \\\\{ips[iname]}\\share\\')
print(f' -> {iname}: \\\\{ips[iname]}\\share\\winPEASany.exe')
else:
print(f' -> {iname}: \\\\{ips[iname]}:{port}\\share\\ # This syntax (:port) is not supported on Windows ?')
print(f' -> {iname}: \\\\{ips[iname]}:{port}\\share\\winPEASany.exe # This syntax (:port) is not supported on Windows ?')
if version == 1:
cmd = ['smbserver.py', '-port', str(port), 'share', files_dir]
elif version == 2:
cmd = ['smbserver.py', '-smb2support', '-port', str(port), 'share', files_dir]
else:
sys.exit('Wrong SMB version')
if port < 1024 and not is_sudo():
print('Listening on any port under 1024 requires root permissions.')
cmd = ['sudo', 'smbserver.py', '-port', str(port), 'share', files_dir]
else:
cmd = ['smbserver.py', '-port', str(port), 'share', files_dir]
cmd.insert(0, 'sudo')
subprocess.call(cmd)
@ -209,7 +214,9 @@ def menu_choice(menu_options):
if option == 1:
listen_http(files_dir)
elif option == 2:
listen_smb(files_dir)
listen_smb(files_dir, 1)
elif option == 3:
listen_smb(files_dir, 2)
elif option == 0:
sys.exit('Quitting')
else:
@ -224,7 +231,8 @@ if __name__ == '__main__':
menu_options = {
1: 'HTTP',
2: 'SMB',
2: 'SMB1',
3: 'SMB2',
0: 'Exit',
}
menu_choice(menu_options)