nmap doesn’t see socket ip(192.168.0.17)
(assembly is fasm)
i tried with little endian,but it doesnt work anyway. probably trouble in addr and port
i wrote my code by help chromium os and i dont see any troubles with it here..
i didn’t try with int 0x80(32bit) i need to use syscall
There is code:
format ELF64
section '.data'
IPPROTO_TCP equ 0x06
SOCK_STREAM equ 0x01
AF_INET equ 0x02
message db 'welcome',0xA,0
message_lenght = $-message
struc sockaddr sin_family,sin_port,sin_addr
{
.sin_family dw sin_family
.sin_port dw sin_port; 1461
.sin_addr dd sin_addr; 192.168.0.17
}
sockaddr_in sockaddr 0x02,0x05B5,0x1100A8C0
sizeSockaddr = 0x02+0x05B5+0x1100A8C0
section '.text' executable
_start:
;socket
mov rax,0x29 ;socket
mov rdi, AF_INET
mov rsi, SOCK_STREAM
mov rdx, IPPROTO_TCP
syscall
mov rbx,rax
;binding
mov rax,0x31 ;bind
mov rdi,rbx
lea rsi,[sockaddr_in]
mov rdx,sizeSockaddr
syscall
;listening
mov rax,0x32 ; listen
mov rdi,rbx ;descriptor
mov rsi,1
syscall
;accept
mov rax,43 ;accept
mov rdi,rbx ;descriptor
syscall
;welcome
mov rax,1
mov rdi,1;sys_write
mov rsi,message
mov rdx,message_lenght
syscall
;close socket
mov rax,3 ;close
mov rbx,rdi
syscall
;exit program
mov rax,60
mov rdi,0
syscall
New contributor
whateveron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
5