GithubHelp home page GithubHelp logo

elesiuta / picosnitch Goto Github PK

View Code? Open in Web Editor NEW
586.0 6.0 15.0 4.48 MB

Monitor Network Traffic Per Executable, Beautifully Visualized

Home Page: https://elesiuta.github.io/picosnitch/

License: GNU General Public License v3.0

Python 99.63% Shell 0.37%
networking security monitoring privacy intrusion-detection bandwidth-monitor network-monitor network-monitoring network-traffic network-visualization

picosnitch's People

Contributors

aschaap avatar elesiuta avatar gpchelkin avatar mjdsys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

picosnitch's Issues

picosnitch dash returns: touch ~/.config/picosnitch/dash: permission denied

Just updated the package on Arch Linux (which was a mission in itself due to the python-flask-seasurf package not installing), and saw that there was a new dash command. Tried running it and got this error:

touch ~/.config/picosnitch/dash: permission denied

Took a look at the ~/.config/picosnitch folder and it was owned by root:root. I have never interacted with this folder before. I changed ownership of folder to my user. Running the command again, it says 'serving web gui...', and opens the webpage but localhost:5100 doesn't load anything. The process in the terminal also exits immediately (not sure if that's expected).

Better website

The website (https://elesiuta.github.io/picosnitch/) is literally just a copy of the readme with one of the default themes for GitHub Pages. Both the layout and content could use a change.

It should probably focus on just highlighting the features with some screenshots/gifs, and direct users to the repo (https://github.com/elesiuta/picosnitch) for more details and installation/instructions.

The GitHub Pages config is stored in docs/_config.yml and the page is in docs/index.md.

Incorrect reporting in logs/db

Noticed a peculiarity RE: cmdline reporting in the db/logs.

For instance, running "curl https://google.com" will correctly report that exact command under the "cmdline" column.

Afterwards, if you attempt to run "curl https://facebook.com", for example, the db will again report "curl https://google.com" under the cmdline column.

restarting the picosnitch service "fixes" the issue for the first command post restart, all subsequent (unique) commands will have the same "cmdline" value as the first one.

"pcmdline" also exhibits some very strange (incorrect) reporting, but i dont have an exact understanding of what happens

Can we please see a Fedora RPM be created?

I'm just a Linux noob in desperate search to permanently replace the god awful creation that is Windows and a bandwidth monitor is the final piece of critical software that's missing. Glasswire on Windows is so simple and beautiful at monitoring per app bandwidth and your Picosnitch is the closet thing I've come across for Linux after much too many hours searching. Portmaster is a great new per app firewall but it's not designed to be for bandwidth monitoring and not something they've said they want to support either. Being able to use Picosnitch to see whats hogging up too much bandwidth and then using Portmaster to block that specific thing with ease is a very beautiful enticing combo that I would love to have on Linux.

Unfortunately though there's no easy way to download Picosnitch on Fedora. This is really really sad as Picosnitch is perfect for newer users like myself looking for a simple and elegant alternative to Glasswire at a time when many more newer Linux users are going to be giving Fedora a try instead of Ubuntu as one of their first distro's. https://www.youtube.com/watch?v=D9h_0dnSGWk and https://www.makeuseof.com/reasons-fedora-is-new-ubuntu/.

As a linux noob just wanting to not be in the dark on what my new operating system with new apps are up to, I've had to sadly and frustratingly give on installing a bandwidth monitor until I can find a simpler way to install one. Having tried the PyPi method, I created quite a mess in the command line and unsure on how to exactly uninstall either. It would be tremulously helpful for all the new Linux users on Fedora if instead a RPM installation option was available as well. Much thanks in advance if you could spare the time to create one.

BPF.support_kfunc() was not True

Exception: Failed to load BPF program b'security_socket_connect_entry': Invalid argument
BPF.support_kfunc() was not True, cannot enable bandwidth monitor, check BCC version or Kernel Configuration
picosnitch subprocess died, attempting restart, terminate by running picosnitch stop

Database

Where is database stored? Could you add option to remove it every x days?

SQL execute OperationalError('table connections has 16 columns but 10 values were supplied',) on line 763

Howdy,

Just upgraded picosnith using : pip3 install "picosnitch[full]" --upgrade --user

and now the error.log is filling up with these entries

2022-11-06 17:01:01 SQL execute OperationalError('table connections has 16 columns but 10 values were supplied',) on line 763
2022-11-06 17:01:07 SQL execute OperationalError('table connections has 16 columns but 10 values were supplied',) on line 763
2022-11-06 17:01:12 SQL execute OperationalError('table connections has 16 columns but 10 values were supplied',) on line 763
2022-11-06 17:01:17 SQL execute OperationalError('table connections has 16 columns but 10 values were supplied',) on line 763

Feature: Add map view for visualizing connections

I've seen this requested a couple times in forums, so if someone wants to implement it, it could probably be done with https://plotly.com/python/bubble-maps/ in a new tab with https://dash.plotly.com/dash-core-components/tabs

All the code for the dash is under the function ui_dash and the connection data is queried from the sqlite db. The location is looked up with get_geoip for each IP and not stored in the sqlite db.

To help with debugging, you can test it with DASH_DEBUG=True python3 picosnitch.py start-dash

chrome webdriver

I was running a script using selnium and wanted to monitor the bandwidth of the spawned chrome instance, but it doest show that inside the filter.

Too much notification

This is a video of extreme case:
https://youtu.be/pYR2W7_bsjQ

Sometimes firefox also send some repetitive notifications.

I think a cooldown timer for each app or an options to disable notification entirely would be nice.

I can't manually disable notification as it's not listed in gnome settings > notification.

Piconsitch crashes when kernel doesn't have CONFIG_SECURITY_NETWORK set

If the kernel is built without CONFIG_SECURITY_NETWORK, then the security_socket_connect_entry function does not exist and BCC cannot attach a BPF program to the kprobe.

Ideally picosnitch would not crash and display some useful message to the user (even if it's just that the kernel is not supported).

100% CPU

I noticed recently picosnitch running at 100% CPU so I stopped it.

I turned it on again today and noticed the same thing.

Within seconds of starting picosnitch it's running at 100% CPU. I'm not sure if it's related to the recent update, but I'm pretty sure that last week it was working normally.

bpf: Failed to load program: Invalid argument

Hi, I've been using picosnitch for the last couple of days on Arch Linux, ever since it showed up in the AUR. Today, after the 0.8.1 upgrade, the below error is thrown:

 
Dec 23 01:37:47 picosnitch[58805]: starting picosnitch in simple mode
Dec 23 01:37:59 picosnitch[58836]: bpf: Failed to load program: Invalid argument
Dec 23 01:37:59 picosnitch[58836]: Process snitchmonitor:
Dec 23 01:37:59 picosnitch[58836]: Traceback (most recent call last):
Dec 23 01:37:59 picosnitch[58836]   File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap
Dec 23 01:37:59 picosnitch[58836]     self.run()
Dec 23 01:37:59 picosnitch[58836]   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
Dec 23 01:37:59 picosnitch[58836]     self._target(*self._args, **self._kwargs)
Dec 23 01:37:59 picosnitch[58836]   File "/usr/lib/python3.10/site-packages/picosnitch.py", line 827, in monitor_subprocess
Dec 23 01:37:59 picosnitch[58836]     b.attach_kprobe(event="security_socket_connect", fn_name="security_socket_connect_entry")
Dec 23 01:37:59 picosnitch[58836]   File "/usr/lib/python3.10/site-packages/bcc/__init__.py", line 829, in attach_kprobe
Dec 23 01:37:59 picosnitch[58836]     fn = self.load_func(fn_name, BPF.KPROBE)
Dec 23 01:37:59 picosnitch[58836]   File "/usr/lib/python3.10/site-packages/bcc/__init__.py", line 527, in load_func
Dec 23 01:37:59 picosnitch[58836]     raise Exception("Failed to load BPF program %s: %s" %
Dec 23 01:37:59 picosnitch[58836]: Exception: Failed to load BPF program b'security_socket_connect_entry': Invalid argument
Dec 23 01:38:03 systemd[1]: picosnitch.service: Main process exited, code=exited, status=1/FAILURE
Dec 23 01:38:03 systemd[1]: picosnitch.service: Failed with result 'exit-code'.
Dec 23 01:38:08 systemd[1]: picosnitch.service: Scheduled restart job, restart counter is at 1.

$ pacman -Q dbus-python picosnitch python python-bcc python-psutil python-requests
dbus-python 1.2.18-3
picosnitch 0.8.1-1
python 3.10.1-1
python-bcc 0.22.0-4
python-psutil 5.8.0-4
python-requests 2.26.0-5

Regards

Improve performance and reliability

polling psutil has poor performance and reliability
sniffing seems to be relatively reliable but has bad performance
I mentioned some ideas in c8ac1d8 along with some other commits

[Feature Request] Log ignore: filter on command params like URL

Hi, I really like the Log ignore option. Would it be possible to add URL's (or patterns of) to that so users could more easily distinguish between expected vs unexpected connections?

IMO such a feature would be very useful for filtering connections made by programs like curl, nc, ssh, wget and the like.

Dashboard bind ip / interface not configurable

Hey there. Nifty tool!

I was not able to access the dashboard though. I'm running it on a headless server, and the dash binds to 127.0.0.1:5100, allowing only local connections.

Would it be possible to select ip / port in the configuration?

Thanks

Too many Firefox notifications

Are all of these useful?

$ tail -f -n 100 ~/.config/picosnitch/exe.log

2022-01-12 16:11:42 DNS Resolver #3 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:42 DNS Resolver #3 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:43 DNS Resolver #4 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:43 DNS Resolver #4 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:44 DNS Resolver #8 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:44 DNS Resolver #8 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:48 DNS Resolver #7 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:48 DNS Resolver #7 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:48 DNS Resolver #6 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:48 DNS Resolver #6 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:48 DNS Resolver #5 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:48 DNS Resolver #5 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:11:48 Socket Thread - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:11:48 Socket Thread - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 16:17:16 GeckoMain - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 16:17:16 GeckoMain - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 17:09:58 DNS Resolver #9 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 17:09:58 DNS Resolver #9 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 19:02:03 DNS Res~ver #10 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 19:02:03 DNS Res~ver #10 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-12 22:02:07 DNS Res~ver #11 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-12 22:02:07 DNS Res~ver #11 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-13 10:17:40 DNS Res~ver #12 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-13 10:17:40 DNS Res~ver #12 - /snap/firefox/838/usr/lib/firefox/firefox (name)
2022-01-13 10:47:14 DNS Res~ver #13 - /snap/firefox/838/usr/lib/firefox/firefox (exe)
2022-01-13 10:47:14 DNS Res~ver #13 - /snap/firefox/838/usr/lib/firefox/firefox (name)

Errors are being redireceted to /dev/null

picosnitch/picosnitch.py

Lines 2330 to 2334 in 34f9f1f

subprocess.Popen(["bash", "-c", f'/usr/bin/env python3 -m webbrowser -t http://{os.getenv("HOST", "localhost")}:{os.getenv("PORT", "5100")}'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return ui_dash()
subprocess.Popen(["bash", "-c", f'let i=0; rm {BASE_PATH}/dash; while [[ ! -f {BASE_PATH}/dash || "$i" -gt 30 ]]; do let i++; sleep 1; done; rm {BASE_PATH}/dash && /usr/bin/env python3 -m webbrowser -t http://{os.getenv("HOST", "localhost")}:{os.getenv("PORT", "5100")}'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
args = ["bash", "-c", f"touch {BASE_PATH}/dash; nohup {sys.executable} \"{os.path.abspath(__file__)}\" start-dash > /dev/null 2>&1 &"]
os.execvp("bash", args)

Hello,
Please remove the redirections and pipes to /dev/null for errors. You may want to consider removing all /dev/null redirections.

I got picosnitch up and running today, but with some difficulty. picosnitch dash wasn't starting, and gave no error messages, nor logs.

I had to open up my Python IDE in order to trace the code. I removed these /dev/null statements, and eventually found that Arch Linux currently has out of date packages for python-dash, which breaks with newer versions of Flask.

I have submitted changes to the Arch User Repo to get these packages updated, however I would appreciate not hiding these error messages. In case packages get updated and break things in the future, users will be able to troubleshoot what is wrong with their system more easily.

Love your work!

Regards,
Aeonik

picosnitch dash/start-dash not working

$ pacman -Qs picosnitch # arch btw
local/picosnitch 0.11.6-1
    Protect your privacy, see which applications make network connections
$ picosnitch start-dash
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/picosnitch.py", line 2187, in <module>
    sys.exit(start_picosnitch())
  File "/usr/lib/python3.10/site-packages/picosnitch.py", line 1869, in start_picosnitch
    return ui_dash()
  File "/usr/lib/python3.10/site-packages/picosnitch.py", line 1702, in ui_dash
    app.run(host=os.getenv("HOST", "localhost"), port=os.getenv("PORT", "5100"), debug=bool(eval(os.getenv("DASH_DEBUG", "False"))))
AttributeError: 'Dash' object has no attribute 'run'

picosnitch dash does open localhost:5100 but there's no server running on that port

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.