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

Incorrect reporting in logs/db #32

Closed
Diesiel opened this issue Oct 26, 2023 · 2 comments
Closed

Incorrect reporting in logs/db #32

Diesiel opened this issue Oct 26, 2023 · 2 comments

Comments

@Diesiel
Copy link

Diesiel commented Oct 26, 2023

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

@elesiuta
Copy link
Owner

elesiuta commented Oct 26, 2023

Thanks for the report!

The issue lies here where the cmdline is cached along with the file descriptor for the executable based on its st_dev and st_ino, so that's why the cmdline stays the same, same goes for the parent. (specifically fd_dict where fd_dict[f"{st_dev} {st_ino}"] = (fd, fd_path, exe, cmd))

A fix could be adding another function to lookup and cache the cmdline based solely on the pid instead.

@elesiuta
Copy link
Owner

I just pushed a fix for this if you'd like to/are able to test it to see if it also fixes the strange reporting of pcmdline. Picosnitch just has the one source (.py) file so you can simply replace it on your system with the latest version, or run it from any other folder.

I'll probably create a new release sometime in the next few weeks or so.

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

2 participants