Advertisement
Guest User

Untitled

a guest
Mar 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global _start
  2.  
  3. section .text
  4.  
  5. _start:
  6.     ; sycall number: socket (359)
  7.     ;    int socket(int domain, int type, int protocol);
  8.     mov eax, 0x167
  9.     mov ebx, 2
  10.     mov ecx, 1
  11.     mov edx, 0
  12.     int 0x80
  13.    
  14.     ; Bind socket bind(3, {sa_family=AF_INET, sin_port=htons(1234), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
  15. ;   2. #define __NR_bind 361
  16. ;   int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
  17.  
  18.     mov eax, 361
  19.     mov ebx, 2
  20.     push word 0x3905
  21.     push bx
  22.     mov ecx, esp
  23.     mov edx, 0x10
  24.     int 0x80
  25.  
  26. ; result:
  27. ; socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
  28. ; bind(2, {sa_family=AF_INET, sin_port=htons(1337), sin_addr=inet_addr("1.0.0.0")}, 16) = -1 ENOTSOCK (Socket operation on ; non-socket)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement