Beispiel #1
0
def client():
    file_handle, file_name = tempfile.mkstemp()
    my_app.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + file_name
    my_app.app.config['TESTING'] = True

    init_db.main()
    client = my_app.app.test_client()
    with my_app.app.app_context():
        my_app.db.init_app(my_app.app)

    yield client

    os.close(file_handle)
    os.unlink(file_name)
Beispiel #2
0
def main():
    print("testing with dummy data (dhcp.pcap, pcap2.json")
    init_db.main()
    os.system("./pcap2db.sh ../pcaps/dhcp.pcap")

    connection = init_db.connect_database()
    add_tag(connection, 'bob', 'SRC')
    add_tag(connection, 'bob', 'DST')
    add_tagged(connection, 1, 'dhcp.pcap', 2)
    connection.close()

    json2db.main(['./pcap2.json'])
    print("finished adding dummy data")

    msg = "1. tables reset and packets from dhcp.pcap added to the packet table\n" \
          "2. dummy tag (Bob) created on pin=2 packet's SRC (192.168.0.1)\n" \
          "3. add packets from pcap2.json (which is just a slightly modified version of dhcp.pcap)\n" \
          "all packets 192.168.0.1 are automatically tagged with Bob\n" \
          "Tagged table should have 4 entries."
    print(msg)
Beispiel #3
0
def setup():
    init_db.main()
Beispiel #4
0
def setup():
    init_db.main()