https://github.com/yuuki/lstf
The aggregated TCP flows printer in Linux
https://github.com/yuuki/lstf
go linux netstat tcp
Last synced: 10 months ago
JSON representation
The aggregated TCP flows printer in Linux
- Host: GitHub
- URL: https://github.com/yuuki/lstf
- Owner: yuuki
- License: mit
- Created: 2018-03-04T13:24:35.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-14T10:22:32.000Z (almost 5 years ago)
- Last Synced: 2025-04-12T07:43:55.999Z (10 months ago)
- Topics: go, linux, netstat, tcp
- Language: Go
- Homepage:
- Size: 1.38 MB
- Stars: 160
- Watchers: 6
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# lstf
[](https://github.com/yuuki/lstf/releases)
[](https://goreportcard.com/report/github.com/yuuki/lstf)
[](http://doge.mit-license.org)
lstf prints `host flows` (aggregated network connection flows to the same source or destination ports) by Linux netlink and enables you to simply grasp the network relationship between localhost and other hosts.
friend: [yuuki/lsconntrack](https://github.com/yuuki/lsconntrack)
## Features
- Distinction of `active open` and `passive open`
- Print also the number of connections of each flows (the absolute values are meaningless)
- Go portability
- JSON support
- TCP support only
## Installation
### Download binary from GitHub Releases
## How to use
HTTP requests --> Web:80 --> MySQL:3306
```shell
$ lstf -n
Local Address:Port <--> Peer Address:Port Connections
10.0.1.9:many --> 10.0.1.10:3306 22
10.0.1.9:many --> 10.0.1.11:3306 14
10.0.2.10:22 <-- 192.168.10.10:many 1
10.0.1.9:80 <-- 10.0.2.13:many 120
10.0.1.9:80 <-- 10.0.2.14:many 202
```
- `-->` indicates `active open`
- `<--` indicates `passive open`
Sort flows by the number of connection.
```shell
$ lstf -n | sort -nrk4
```
### JSON format
```shell-session
$ lstf --json | jq -r -M '.'
[
{
"direction": "active",
"local": {
"name"| "app01.local",
"addr": "10.0.1.9",
"port": "many"
},
"peer": {
"name"| "db01.local",
"addr": "10.0.100.1",
"port": "3306"
},
"connections": 20
},
{
"direction": "passive",
"local": {
"name"| "app01.local",
"addr": "10.0.1.9",
"port": "80"
},
"peer": {
"name"| "web01.local",
"addr": "10.0.200.1",
"port": "many"
},
"connections": 27
},
...
]
```
## License
[MIT](LICENSE)
## Author
[yuuki](https://github.com/yuuki)