scanner codes and readme

This commit is contained in:
Mari Wahl 2014-12-22 19:33:42 -05:00
parent 4d4b0dcdff
commit c8bf3d71c4
2 changed files with 330 additions and 17 deletions

View file

@ -12,21 +12,6 @@ import os
HOST = '192.168.1.114'
def main(host):
OS = os.name
# create a raw socket, binding to the public interface
# windows allow us to sniff all incoming packets regardless of protocol,
# whereas Linux forces us to specify we are sniffing ICMP
if OS == 'nt':
socket_prot = socket.IPPROTO_IP
sniffing(host, 1, socket_prot)
else:
socket_prot = socket.IPPROTO_ICMP
sniffing(host, 0, socket_prot)
def sniffing(host, win, socket_prot):
@ -47,8 +32,23 @@ def sniffing(host, win, socket_prot):
# read in a single packet
print sniffer.recvfrom(65565)
if win == 1:
sniffer(host, 0, socket_prot)
def main(host):
OS = os.name
# create a raw socket, binding to the public interface
# windows allow us to sniff all incoming packets regardless of protocol,
# whereas Linux forces us to specify we are sniffing ICMP
if OS == 'nt':
socket_prot = socket.IPPROTO_IP
sniffing(host, 1, socket_prot)
else:
socket_prot = socket.IPPROTO_ICMP
sniffing(host, 0, socket_prot)