Compare commits

..

No commits in common. "a910f30889159df7a63a1266b66626d3a74a6410" and "7a615fec5141f64d1787a69dc72f5c7c6a6b93af" have entirely different histories.

View File

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