Advertisement
orglee

netcat query and response problem

Sep 1st, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.81 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. HOST="148.251.22.130"
  4. PORT="27015"
  5.  
  6. #https://developer.valvesoftware.com/wiki/Server_queries#A2S_INFO
  7. QUERY="\xFF\xFF\xFF\xFFTSource Engine Query\x00"
  8.  
  9. echo -e $QUERY | netcat $HOST $PORT
  10.  
  11. #[v1.10-40]
  12. #connect to somewhere:   nc [-options] hostname port[s] [ports] ...
  13. #listen for inbound:     nc -l -p port [-options] [hostname] [port]
  14. #options:
  15. #        -c shell commands       as `-e'; use /bin/sh to exec [dangerous!!]
  16. #        -e filename             program to exec after connect [dangerous!!]
  17. #        -b                      allow broadcasts
  18. #        -g gateway              source-routing hop point[s], up to 8
  19. #        -G num                  source-routing pointer: 4, 8, 12, ...
  20. #        -h                      this cruft
  21. #        -i secs                 delay interval for lines sent, ports scanned
  22. #        -k                      set keepalive option on socket
  23. #        -l                      listen mode, for inbound connects
  24. #        -n                      numeric-only IP addresses, no DNS
  25. #        -o file                 hex dump of traffic
  26. #        -p port                 local port number
  27. #        -r                      randomize local and remote ports
  28. #        -q secs                 quit after EOF on stdin and delay of secs
  29. #        -s addr                 local source address
  30. #        -T tos                  set Type Of Service
  31. #        -t                      answer TELNET negotiation
  32. #        -u                      UDP mode
  33. #        -v                      verbose [use twice to be more verbose]
  34. #        -w secs                 timeout for connects and final net reads
  35. #        -z                      zero-I/O mode [used for scanning]
  36. #port numbers can be individual or ranges: lo-hi [inclusive];
  37. #hyphens in port names must be backslash escaped (e.g. 'ftp\-data').
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement