Skip to content

Commit

Permalink
added readme, added port number for compare report as input, cleanup,…
Browse files Browse the repository at this point in the history
… ready for 1.0.0 release
  • Loading branch information
stokpop committed Apr 21, 2020
1 parent 8742949 commit 4dcddc5
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 113 deletions.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# netstat info

Produce some netstat -an files for instance as follows:

netstat -an > netstat.1.info
sleep 10
netstat -an > netstat.2.info

Now have the netstat-info jar file available:

curl -s -o netstat-info.jar https://github.com/stokpop/netstat-info/releases/download/1.0.0/netstat-info-1.0.0-all.jar

Create a mapper file to map ip's to known names, for instance `netstat.mapper`:

127.0.0.1=localhost
1.2.3.4=my_laptop
Run netstat-info with the files:

java -jar netstat-info.jar report netstat.1.info netstat.mapper

This will show a report like:

========= Processing netstat.1.info =========

==> Listen ports (15)
..., 3633, 6395, 6434

=== INCOMING ===

==> Count per state (INCOMING)
I ESTABLISHED(3633)=1
I ESTABLISHED(6395)=2
I ESTABLISHED(6434)=1

==> Count established per address and port (INCOMING)
I 192.168.1.125(6395)=1
I 192.168.1.205(6395)=1
I localhost(3633)=1
I localhost(6434)=1

=== OUTGOING ===

==> Count per state (OUTGOING)
O CLOSE_WAIT(443)=6
O ESTABLISHED(2553)=1
O ESTABLISHED(3633)=3
...
You can also compare two files, and supply the portnumber to compare:

java -jar netstat-info.jar compare 443 netstat.1.info netstat.2.info netstat.mapper

It will output something like:

==> compare netstat.1.info and netstat.2.info
5.11.77.13(443)-my_laptop(52332) ESTABLISHED ==> ESTABLISHED
16.12.3.1(443)-my_laptop(52212) CLOSE_WAIT ==> CLOSE_WAIT
...

# directories

When you supply directories instead of file names, all files in the directory will be walked
and reports and/or compares are generated for all found netstat files. Example:

java -jar netstat-info.jar report netstat.1.info netstat.2.info netstat.mapper

# build

To build executable jar:

./gradlew clean installShadowDist

The jar is here:

./build/libs/netstat-info-1.0-all.jar

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "nl.stokpop"
version = "1.0-SNAPSHOT"
version = "1.0.0"

application {
mainClassName = "nl.stokpop.NetstatInfoKt"
Expand Down
Loading

0 comments on commit 4dcddc5

Please sign in to comment.