Skip to content

This Go code is used to listen to network traffic, monitor and analyze certain protocols. Users can listen to live traffic from a specific network interface, monitor protocols such as TCP, UDP, ICMP, and record traffic. It can be used in various applications such as network security and performance monitoring.

Notifications You must be signed in to change notification settings

SUmidcyber/NetFlowCrafter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Network Traffic Analyzer

The Go Network Traffic Analyzer is a versatile tool designed to monitor and analyze network traffic. It allows you to observe various network protocols, record traffic data, and analyze live traffic from specific network interfaces. Features

Protocol Monitoring: Monitor various network protocols such as TCP, UDP, ICMP, etc.
Live Traffic Monitoring: Analyze live traffic from a specified network interface.
Traffic Recording: Record traffic data to log files for later analysis.
Flexible Usage: User-friendly interface and simple command-line options for flexible usage.

Usage

Select the desired network interface and specify the protocols you want to monitor by running the program. Traffic monitoring will start automatically.

bash

go run interfaceP.go  and  go run onlyInterface.go

Requirements

Go (version 1.13 or newer)
github.com/google/gopacket and github.com/google/gopacket/pcap libraries

Contributing

Fork the project and make your enhancements.
Open an issue on GitHub for bug reports and suggestions.
Read, understand, and improve the code.

Listening to the network interface and analyzing TCP packets:

interface := "eth0"
packetType := "TCP"

// Ağ arabirimini ve paket türünü belirtin
handle, err := pcap.OpenLive(interface, 1600, true, pcap.BlockForever)
if err != nil {
    log.Fatal("Error opening interface:", err)
}
defer handle.Close()

packetSource := gopacket.NewPacketSource(handle, handle.LinkType())

// TCP paketlerini dinleme ve analiz etme
for packet := range packetSource.Packets() {
    tcpLayer := packet.Layer(layers.LayerTypeTCP)
    if tcpLayer != nil {
        tcp, _ := tcpLayer.(*layers.TCP)
        fmt.Printf("Source Port: %d, Destination Port: %d\n", tcp.SrcPort, tcp.DstPort)
    }
}

Interacting with a specific network device and analyzing ICMP packets:

interface := "eth0"
packetType := "ICMP"

// Ağ arabirimini ve paket türünü belirtin
handle, err := pcap.OpenLive(interface, 1600, true, pcap.BlockForever)
if err != nil {
    log.Fatal("Error opening interface:", err)
}
defer handle.Close()

packetSource := gopacket.NewPacketSource(handle, handle.LinkType())

// ICMP paketlerini dinleme ve analiz etme
for packet := range packetSource.Packets() {
    icmpLayer := packet.Layer(layers.LayerTypeICMPv4)
    if icmpLayer != nil {
        icmp, _ := icmpLayer.(*layers.ICMPv4)
        fmt.Printf("Type: %d, Code: %d\n", icmp.TypeCode.Type(), icmp.TypeCode.Code())
    }
}

About

This Go code is used to listen to network traffic, monitor and analyze certain protocols. Users can listen to live traffic from a specific network interface, monitor protocols such as TCP, UDP, ICMP, and record traffic. It can be used in various applications such as network security and performance monitoring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages