📄 udp_gen.c
字号:
/* RAW socket utility routine: * * Write out a UDP header. * shadows@whitefang.com * Thamer Al-Herbish */#include <stdlib.h>#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netinet/in_systm.h>#include <netinet/udp.h>#include <unistd.h>#include <strings.h>void udp_gen(char *packet,unsigned short sport, unsigned short dport,unsigned short length){ struct udphdr *udp; udp = (struct udphdr *)packet;#if !defined(LINUX) udp->uh_sport = htons(sport); udp->uh_dport = htons(dport); udp->uh_ulen = htons(length); udp->uh_sum = 0; #else /* LINUX */ udp->source = htons(sport); udp->dest = htons(dport); udp->len = htons(length); udp->check = 0;#endif /* LINUX */ return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -