Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to run with a db errror #16

Open
folkertvanheusden opened this issue Aug 26, 2024 · 0 comments
Open

fails to run with a db errror #16

folkertvanheusden opened this issue Aug 26, 2024 · 0 comments

Comments

@folkertvanheusden
Copy link

folkertvanheusden commented Aug 26, 2024

Hi,

I try to run pcap-stats as described in the manual:

./pcap_stats.py -r test.pcap -f html > pcap_stats.html

Unfortunately this fails with:

folkert@testium:~/pcap-stats$ ./pcap_stats.py -r test.pcap -f html --db_dir db/ > pcap_stats.html
reading from file test.pcap, link-type EN10MB (Ethernet), snapshot length 65535
tcpdump: pcap_loop: truncated dump file; tried to read 60 captured bytes, only got 56
..Traceback (most recent call last):
  File "/home/folkert/pcap-stats/./pcap_stats.py", line 1014, in <module>
    print_stats(cl_args['mincount'], cl_args['minsize'], cl_args['format'], data_source)
  File "/home/folkert/pcap-stats/./pcap_stats.py", line 718, in print_stats
    netbios_hostname_list = select_key(ip_netbios_db, full_ip)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/folkert/pcap-stats/db_lib.py", line 201, in select_key
    with sqlite3.connect("file:" + dbfile + "?mode=ro", uri=True, timeout=sqlite_timeout) as conn:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file

It did create several files:

-rw-rw-r-- 1 folkert folkert 12288 Aug 26 04:27 ip_hostnames.sqlite3
-rw-rw-r-- 1 folkert folkert 12288 Aug 26 04:27 ip_names.sqlite3
-rw-rw-r-- 1 folkert folkert 32768 Aug 26 04:27 ip_names.sqlite3-shm
-rw-rw-r-- 1 folkert folkert     0 Aug 26 04:27 ip_names.sqlite3-wal

It also happens with a properly closed pcap-file:

folkert@testium:~/pcap-stats$ ./pcap_stats.py -r test.pcap -f html --db_dir db/ > pcap_stats.html
reading from file test.pcap, link-type EN10MB (Ethernet), snapshot length 65535
..Traceback (most recent call last):
  File "/home/folkert/pcap-stats/./pcap_stats.py", line 1014, in <module>
    print_stats(cl_args['mincount'], cl_args['minsize'], cl_args['format'], data_source)
  File "/home/folkert/pcap-stats/./pcap_stats.py", line 718, in print_stats
    netbios_hostname_list = select_key(ip_netbios_db, full_ip)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/folkert/pcap-stats/db_lib.py", line 201, in select_key
    with sqlite3.connect("file:" + dbfile + "?mode=ro", uri=True, timeout=sqlite_timeout) as conn:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file
folkert@testium:~/pcap-stats$ ls -l db/
total 56
-rw-rw-r-- 1 folkert folkert 12288 Aug 26 04:33 ip_hostnames.sqlite3
-rw-rw-r-- 1 folkert folkert 12288 Aug 26 04:29 ip_names.sqlite3
-rw-rw-r-- 1 folkert folkert 32768 Aug 26 04:33 ip_names.sqlite3-shm
-rw-rw-r-- 1 folkert folkert     0 Aug 26 04:29 ip_names.sqlite3-wal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant