README 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Forge-socket banner grab
  2. ======
  3. This utility, in combination with a kernel module
  4. (https://github.com/ewust/forge_socket/) will complete the half-open connection
  5. created by ZMap during a TCP-scan, optionally send a small message, and wait
  6. for the hosts response. The response is then printed along with their IP
  7. address on stdout. Periodic status messages appear on stderr.
  8. This utility is functionally equivalent to banner-grab-tcp, however, instead of
  9. having the kernel send a RST packet for the server's SYN+ACK, and
  10. banner-grab-tcp attempting to start a fresh TCP connection with the host,
  11. forge-socket will take the parameters of the SYN+ACK packet, and use a kernel
  12. module to add it as an ESTABLISHED TCP connection socket. Then, the
  13. forge-socket user-space program can use this socket to send() and recv() as
  14. normal, and completes the banner-grab process (optionally send a small message,
  15. and receive the server's response).
  16. USING:
  17. -----
  18. # Install forge-socket to the ZMap root directory:
  19. cd ./zmap/
  20. git clone git@github.com:ewust/forge_socket.git
  21. cd forge_socket
  22. make
  23. sudo insmod forge_socket.ko
  24. # Don't send RST packets (forge-socket will complete these connections instead)
  25. sudo iptables -A OUTPUT -p tcp -m tcp --tcp-flags RST,RST RST,RST -j DROP
  26. # Use ZMap + forge-socket simultaneously:
  27. make
  28. #echo -e -n "GET / HTTP/1.1\r\nHost: %s\r\n\r\n" > http-req
  29. sudo su
  30. ulimit -SHn 1000000 && ulimit -SSn 1000000
  31. zmap -p 80 -B 50M -N 1000 -O extended_file -o - | ./forge-socket -c 8000 -d http-req > http-banners.out
  32. The options are similar to banner-grab-tcp, except there is no connection timeout :)
  33. OPTIONS:
  34. -----
  35. -c, --concurent Number of connections that can be going on at once.
  36. This, combined with timeouts, will decide the maximum
  37. rate at which banners are grabbed. If this value
  38. is set higher than 1000, you should use
  39. `ulimit -SSn 1000000` and `ulimit -SHn 1000000` to
  40. avoid running out of file descriptors (typically capped
  41. at 1024).
  42. -r, --read-timeout Read timeout (seconds). Give up on a host if after
  43. connecting (and optionally sending data), it does
  44. not send any response by this time. Default: 4 seconds.
  45. -v, --verbosity Set status verbosity. Status/error messages are outputed
  46. on stderr. This value can be 0-5, with 5 being the most
  47. verbose (LOG_TRACE). Default: 3 (LOG_INFO)
  48. -f, --format Format to output banner responses. One of 'hex', 'ascii',
  49. or 'base64'.
  50. 'hex' outputs ascii hex characters, e.g. 48656c6c6f.
  51. 'ascii' outputs ascii, without separators, e.g. Hello
  52. 'base64' outputs base64 encoding, e.g. SGVsbG8=
  53. Default is base64.
  54. -d, --data Optional data file. This data will be sent to each host
  55. upon successful connection. Currently, this file does
  56. not allow null characters, but supports up to 4
  57. occurances of the current host's IP address, by replacing
  58. %s with the string (inet_ntoa) of that host's IP address.