/***********************************************
* released under (E) licensing ... *
* (E) RULES AND REGULATIONS *
* permission to use/rewrite/add : granted *
* permission to trojan/steal : denied *
* permission to use illegally : denied *
* permission to use on /dev/urandom : denied *
***********************************************/
/* contact el8@press.co.jp for full license */
/* code copyrighted by ~el8 -- don't infringe! */
#include "penis.h"
extern char *optarg;
extern int optind;
main (int argc,
char **argv)
{
int sockfd=0, c=0, p=0,f0rk=0,delay=0;
struct sockaddr_in my_addr, your_addr;
struct hostent *he;
struct penis my_penis;
char data[100];
if (argc < 6)
{
goto usage;
exit(-1);
}
while ( (c = getopt(argc,argv,"l:w:p:D:")) != EOF)
{
switch(c)
{
case 'l':
my_penis.p_length = atof(optarg);
break;
case 'w':
my_penis.p_width = atof(optarg);
break;
case 'p':
p=atoi(optarg);
break;
case 'D':
delay=atoi(optarg);
break;
case 't':
// times = atoi(optarg);
break;
case '?':
goto usage;
exit(-1);
default:
goto usage;
exit(-1);
}
}
if ( 0 >= my_penis.p_width || 0 >= my_penis.p_length )
{
goto usage;
exit(-1);
}
for ( ; optind < argc ; optind++ )
{
f0rk = fork();
if (f0rk==0)
{
exit(0);
}
if ((he=gethostbyname(argv[optind]))==NULL)
{
herror(argv[optind]);
exit(-1);
}
#ifdef DEBUG
fprintf(stderr,"(%i) #%i -> [%s]\n",optind,f0rk,argv[optind]);
#endif
if ((sockfd=socket(AF_INET,SOCK_DGRAM,0))< 0)
{
perror("couldnt get a FUQN UDP SOCKET MOTHERFUQR!");
exit(-1);
}
bzero((char*)&my_addr, sizeof(my_addr));
my_addr.sin_family = AF_INET;
my_addr.sin_addr.s_addr = htonl(INADDR_ANY);
if (delay!=0) sleep(delay);
if ((bind(sockfd, (struct sockaddr*) &my_addr,
sizeof(my_addr))<0))
{
perror("cant fuqn bind to local prot!");
exit(-1);
}
bzero((char*)&your_addr,sizeof(your_addr));
your_addr.sin_family = AF_INET;
your_addr.sin_addr = *((struct in_addr*)he->h_addr);
your_addr.sin_port = htons(p==0?PENIS_PORT:p);
snprintf(data,sizeof(data)-1,
"L %f : W %f",my_penis.p_length,my_penis.p_width);
if (0>(sendto(sockfd,data,sizeof(data),0,
(struct sockaddr*)&your_addr,sizeof(your_addr))))
{
perror("sendto is a stupid bitch!");
exit(-1);
}
shutdown(sockfd,2);
wait();
}
putchar('\n');
exit(0);
usage:
fprintf(stderr,"usage: %s [-l len] [-w width]"
" <-p port> <-D delay> [host(s)...]\n",argv[0]);
}
syntax highlighted by Code2HTML, v. 0.9.1