예제 #1
0
파일: legba.py 프로젝트: guzmud/anansi
def get_devlist():
    temp = []
    alldevs=ctypes.POINTER(winpcapy.pcap_if_t)()
    errbuf= winpcapy.create_string_buffer(winpcapy.PCAP_ERRBUF_SIZE)
    
    if (winpcapy.pcap_findalldevs(ctypes.byref(alldevs), errbuf) == -1):
        print ("Error in pcap_findalldevs: %s\n" % errbuf.value)
        sys.exit(1)

    i=0
    try:
        d=alldevs.contents
    except:
        print ("Error in pcap_findalldevs: %s" % errbuf.value)
        sys.exit(1)

    while d:
        temp += [str(d.name)]
        i += 1
        if d.next:
            d=d.next.contents
        else:
            d=False

    if (i==0):
        print ("\nNo interfaces found! Make sure WinPcap is installed.\n")
        sys.exit(-1)

    #try:
    #    winpcap.pcap_freealldevs(alldevs)
    #except:
    #    print ("Error in pcap_freealldevs")

    return temp
예제 #2
0
파일: legba.py 프로젝트: guzmud/anansi
def get_pcapinfo(devnum):
    temp1 = []
    temp2 = []
    alldevs=ctypes.POINTER(winpcapy.pcap_if_t)()
    errbuf= winpcapy.create_string_buffer(winpcapy.PCAP_ERRBUF_SIZE)
    
    if (winpcapy.pcap_findalldevs(ctypes.byref(alldevs), errbuf) == -1):
        print ("Error in pcap_findalldevs: %s\n" % errbuf.value)
        sys.exit(1)

    i=0
    try:
        d=alldevs.contents
    except:
        print ("Error in pcap_findalldevs: %s" % errbuf.value)
        sys.exit(1)

    for i in range(0,devnum):
        d=d.next.contents

    if d.name:
        temp1 += [d.name]
    if d.description:
        temp1 += [d.description]
    
    if d.addresses:
        a=d.addresses.contents
    else:
        a=False
    while a:
        a_temp = []
        if a.addr:
            a_temp += [cast2str(ctypes.cast(a.addr,ctypes.POINTER(sockaddr_in)))]
        else:
            a_temp += [404]
            
        if a.netmask:
            a_temp += [cast2str(ctypes.cast(a.netmask,ctypes.POINTER(sockaddr_in)))]
        else:
            a_temp += [404]

        temp2 += [a_temp,]
                       
        if a.next:
            a=a.next.contents
        else:
            a=False

    #try:
    #    winpcap.pcap_freealldevs(alldevs)
    #except:
    #    print ("Error in pcap_freealldevs")

    return temp1, temp2
예제 #3
0
# SCENARIO VARS

DEFAULT_STEGCONF = 'conf_steg.py'
BACKUP_STEGCONF = 'conf_steg.py.old'
DEFAULT_APPLICONF = 'conf_appli.py'
BACKUP_APPLICONF = 'conf_appli.py.old'

SCENARIO_FOLDER = 'scenarios'
STEGSCENAR_FOLDER = 'steg'
APPLISCENAR_FOLDER = 'appli'
SCENARIO_NAME = None

# PCAP VARS

ERRBUF = winpcapy.create_string_buffer(winpcapy.PCAP_ERRBUF_SIZE)

DEV0 = netconf.DEVICE1
DEV1 = netconf.DEVICE2
DEV0MAC = netconf.DEV1MAC
DEV1MAC = netconf.DEV2MAC
DEV0IP = netconf.DEV1IP
DEV1IP = netconf.DEV2IP

DEV0HANDLER = winpcapy.pcap_open_live(DEV0, 65536, 0, 1000, ERRBUF)
DEV1HANDLER = winpcapy.pcap_open_live(DEV1, 65536, 0, 1000, ERRBUF)

# BUFFER VARS

DEV0RBUFFER = multiprocessing.Queue(
)  # buffer entre readingspider et craftspider
예제 #4
0
# SCENARIO VARS

DEFAULT_STEGCONF = 'conf_steg.py'
BACKUP_STEGCONF = 'conf_steg.py.old'
DEFAULT_APPLICONF = 'conf_appli.py'
BACKUP_APPLICONF = 'conf_appli.py.old'

SCENARIO_FOLDER = 'scenarios'
STEGSCENAR_FOLDER = 'steg'
APPLISCENAR_FOLDER ='appli'
SCENARIO_NAME = None

# PCAP VARS

ERRBUF = winpcapy.create_string_buffer(winpcapy.PCAP_ERRBUF_SIZE)

DEV0 = netconf.DEVICE1
DEV1 = netconf.DEVICE2
DEV0MAC = netconf.DEV1MAC
DEV1MAC = netconf.DEV2MAC
DEV0IP = netconf.DEV1IP
DEV1IP = netconf.DEV2IP

DEV0HANDLER = winpcapy.pcap_open_live(DEV0,65536,0,1000,ERRBUF)
DEV1HANDLER = winpcapy.pcap_open_live(DEV1,65536,0,1000,ERRBUF)

# BUFFER VARS

DEV0RBUFFER = multiprocessing.Queue() # buffer entre readingspider et craftspider
DEV0MBUFFER = multiprocessing.Queue() # buffer entre craftspider et middlespider