diff --git a/lib/listeners/dbx.py b/lib/listeners/dbx.py index 2916a34f6..53ef5e72b 100755 --- a/lib/listeners/dbx.py +++ b/lib/listeners/dbx.py @@ -206,7 +206,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" stager += "$u='"+userAgent+"';" if userAgent.lower() != 'none' or proxy.lower() != 'none': @@ -288,7 +291,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" launcherBase += "import urllib2;\n" launcherBase += "UA='%s';" % (userAgent) diff --git a/lib/listeners/http.py b/lib/listeners/http.py index cf046c2e1..e3c9af98e 100644 --- a/lib/listeners/http.py +++ b/lib/listeners/http.py @@ -316,7 +316,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" stager += "$u='"+userAgent+"';" if 'https' in host: @@ -438,7 +441,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" launcherBase += "import urllib2;\n" launcherBase += "UA='%s';" % (userAgent) diff --git a/lib/listeners/http_foreign.py b/lib/listeners/http_foreign.py index 78ca77ca8..f07010252 100644 --- a/lib/listeners/http_foreign.py +++ b/lib/listeners/http_foreign.py @@ -174,7 +174,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" stager += "$u='"+userAgent+"';" if 'https' in host: @@ -269,8 +272,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] - + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" launcherBase += "o=__import__({2:'urllib2',3:'urllib.request'}[sys.version_info[0]],fromlist=['build_opener']).build_opener();" launcherBase += "UA='%s';" % (userAgent) diff --git a/lib/listeners/http_hop.py b/lib/listeners/http_hop.py index ce45de8e4..7efea969b 100644 --- a/lib/listeners/http_hop.py +++ b/lib/listeners/http_hop.py @@ -152,7 +152,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", stager += helpers.randomize_capitalization("$"+helpers.generate_random_script_var_name("wc")+"=New-Object System.Net.WebClient;") if userAgent.lower() == 'default': - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" stager += "$u='"+userAgent+"';" if 'https' in host: @@ -238,7 +241,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", print helpers.color(p, color='red') if userAgent.lower() == 'default': - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" launcherBase += "o=__import__({2:'urllib2',3:'urllib.request'}[sys.version_info[0]],fromlist=['build_opener']).build_opener();" launcherBase += "UA='%s';" % (userAgent) diff --git a/lib/listeners/redirector.py b/lib/listeners/redirector.py index d468102c7..327a583b0 100644 --- a/lib/listeners/redirector.py +++ b/lib/listeners/redirector.py @@ -131,7 +131,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" stager += "$u='"+userAgent+"';" if 'https' in host: @@ -250,7 +253,10 @@ def generate_launcher(self, encode=True, obfuscate=False, obfuscationCommand="", if userAgent.lower() == 'default': profile = listenerOptions['DefaultProfile']['Value'] - userAgent = profile.split('|')[1] + if "|" in profile: + userAgent = profile.split('|')[1] + else: + userAgent = "" launcherBase += "import urllib2;\n" launcherBase += "UA='%s';" % (userAgent)