Skip to content

Commit 200893e

Browse files
author
shadowy-pycoder
committed
Updated README.md
1 parent 6ccddd7 commit 200893e

File tree

1 file changed

+120
-2
lines changed

1 file changed

+120
-2
lines changed

README.md

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,121 @@
1-
# Simple packet capture tool
1+
# mShark - Mini [Wireshark](https://www.wireshark.org/) written in Go
22

3-
## work in progress
3+
4+
## Installation
5+
6+
```shell
7+
CGO_ENABLED=0 go install -ldflags "-s -w" -trimpath github.com/shadowy-pycoder/mshark/cmd/mshark@latest
8+
```
9+
This will install the `mshark` binary to your `$GOPATH/bin` directory.
10+
11+
If you are getting a `Permission denied` error when running `mshark`, try running
12+
```shell
13+
sudo setcap cap_net_raw+ep ~/go/bin/mshark
14+
```
15+
16+
## Usage
17+
18+
```shell
19+
mshark -h
20+
21+
______ __ __
22+
/ \ | \ | \
23+
______ ____ | $$$$$$\| $$____ ______ ______ | $$ __
24+
| \ \ | $$___\$$| $$ \ | \ / \ | $$ / \
25+
| $$$$$$\$$$$\ \$$ \ | $$$$$$$\ \$$$$$$\| $$$$$$\| $$_/ $$
26+
| $$ | $$ | $$ _\$$$$$$\| $$ | $$ / $$| $$ \$$| $$ $$
27+
| $$ | $$ | $$| \__| $$| $$ | $$| $$$$$$$| $$ | $$$$$$\
28+
| $$ | $$ | $$ \$$ $$| $$ | $$ \$$ $$| $$ | $$ \$$\
29+
\$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$$$$$$ \$$ \$$ \$$
30+
31+
Packet Capture Tool by shadowy-pycoder
32+
33+
GitHub: https://github.com/shadowy-pycoder/mshark
34+
35+
Usage: mshark [OPTIONS]
36+
Options:
37+
-h Show this help message and exit.
38+
-D Display list of interfaces and exit.
39+
-c int
40+
The maximum number of packets to capture.
41+
-e string
42+
BPF filter expression. Example: "ip proto tcp"
43+
-f value
44+
File extension(s) to write captured data. Supported formats: stdout, txt, pcap, pcapng
45+
-i string
46+
The name of the network interface. Example: eth0 (default "any")
47+
-p Promiscuous mode. This setting is ignored for "any" interface. Defaults to false.
48+
-s int
49+
The maximum length of each packet snapshot. Defaults to 65535.
50+
-t duration
51+
The maximum duration of the packet capture process. Example: 5s
52+
-v Display full packet info when capturing to stdout or txt.
53+
```
54+
55+
### Example
56+
57+
```shell
58+
mshark -p -f=txt -f=stdout -f=pcapng -i eth0 -e="port 53"
59+
```
60+
The above command will capture packets containing `port 53` (assumed to be DNS queries) from the `eth0` interface and write the captured data to `stdout`, `txt`, and file in `pcapng` format. Files are created in the current working directory.
61+
62+
Output:
63+
64+
```shell
65+
- Interface: eth0
66+
- Snapshot Length: 65535
67+
- Promiscuous Mode: true
68+
- Timeout: 0s
69+
- Number of Packets: 0
70+
- BPF Filter: "port 53"
71+
- Verbose: false
72+
73+
- Packet: 1 Timestamp: 2024-09-17T06:24:08+0000
74+
==================================================================
75+
"\033[37mEthernet Frame: Src MAC: a0:38:22:4a:f4:64 -> Dst MAC: c9:9d:7a:c2:4b:da\033[0m"
76+
IPv4 Packet: Src IP: 192.168.100.100 -> Dst IP: 192.168.100.1
77+
UDP Segment: Src Port: 44138 -> Dst Port: 53 Len: 59
78+
DNS Message: Standard query query 0xc705 HTTPS incoming.telemetry.mozilla.org OPT Root
79+
- Packet: 2 Timestamp: 2024-09-17T06:24:08+0000
80+
==================================================================
81+
Ethernet Frame: Src MAC: a0:38:22:4a:f4:64 -> Dst MAC: c9:9d:7a:c2:4b:da
82+
IPv4 Packet: Src IP: 192.168.100.100 -> Dst IP: 192.168.100.1
83+
UDP Segment: Src Port: 53596 -> Dst Port: 53 Len: 59
84+
DNS Message: Standard query query 0xcb86 A incoming.telemetry.mozilla.org OPT Root
85+
- Packet: 3 Timestamp: 2024-09-17T06:24:08+0000
86+
==================================================================
87+
Ethernet Frame: Src MAC: c9:9d:7a:c2:4b:da -> Dst MAC: a0:38:22:4a:f4:64
88+
IPv4 Packet: Src IP: 192.168.100.1 -> Dst IP: 192.168.100.100
89+
UDP Segment: Src Port: 53 -> Dst Port: 44138 Len: 197
90+
DNS Message: Standard query reply 0xc705 HTTPS incoming.telemetry.mozilla.org CNAME incoming.telemet...
91+
- Packet: 4 Timestamp: 2024-09-17T06:24:08+0000
92+
==================================================================
93+
Ethernet Frame: Src MAC: a0:38:22:4a:f4:64 -> Dst MAC: c9:9d:7a:c2:4b:da
94+
IPv4 Packet: Src IP: 192.168.100.100 -> Dst IP: 192.168.100.1
95+
UDP Segment: Src Port: 56746 -> Dst Port: 53 Len: 74
96+
DNS Message: Standard query query 0x124f HTTPS telemetry-incoming.r53-2.services.mozilla.com OPT Roo...
97+
- Packet: 5 Timestamp: 2024-09-17T06:24:08+0000
98+
==================================================================
99+
Ethernet Frame: Src MAC: c9:9d:7a:c2:4b:da -> Dst MAC: a0:38:22:4a:f4:64
100+
IPv4 Packet: Src IP: 192.168.100.1 -> Dst IP: 192.168.100.100
101+
UDP Segment: Src Port: 53 -> Dst Port: 53596 Len: 284
102+
DNS Message: Standard query reply 0xcb86 A incoming.telemetry.mozilla.org CNAME incoming.telemetry.m...
103+
- Packet: 6 Timestamp: 2024-09-17T06:24:08+0000
104+
==================================================================
105+
Ethernet Frame: Src MAC: c9:9d:7a:c2:4b:da -> Dst MAC: a0:38:22:4a:f4:64
106+
IPv4 Packet: Src IP: 192.168.100.1 -> Dst IP: 192.168.100.100
107+
UDP Segment: Src Port: 53 -> Dst Port: 56746 Len: 156
108+
DNS Message: Standard query reply 0x124f HTTPS telemetry-incoming.r53-2.services.mozilla.com SOA r53...
109+
- Packet: 7 Timestamp: 2024-09-17T06:24:08+0000
110+
==================================================================
111+
Ethernet Frame: Src MAC: a0:38:22:4a:f4:64 -> Dst MAC: c9:9d:7a:c2:4b:da
112+
IPv4 Packet: Src IP: 192.168.100.100 -> Dst IP: 192.168.100.1
113+
UDP Segment: Src Port: 54414 -> Dst Port: 53 Len: 64
114+
DNS Message: Standard query query 0x0ed1 HTTPS optimizationguide-pa.googleapis.com OPT Root
115+
- Packet: 8 Timestamp: 2024-09-17T06:24:08+0000
116+
==================================================================
117+
Ethernet Frame: Src MAC: c9:9d:7a:c2:4b:da -> Dst MAC: a0:38:22:4a:f4:64
118+
IPv4 Packet: Src IP: 192.168.100.1 -> Dst IP: 192.168.100.100
119+
UDP Segment: Src Port: 53 -> Dst Port: 54414 Len: 121
120+
DNS Message: Standard query reply 0x0ed1 HTTPS optimizationguide-pa.googleapis.com SOA googleapis.co...
121+
```

0 commit comments

Comments
 (0)