Skip to content

Commit a0095ad

Browse files
committed
Check res properly and update Ruby syntax
If res is nil, it should not be doing res.code
1 parent df5fdbf commit a0095ad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/exploits/unix/webapp/sugarcrm_rest_unserialize_exec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ def exploit
6565
}
6666
})
6767

68-
if not res or res.code != 200
68+
unless res
69+
print_error('Connection timed out while sending a request to rest.php')
70+
return
71+
end
72+
73+
if res && res.code != 200
6974
print_error("#{peer} - Exploit failed: #{res.code}")
7075
return
7176
end
@@ -81,7 +86,7 @@ def exploit
8186
'headers' => { 'payload' => Rex::Text.encode_base64(payload.encoded) }
8287
})
8388

84-
if res and res.code != 200
89+
if res && res.code != 200
8590
print_error("#{peer} - Payload execution failed: #{res.code}")
8691
return
8792
end

0 commit comments

Comments
 (0)