python - OS X Scapy Promiscuous Mode -
I am using scripts for a list of all HTTP host headers sent to my network. Currently the code is:
#! / Usr / bin / env python import sys.path.append ("/ usr / local / lib / python2.7 / site-packages") Re-import from Scapy.all import * Import OS import urlib conf.sniff_promisc = True HOST_REGEX = "(? & Lt; = \ r \ n Host \ :) ([A-Za-z.]) {4,40} (? = \ R \ n)" def print_host_header (pckt): If pckt: Raw = pckt.getlayer (raw) if raw: raw_pckt_data = raw.load host_results = re.search (HOST_REGEX, raw_pckt_data) if host_results: print "[*] Request:" + str (host_results.group (0)) if __name__ = = "__main__": if os.getuid ()! = 0: Print "[!] Is not running as root." It works very well (obviously it can not read encrypted traffic with SASL / TLS) (Remove) (1) SPIF (filter = 'TCP', PRN = print_host_header, store = 0)
), but I do not want to capture any packet from my laptop (which is the computer Script is running) I correct conf.promisc
and according to ifconfig I am in a variety of modes:
735Tesla # ifconfig en1 en1: flag = 8963 & lt; UP, Broadcast, SMART, Running, PROMISC, Simplex, Multicast & gt; MTU 1500 Ether 60: C5 [...] Innet 6 Fei 80: 62C5: 47FF: FH2B: 3768% N1 prefixelen 64Scopad 0x5Ent 192.168.1.8 Netmask 0xffffff00 Broadcasting 192.168.1.255 ND6 Option = 1 & lt; Execution & gt; Media: Autozel Atat: Active 735 Tasla #
For other reasons, I will not be able to capture packets for other computers?
I'm running OS X 10.9. 1 (I really need to update or Patch Gateo may fail. I think: p)
if en1
is an ethernet adapter, what are the other machines on the network from which it is plugged? Is en1
plugged into a switch? If it is ,.
If en1
is a Wi-Fi adapter, then you have to capture in monitor mode; I do not know how the scanner supports how to turn on the monitor mode, but you may have to set the link-layer header type with the "802.11 radiotap header" to go into monitor mode. In Monitor mode, if the network is a "protected" network (using WEP or WPA / WPA2 encryption), then you have to decrypt the packet on the link layer - Scapy has no support for this.
Comments
Post a Comment