-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Pyasn installed but opensnitch does not find #795
Comments
Hi @Ygarr , You're right, it seems that the package does not distribute the db /usr/lib/python3/dist-packages/data/ipasn_20140513_v12.dat.gz for some python versions. I'll investigate it. For the time being, you can download the default db from their repository (https://github.com/hadiasghari/pyasn): ~ $ cd .config/opensnitch/
~ $ wget https://github.com/hadiasghari/pyasn/blob/master/data/ipasn_20140513_v12.dat.gz?raw=true -O ipasn_db.dat.gz
~ $ wget https://github.com/hadiasghari/pyasn/blob/master/data/asnames.json?raw=true
Regarding this package, it's for a different purpose. not for Adresses lookup. |
In order to download latest db: ~ $ cd .config/opensnitch
~ $ pyasn_util_download.py --latest # <- this will download the file rib.*
~ $ pyasn_util_convert.py --single ./rib.20230110.1400.bz2 ipasn_db.dat
~ $ gzip ipasn_db.dat |
I stumbled upon this issue when looking into finding an ASN database, so here's how to obtain a recent-ish cd .config/opensnitch
curl -LO https://ftp.ripe.net/ripe/asnames/asn.txt Then use the following Python script to convert the text file to #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 George Rawlinson <[email protected]>
# SPDX-License-Identifier: GFDL-1.3-or-later
import json
# initialise buffer for file contents
buf = {}
with open("asn.txt") as fh:
for line in fh:
# extract id + name
asn_id, asn_name = line.split(" ", maxsplit=1)
# add to buffer (minus trailing newline)
buf[asn_id] = asn_name.rstrip()
# dump buffer to asnames.json
out_file = open("asnames.json", "w")
json.dump(buf, out_file)
out_file.close() |
I’ve looked at the upstream scripts for pyasn as I’ve recently packaged pyasn for Arch Linux, the data directory isn’t supposed to be included when installed as it is only for examples & testing. So Debian is actually breaking upstream pyasn intention by erroneously including it. Not to mention that the data included is a very stale snapshot from 2015(?), so it would be a good idea if this code was refactored to reflect that. |
Cannot run opensnitch-ui
last version of opensnitch
OS: Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
Installed all packages
log in terminal:
but
and
The text was updated successfully, but these errors were encountered: