-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp.go
More file actions
31 lines (28 loc) · 755 Bytes
/
tmp.go
File metadata and controls
31 lines (28 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
// type Flow struct {
// DstAddress IP
// SrcAddress IP
// }
// func main() {
// packetSource := ReadPcapData("2022-08-02-11-04-45-11.122.30.101.pcap")
// list := make(map[IP]int)
// i := 0
// for packet, err := packetSource.NextPacket(); err == nil; packet, err = packetSource.NextPacket() {
// ethernet := NewEthernet(packet)
// ipv4 := NewIPv4(ethernet)
// if ipv4.NextLayerType().layerNumber != 2 {
// continue
// }
// ip := IP([4]byte{11, 122, 40, 57})
// if ipv4.DstAddress != ip && ipv4.SrcAddress != ip {
// fmt.Println(i, ":")
// PacketDump(packet)
// fmt.Println()
// i++
// }
// }
// fmt.Println(len(list))
// for k, v := range list {
// fmt.Printf("times: %v IP: %v\n", v, k)
// }
// }