Annotation of embedaddon/hping2/usage.c, revision 1.1.1.1

1.1       misho       1: /* 
                      2:  * $smu-mark$ 
                      3:  * $name: usage.c$ 
                      4:  * $author: Salvatore Sanfilippo <antirez@invece.org>$ 
                      5:  * $copyright: Copyright (C) 1999 by Salvatore Sanfilippo$ 
                      6:  * $license: This software is under GPL version 2 of license$ 
                      7:  * $date: Fri Nov  5 11:55:50 MET 1999$ 
                      8:  * $rev: 8$ 
                      9:  */ 
                     10: 
                     11: /* $Id: usage.c,v 1.13 2003/08/07 23:55:55 antirez Exp $ */
                     12: 
                     13: #include <stdlib.h>
                     14: #include <stdio.h>
                     15: 
                     16: void   show_usage(void)
                     17: {
                     18:        printf(
                     19: "usage: hping host [options]\n"
                     20: "  -h  --help      show this help\n"
                     21: "  -v  --version   show version\n"
                     22: "  -c  --count     packet count\n"
                     23: "  -i  --interval  wait (uX for X microseconds, for example -i u1000)\n"
                     24: "      --fast      alias for -i u10000 (10 packets for second)\n"
                     25: "  -n  --numeric   numeric output\n"
                     26: "  -q  --quiet     quiet\n"
                     27: "  -I  --interface interface name (otherwise default routing interface)\n"
                     28: "  -V  --verbose   verbose mode\n"
                     29: "  -D  --debug     debugging info\n"
                     30: "  -z  --bind      bind ctrl+z to ttl           (default to dst port)\n"
                     31: "  -Z  --unbind    unbind ctrl+z\n"
                     32: "Mode\n"
                     33: "  default mode     TCP\n"
                     34: "  -0  --rawip      RAW IP mode\n"
                     35: "  -1  --icmp       ICMP mode\n"
                     36: "  -2  --udp        UDP mode\n"
                     37: "  -8  --scan       SCAN mode.\n"
                     38: "                   Example: hping --scan 1-30,70-90 -S www.target.host\n"
                     39: "  -9  --listen     listen mode\n"
                     40: "IP\n"
                     41: "  -a  --spoof      spoof source address\n"
                     42: "  --rand-dest      random destionation address mode. see the man.\n"
                     43: "  --rand-source    random source address mode. see the man.\n"
                     44: "  -t  --ttl        ttl (default 64)\n"
                     45: "  -N  --id         id (default random)\n"
                     46: "  -W  --winid      use win* id byte ordering\n"
                     47: "  -r  --rel        relativize id field          (to estimate host traffic)\n"
                     48: "  -f  --frag       split packets in more frag.  (may pass weak acl)\n"
                     49: "  -x  --morefrag   set more fragments flag\n"
                     50: "  -y  --dontfrag   set dont fragment flag\n"
                     51: "  -g  --fragoff    set the fragment offset\n"
                     52: "  -m  --mtu        set virtual mtu, implies --frag if packet size > mtu\n"
                     53: "  -o  --tos        type of service (default 0x00), try --tos help\n"
                     54: "  -G  --rroute     includes RECORD_ROUTE option and display the route buffer\n"
                     55: "  --lsrr           loose source routing and record route\n"
                     56: "  --ssrr           strict source routing and record route\n"
                     57: "  -H  --ipproto    set the IP protocol field, only in RAW IP mode\n"
                     58: "ICMP\n"
                     59: "  -C  --icmptype   icmp type (default echo request)\n"
                     60: "  -K  --icmpcode   icmp code (default 0)\n"
                     61: "      --force-icmp send all icmp types (default send only supported types)\n"
                     62: "      --icmp-gw    set gateway address for ICMP redirect (default 0.0.0.0)\n"
                     63: "      --icmp-ts    Alias for --icmp --icmptype 13 (ICMP timestamp)\n"
                     64: "      --icmp-addr  Alias for --icmp --icmptype 17 (ICMP address subnet mask)\n"
                     65: "      --icmp-help  display help for others icmp options\n"
                     66: "UDP/TCP\n"
                     67: "  -s  --baseport   base source port             (default random)\n"
                     68: "  -p  --destport   [+][+]<port> destination port(default 0) ctrl+z inc/dec\n"
                     69: "  -k  --keep       keep still source port\n"
                     70: "  -w  --win        winsize (default 64)\n"
                     71: "  -O  --tcpoff     set fake tcp data offset     (instead of tcphdrlen / 4)\n"
                     72: "  -Q  --seqnum     shows only tcp sequence number\n"
                     73: "  -b  --badcksum   (try to) send packets with a bad IP checksum\n"
                     74: "                   many systems will fix the IP checksum sending the packet\n"
                     75: "                   so you'll get bad UDP/TCP checksum instead.\n"
                     76: "  -M  --setseq     set TCP sequence number\n"
                     77: "  -L  --setack     set TCP ack\n"
                     78: "  -F  --fin        set FIN flag\n"
                     79: "  -S  --syn        set SYN flag\n"
                     80: "  -R  --rst        set RST flag\n"
                     81: "  -P  --push       set PUSH flag\n"
                     82: "  -A  --ack        set ACK flag\n"
                     83: "  -U  --urg        set URG flag\n"
                     84: "  -X  --xmas       set X unused flag (0x40)\n"
                     85: "  -Y  --ymas       set Y unused flag (0x80)\n"
                     86: "  --tcpexitcode    use last tcp->th_flags as exit code\n"
                     87: "  --tcp-timestamp  enable the TCP timestamp option to guess the HZ/uptime\n"
                     88: "Common\n"
                     89: "  -d  --data       data size                    (default is 0)\n"
                     90: "  -E  --file       data from file\n"
                     91: "  -e  --sign       add 'signature'\n"
                     92: "  -j  --dump       dump packets in hex\n"
                     93: "  -J  --print      dump printable characters\n"
                     94: "  -B  --safe       enable 'safe' protocol\n"
                     95: "  -u  --end        tell you when --file reached EOF and prevent rewind\n"
                     96: "  -T  --traceroute traceroute mode              (implies --bind and --ttl 1)\n"
                     97: "  --tr-stop        Exit when receive the first not ICMP in traceroute mode\n"
                     98: "  --tr-keep-ttl    Keep the source TTL fixed, useful to monitor just one hop\n"
                     99: "  --tr-no-rtt     Don't calculate/show RTT information in traceroute mode\n"
                    100: "ARS packet description (new, unstable)\n"
                    101: "  --apd-send       Send the packet described with APD (see docs/APD.txt)\n"
                    102:        );
                    103:        exit(0);
                    104: };
                    105: 
                    106: void tos_help(void)
                    107: {
                    108:        printf(
                    109: "tos help:\n"
                    110: "          TOS Name                Hex Value           Typical Uses\n"
                    111: "\n"
                    112: "       Minimum Delay                 10               ftp, telnet\n"
                    113: "       Maximum Throughput            08               ftp-data\n"
                    114: "       Maximum Reliability           04               snmp\n"
                    115: "       Minimum Cost                  02               nntp\n"
                    116:        );
                    117:        exit(0);
                    118: }
                    119: 
                    120: void icmp_help(void)
                    121: {
                    122:        printf(
                    123: "ICMP help:\n"
                    124: " ICMP concerned packet options:\n"
                    125: "  --icmp-ipver     set ip version               ( default 4 )\n"
                    126: "  --icmp-iphlen    set ip header lenght         ( default IPHDR_SIZE >> 2)\n"
                    127: "  --icmp-iplen     set ip total lengtht         ( default real lenght )\n"
                    128: "  --icmp-ipid      set ip id                    ( default random )\n"
                    129: "  --icmp-ipproto   set ip protocol              ( default IPPROTO_TCP )\n"
                    130: "  --icmp-ipsrc     set ip source                ( default 0.0.0.0 )\n"
                    131: "  --icmp-ipdst     set ip destination           ( default 0.0.0.0 )\n"
                    132: "  --icmp-srcport   set tcp/udp source port      ( default random )\n"
                    133: "  --icmp-dstport   set tcp/udp destination port ( default random )\n"
                    134: "  --icmp-cksum     set icmp checksum            ( default the right cksum)\n"
                    135:        );
                    136:        exit(0);
                    137: }
                    138: 
                    139: void route_help(void)
                    140: {
                    141:     printf(
                    142: "route help:\n"
                    143: "      A route has the following format: [ptr:]IP1[/IP2[/IP3...]]\n"
                    144: "      where ptr is the exact value of the pointer that will be used for the IP\n"
                    145: "      option (be careful, no check is performed on this pointer), and defaults\n"
                    146: "      to 8, or 4 if provided route is too short for 8;\n"
                    147: "      and each IPx field is an IP address to include in the source route.\n");
                    148: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>