Как выполнить этот определенный сценарий Python (присоединенный в вопросе)

Я Имею маленькую сеть и продержался 2 недели, я получаю много разъединений на моих терминалах беспроводной связи, мой друг сказал мне, что 90%, на меня нападают deauth пакеты i, я исследовал немного и нашел этот py сценарий. Но к сожалению я не мог найти справку о том, как использовать ее.. Я являюсь действительно новым на Linux, там кто-либо готовый помочь?


#!/usr/bin/env python

######################################################
#   authWatch.py v. 0.1 (Quick, Dirty and Loud) - by TinMan
#   Place card in monitor mode and set the channel. 
#   If you want channel hopping, run airodump-ng in 
#   another terminal. Will add channel hopping 
#   in the next version. 
######################################################  
#
#   Usage: python authWatch.py 
#   

import sys
from scapy import *

interface = sys.argv[1]

def sniffReq(p):
     if p.haslayer(Dot11Deauth):
# Look for a deauth packet and print the AP BSSID, Client BSSID and the reason for the deauth.
           print p.sprintf("Deauth Found from AP [%Dot11.addr2%] Client [%Dot11.addr1%], Reason [%Dot11Deauth.reason%]")
# Look for an association request packet and print the Station BSSID, Client BSSID, AP info.
     if p.haslayer(Dot11AssoReq):
           print p.sprintf("Association request from Station [%Dot11.addr1%], Client [%Dot11.addr2%], AP [%Dot11Elt.info%]")
# Look for an authentication packet and print the Client and AP BSSID
           if p.haslayer(Dot11Auth):
       print p.sprintf("Authentication Request from [%Dot11.addr1%] to AP [%Dot11.addr2%]")
       print p.sprintf("------------------------------------------------------------------------------------------")
sniff(iface=interface,prn=sniffReq)
1
задан 31 August 2013 в 04:53

2 ответа

Проблемой с Вашим сценарием была проблема добавления отступа, которая является типичной с новичками Python:

python script.py 
  File "script.py", line 28
    print p.sprintf("Authentication Request from [%Dot11.addr1%] to AP [%Dot11.addr2%]")

                                                                                   ^
IndentationError: unindent does not match any outer indentation level

пространство между ]") и ^ заполнено символами табуляции, и это путает интерпретатор. Вот с исправленным добавлением отступа:

#!/usr/bin/env python

######################################################
#   authWatch.py v. 0.1 (Quick, Dirty and Loud) - by TinMan
#   Place card in monitor mode and set the channel. 
#   If you want channel hopping, run airodump-ng in 
#   another terminal. Will add channel hopping 
#   in the next version. 
######################################################  
#
#   Usage: python authWatch.py 
#   

import sys
from scapy import *

interface = sys.argv[1]

def sniffReq(p):
     if p.haslayer(Dot11Deauth):
# Look for a deauth packet and print the AP BSSID, Client BSSID and the reason for the deauth.
          print p.sprintf("Deauth Found from AP [%Dot11.addr2%] Client [%Dot11.addr1%], Reason [%Dot11Deauth.reason%]")
# Look for an association request packet and print the Station BSSID, Client BSSID, AP info.
     if p.haslayer(Dot11AssoReq):
          print p.sprintf("Association request from Station [%Dot11.addr1%], Client [%Dot11.addr2%], AP [%Dot11Elt.info%]")
# Look for an authentication packet and print the Client and AP BSSID
     if p.haslayer(Dot11Auth):
            print p.sprintf("Authentication Request from [%Dot11.addr1%] to AP [%Dot11.addr2%]")
            print p.sprintf("------------------------------------------------------------------------------------------")
sniff(iface=interface,prn=sniffReq)
2
ответ дан 31 August 2013 в 04:53

В сценарии описывается, как его выполнять:

Usage: python authWatch.py

Вам нужно открыть терминал ( Ctrl + Alt < / kbd> + T ), перейдите туда, где вы сохранили сценарий, а затем введите python authWatch.py.

0
ответ дан 31 August 2013 в 04:53

Другие вопросы по тегам:

Похожие вопросы: