From 1d970e68085cf4e747acdfa47207bca65dc600b9 Mon Sep 17 00:00:00 2001 From: shadowy-pycoder Date: Wed, 18 Sep 2024 08:45:48 +0300 Subject: [PATCH 1/3] Updated `README.md` with supported layers --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index bf81be6..8061c60 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,22 @@ With `-v` flag enabled, you will see more detailed information: ![Screenshot from 2024-09-17 09-56-20](https://github.com/user-attachments/assets/11539ea7-779e-4faf-8fce-2eea9ab653c7) ![Screenshot from 2024-09-17 09-56-47](https://github.com/user-attachments/assets/26b6353d-d312-40c5-9917-3f2f7bb8abdc) + +## Supported layers + +- [Ethernet](https://en.wikipedia.org/wiki/Ethernet_frame) +- [IPv4](https://en.wikipedia.org/wiki/IPv4) +- [IPv6](https://en.wikipedia.org/wiki/IPv6) +- [ARP](https://en.wikipedia.org/wiki/Address_Resolution_Protocol) +- [ICMP](https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol) +- [ICMPv6](https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6) +- [TCP](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) +- [UDP](https://en.wikipedia.org/wiki/User_Datagram_Protocol) +- [DNS](https://en.wikipedia.org/wiki/Domain_Name_System) +- [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) +- [SNMP](https://en.wikipedia.org/wiki/Simple_Network_Management_Protocol) +- [FTP](https://en.wikipedia.org/wiki/File_Transfer_Protocol) +- [SSH](https://en.wikipedia.org/wiki/Secure_Shell) +- [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) + + From 8df2de18988c7922bba8a6588e7d9d9a9f2eeeb2 Mon Sep 17 00:00:00 2001 From: shadowy-pycoder Date: Wed, 18 Sep 2024 09:18:16 +0300 Subject: [PATCH 2/3] Updated `README.md` with roadmap --- README.md | 6 ++++++ layers/layers.go | 21 --------------------- layers/tcp.go | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 8061c60..e959012 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,9 @@ With `-v` flag enabled, you will see more detailed information: - [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) +## Roadmap + +- [x] Online packet capture to `stdout`, `txt`, `pcap` and `pcapng` files +- [ ] Offline packet capture from `pcap` and `pcapng` files +- [ ] Add proper parsing for `SNMP` messages +- [ ] Add packet generation and packet injection functionality diff --git a/layers/layers.go b/layers/layers.go index b1aa117..1cc1c53 100644 --- a/layers/layers.go +++ b/layers/layers.go @@ -43,27 +43,6 @@ type Layer interface { Summary() string } -func nextAppLayer(src, dst uint16) string { - var layer string - switch { - case src == 20 || dst == 20 || src == 21 || dst == 21: - layer = "FTP" - case src == 22 || dst == 22: - layer = "SSH" - case src == 53 || dst == 53: - layer = "DNS" - case src == 80 || dst == 80: - layer = "HTTP" - case src == 161 || dst == 161 || src == 162 || dst == 162: - layer = "SNMP" - case src == 443 || dst == 443: - layer = "TLS" - default: - layer = "" - } - return layer -} - func bytesToStr(b []byte) string { return unsafe.String(unsafe.SliceData(b), len(b)) } diff --git a/layers/tcp.go b/layers/tcp.go index a3d7387..790c814 100644 --- a/layers/tcp.go +++ b/layers/tcp.go @@ -130,3 +130,24 @@ func (t *TCPSegment) Parse(data []byte) error { func (t *TCPSegment) NextLayer() (string, []byte) { return nextAppLayer(t.SrcPort, t.DstPort), t.payload } + +func nextAppLayer(src, dst uint16) string { + var layer string + switch { + case src == 20 || dst == 20 || src == 21 || dst == 21: + layer = "FTP" + case src == 22 || dst == 22: + layer = "SSH" + case src == 53 || dst == 53: + layer = "DNS" + case src == 80 || dst == 80: + layer = "HTTP" + case src == 161 || dst == 161 || src == 162 || dst == 162: + layer = "SNMP" + case src == 443 || dst == 443: + layer = "TLS" + default: + layer = "" + } + return layer +} From 3539d0b107d2255fa16c1c8813064e2731be5d79 Mon Sep 17 00:00:00 2001 From: shadowy-pycoder <35629483+shadowy-pycoder@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:46:35 +0300 Subject: [PATCH 3/3] Update README.md with logo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e959012..a51be06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +![mshark_new](https://github.com/user-attachments/assets/ee1b9526-dcae-4ff8-962d-315897e49ed0) # mShark - Mini [Wireshark](https://www.wireshark.org/) written in Go