Add SMB2 support
This commit is contained in:
parent
5c44f7c770
commit
a910f30889
@ -140,15 +140,15 @@ def listen_http(files_dir):
|
|||||||
else:
|
else:
|
||||||
print(f' -> {iname}: http://{ips[iname]}:{port}/linpeas.sh')
|
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():
|
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 = ['sudo', 'python', '-m', 'http.server', '-d', files_dir, str(port)]
|
cmd.insert(0, 'sudo')
|
||||||
else:
|
|
||||||
cmd = ['python', '-m', 'http.server', '-d', files_dir, str(port)]
|
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def listen_smb(files_dir):
|
def listen_smb(files_dir, version):
|
||||||
port = ask_port(445)
|
port = ask_port(445)
|
||||||
ips = get_ips()
|
ips = get_ips()
|
||||||
|
|
||||||
@ -158,12 +158,17 @@ def listen_smb(files_dir):
|
|||||||
print(f' -> {iname}: \\\\{ips[iname]}\\share\\winPEASany.exe')
|
print(f' -> {iname}: \\\\{ips[iname]}\\share\\winPEASany.exe')
|
||||||
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\\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():
|
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 = ['sudo', 'smbserver.py', '-port', str(port), 'share', files_dir]
|
cmd.insert(0, 'sudo')
|
||||||
else:
|
|
||||||
cmd = ['smbserver.py', '-port', str(port), 'share', files_dir]
|
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
|
||||||
@ -209,7 +214,9 @@ 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)
|
listen_smb(files_dir, 1)
|
||||||
|
elif option == 3:
|
||||||
|
listen_smb(files_dir, 2)
|
||||||
elif option == 0:
|
elif option == 0:
|
||||||
sys.exit('Quitting')
|
sys.exit('Quitting')
|
||||||
else:
|
else:
|
||||||
@ -224,7 +231,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
menu_options = {
|
menu_options = {
|
||||||
1: 'HTTP',
|
1: 'HTTP',
|
||||||
2: 'SMB',
|
2: 'SMB1',
|
||||||
|
3: 'SMB2',
|
||||||
0: 'Exit',
|
0: 'Exit',
|
||||||
}
|
}
|
||||||
menu_choice(menu_options)
|
menu_choice(menu_options)
|
||||||
|
Loading…
Reference in New Issue
Block a user