コード例 #1
0
def test_pcapreader_pyshark_engine():
    # Testing pyshark engine for >= python3.0
    from sys import version_info
    if version_info[0] >= 3:
        pcapfile = pcap_reader.PcapEngine(sys.path[0] + 'examples/test.pcap',
                                          "pyshark")
        if memory.packet_db:
            assert True
    else:
        # Python2.7 tests
        # Ref: https://medium.com/python-pandemonium/testing-sys-exit-with-pytest-10c6e5f7726f
        with pytest.raises(SystemExit):
            pcap_reader.PcapEngine(sys.path[0] + 'examples/test.pcap',
                                   "pyshark")
コード例 #2
0
def main():
    pcap_reader.PcapEngine('examples/torExample.pcap', "scapy")
    tor = torTrafficHandle()
    #print(memory.packet_db)
    print(memory.tor_nodes)
    tor.tor_traffic_detection()
    print(memory.possible_tor_traffic)
コード例 #3
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_pcapreader_pyshark_engine(packet_capture_file, engine):
    # Testing pyshark engine for >= python3.0
    # Excep Case: Bypass test for a possible pyshark bug - infinite loop in fileCapture
    if packet_capture_file == "tamu_readingrainbow_0_network_enumeration.pcap":
            assert True
    else:
        from sys import version_info
        if version_info[0] >= 3:
            pcap_reader.PcapEngine(sys.path[0]+'examples/'+packet_capture_file, engine)
            if memory.packet_db:
                memory.packet_db = {}
                assert True
        else:
            # Python2.7 tests
            # Ref: https://medium.com/python-pandemonium/testing-sys-exit-with-pytest-10c6e5f7726f
            with pytest.raises(SystemExit):
                pcap_reader.PcapEngine(sys.path[0]+'examples/'+packet_capture_file, engine)
コード例 #4
0
def main():
    # draw example
    pcapfile = pcap_reader.PcapEngine('examples/torExample.pcap', "scapy")
    print("Reading Done....")
    details = communication_details_fetch.trafficDetailsFetch("sock")
    import sys
    print(sys.path[0])
    network = plotLan("test", sys.path[0])
コード例 #5
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_report_gen():
    directory = sys.path[0] 
    filename = "test"
    pcap_reader.PcapEngine(directory + 'examples/' + filename + ".pcap", "scapy")
    if memory.packet_db:
        report_generator.reportGen(sys.path[0], filename).packetDetails()
        report_generator.reportGen(sys.path[0], filename).communicationDetailsReport()
        report_generator.reportGen(sys.path[0], filename).deviceDetailsReport()
        if os.path.isfile(sys.path[0]+"/Report/testcommunicationDetailsReport.txt") and os.path.isfile(sys.path[0]+"/Report/testdeviceDetailsReport.txt") and os.path.isfile(sys.path[0]+"/Report/testpacketDetailsReport.txt"):
            assert True
コード例 #6
0
def main():
    cap = pcap_reader.PcapEngine('examples/torExample.pcap', "scapy")
    maliciousTrafficIdentifier()
    print(memory.possible_mal_traffic)
コード例 #7
0
def main():
    import pcap_reader
    capture = pcap_reader.PcapEngine('examples/test.pcap', "scapy")
    details = trafficDetailsFetch("sock")
    print(memory.destination_hosts)
    print("\n")
コード例 #8
0
def main():
    filename = "test.pcap"
    pcap_reader.PcapEngine('examples/test.pcap', "scapy")
    fetchDeviceDetails("ieee").fetch_info()
    print(memory.lan_hosts)
コード例 #9
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_malicious_traffic_identifier():
    pcap_reader.PcapEngine(sys.path[0]+'examples/test.pcap', "scapy")
    communication_details_fetch.trafficDetailsFetch("sock")
    malicious_traffic_identifier.maliciousTrafficIdentifier()
    if memory.possible_mal_traffic:
        assert True
コード例 #10
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_device_details_fetch():
    pcap_reader.PcapEngine(sys.path[0]+'examples/test.pcap', "scapy")
    device_details_fetch.fetchDeviceDetails("ieee").fetch_info()
    if memory.lan_hosts:
        assert True
コード例 #11
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_communication_details_fetch():
    pcap_reader.PcapEngine(sys.path[0]+'examples/test.pcap', "scapy")
    communication_details_fetch.trafficDetailsFetch("sock")
    if memory.destination_hosts:
        assert True
コード例 #12
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_pcapreader(packet_capture_file, engine):
    pcap_reader.PcapEngine(sys.path[0]+'examples/'+packet_capture_file, engine)
    if memory.packet_db:
        memory.packet_db = {}
        assert True
コード例 #13
0
ファイル: test_sanity.py プロジェクト: zerolugithub/PcapXray
def test_tor_traffic_handle():
    pcap_reader.PcapEngine(sys.path[0]+'examples/test.pcap', "scapy")
    tor_traffic_handle.torTrafficHandle().tor_traffic_detection()
    if memory.possible_tor_traffic:
            assert True
コード例 #14
0
def test_pcapreader():
    pcapfile = pcap_reader.PcapEngine(sys.path[0] + 'examples/test.pcap',
                                      "scapy")
    if memory.packet_db:
        assert True