update readme

This commit is contained in:
Peifer, Theodor
2025-06-01 18:20:27 +02:00
parent da38e76190
commit 4337c54549
9 changed files with 54 additions and 807 deletions

762
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
[package]
name = "somo"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
authors = ["theopfr"]
description = "A human-friendly alternative to netstat or ss for socket monitoring with the ability to scan for malicious IP addresses."
description = "A human-friendly alternative to netstat or ss for socket monitorin."
license = "MIT"
readme = "./README.mderror: linking with `cc` failed: exit status: 1"
readme = "./README.md"
repository = "https://github.com/theopfr/somo/"
keywords = ["netstat", "socket-monitoring", "port-checker"]
categories = ["command-line-utilities"]
@@ -14,8 +14,5 @@ categories = ["command-line-utilities"]
clap = { version = "4.3.0", features = ["derive"] }
inquire = "0.6.2"
procfs = "0.15.1"
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
serde_json = "1.0.96"
termimad = "0.20"
terminal_size = "0.2.6"
tokio = { version = "1", features = ["full"] }
terminal_size = "0.2.6"

View File

@@ -1,71 +1,57 @@
[![Build, Test and Release](https://github.com/theopfr/somo/actions/workflows/cicd.yml/badge.svg?branch=master)](https://github.com/theopfr/somo/actions/workflows/cicd.yml)
# 🌏 Somo
### A human-friendly alternative to netstat or ss for socket monitoring with the ability to scan for malicious IP addresses.
### A human-friendly alternative to netstat for socket and port monitoring for Linux.
## ✨ Features:
- pleasing to the eye thanks to a nice table-view
- filterable (see filter-options below)
- interactive killing of processes
- from ``nestat -tulpn`` to ``somo -l`` (almost half the characters, can you believe it?)
![somo-example](./images/somo-example.png)
---
## ⬇️ Installation:
### Debian:
### Option 1 - Debian:
If you use a Debian OS go to [releases](https://github.com/theopfr/somo/releases) and download the latest .deb release.
### From crates.io:
#### 1. Install cargo:
You can install cargo from the [crates.io](https://crates.io/) website.
#### 2. Install the somo crate:
### Option 2 - From crates.io:
```
cargo install somo
```
---
## 🏃‍♀️ Running somo:
To run somo just type:
```
somo
```
#### Using sudo:
It can often be beneficial to run it in ``sudo`` mode since many PIDs will remain hidden otherwise. If ``sudo somo`` doesn't work, try running it using the full path:
```bash
# you can find out the path by running: "where somo"
sudo /path/to/somo
# or directly like this
sudo $(where somo)
```
Problems with this: it's unconvenient and ENV variables can't be accessed!
Better solution: Add it to the ``$PATH`` variable (like [this](https://opensource.com/article/17/6/set-path-linux)).
Most of the time you will want to run this in ``sudo`` mode, since otherwise much information will be hidden (same game as with ``netstat``).
## ⚙️ Features:
### 1. Pretty and easily readable table:
![somo-example](./images/somo-example.png)
### Filtering:
### 2. Filtering:
You can filter by **remote port**, **local port**, **IP**, **protocol**, **client program**, **PID** and **connection status**.
Check the flag descriptions below.
### 3. Process killing:
With the ``-k`` flag you can choose to kill a process after inspecting the connections using an interactive selection option.
![kill-example](./images/kill-example.png)
### 4. Checking for malicious IPs using [AbuseIPDB.com](https://www.abuseipdb.com/):
To automatically check if any of the remote IPs you are connected to are malicious you can specify an API key for the AbuseIPDB API as an environment variable:
```bash
export ABUSEIPDB_API_KEY={your-api-key} # not session persistent
```
Adding the ``-c`` flag will then check for malicious IPs and notify you in the table:
![check-example](./images/check-example.png)
---
## 🚩 Flags:
| flag | description | value |
You can use the following flags to filter based on diffferent attributes:
| filter flag | description | value |
| :------------- |:------------- | :----- |
| ```--proto``` | filter by either TCP or UDP | ``tcp`` or ``udp`` |
| ```--ip``` | filter by a remote IP | the IP address e.g ``0.0.0.0`` |
| ```--port, -p``` | filter by a remote port | the port number, e.g ``443`` |
| ```--local-port``` | filter by a local port | the port number, e.g ``5433`` |
| ```--program``` | filter by a client program | the program name e.g ``chrome`` |
| ```--pid, -p``` | filter by a PID | the PID number, e.g ``10000`` |
| ```--port, -p``` | filter by a local port | port number, e.g ``5433`` |
| ```--remote-port``` | filter by a remote port | port number, e.g ``443`` |
| ```--ip``` | filter by a remote IP | IP address e.g ``0.0.0.0`` |
| ```--program``` | filter by a client program | program name e.g ``chrome`` |
| ```--pid, -p``` | filter by a PID | PID number, e.g ``10000`` |
| ```--open, -o``` | filter by open connections | - |
| ```--exclude-ipv6, -e``` | don't list IPv6 connections | - |
| ```--kill, -k``` | interactive process killing | - |
| ```--check, -c``` | check remote IPs using AbuseIPDB (make sure the environment variable ``ABUSEIPDB_API_KEY`` is set) | - |
| ```--listen, -l``` | filter by open connections | - |
| ```--exclude-ipv6``` | don't list IPv6 connections | - |
### Process killing:
With the ``--kill, -k`` flag you can choose to kill a process after inspecting the connections using an interactive selection option.
![kill-example](./images/somo-kill-example.png)
You can of course also apply filters and the kill-flag at the same time:
```
somo --program postgres -k
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -99,7 +99,7 @@ pub fn kill_process(pid: &String) {
} else {
println!("Failed to kill process, try running");
utils::pretty_print_error(
"Couldn't kill process! Try again using sudo: 'sudo $(where somo)'.",
"Couldn't kill process! Try again using sudo.",
);
}
}

View File

@@ -68,7 +68,7 @@ pub fn pretty_print_info(text: &str) {
let mut skin = MadSkin::default();
skin.bold.set_fg(White);
skin.italic = CompoundStyle::new(Some(gray(11)), None, Encircled.into());
skin.strikeout = CompoundStyle::new(Some(DarkGreen), None, Encircled.into());
skin.strikeout = CompoundStyle::new(Some(Cyan), None, Encircled.into());
let markdown: String = format!("~~Info~~: *{}*", text);
print!("{}", skin.term_text(&markdown));