Questions tagged [gopacket]

46 questions
1
vote
1 answer

Learning Golang using gopacket as a starter

I have started to learn golang recently (January). I am trying to reproduce a tool we have internally that is written in Python in Go. So I have the tool working completely for UDP decoding of DNS, however I have been struggling for a week trying…
user4216666
0
votes
1 answer

Error 802.11 packet sniffing on Windows - gopacket

This is the code: package main import ( "fmt" "github.com/google/gopacket" "github.com/google/gopacket/pcap" ) func main() { handle, err := pcap.OpenLive("\\Device\\NPF_{d6194530-0e27-4c84-b489-2cfe18d4af24}", 65536, true,…
ANDRVV
  • 7
  • 5
0
votes
1 answer

create packetSource of gopacket with s3 file

when I get a pcap file from s3 client, I need to generate a packetSource of gopacket to read packets in it. But I only found OpenOfflineFile function in gopacket document, how could I do to generate packetSource with []byte(which is read from s3…
0
votes
2 answers

With gopacket inactive handle, SetPromisc is not setting the interfaces in PROMISC mode

With gopacket inactive handle, SetPromisc is not setting the interfaces in PROMISC mode if /sys/devices/virtual/net/bond1/flags has value 0x1403. It only works if this value is set to 0x1503. Is there a way I could set interfaces to PROMISC mode…
HSAR
  • 139
  • 1
  • 2
  • 12
0
votes
1 answer

Unable to use gopacket to snoop on connected socket

I'm trying to use gopacket to snoop on a socket and print tcp packet payloads. If I start the snooper app first and then connect a tcp socket, things work correctly. If the socket is already connected when the snooper app starts, nothing is…
sv650
  • 1
  • 2
0
votes
0 answers

gopacket fast layers parsing

Im trying to fast parse packet layers using the following offical example https://youtu.be/APDnbmTKjgM?t=1135 var ip4 layers.IPv4 var tcp layers.TCP var udp layers.UDP var sip layers.SIP parser :=…
kostya
  • 27
  • 7
0
votes
0 answers

Create a packet from raw bytes and write to pcap using gopacket

I created a packet from raw bytes using gopacket and write these packets to a pcap file. I created a UDP packet from raw bytes as below. package main import ( "fmt" "net" "log" "os" "time" …
mmeda
  • 11
  • 4
0
votes
1 answer

Create a packet from raw bytes and write to pcap file using gopacket

I want to create a packet from raw bytes using gopacket and write the packets to a pcap file. I created a UDP packet from raw bytes as below. package main import ( "fmt" "net" "log" "os" "time" …
mmeda
  • 11
  • 4
0
votes
0 answers

Sending Spoofed UDP Packets over VPN

I have a machine (server) on which I am running IP spoofing tests. All the ports are open on the server and it is on a VPN Network to which I am connected. The problem is, when I try to send data to the machine on UDP simply using netcat, it…
0
votes
2 answers

How to correctly handcraft DNS packets with gopacket?

I'm trying to send hand-crafted DNS packets with gopacket. Here is my code: package main import ( "net" "github.com/google/gopacket" "github.com/google/gopacket/layers" "github.com/google/gopacket/pcap" ) func main() { handle,…
hacb
  • 175
  • 2
  • 10
0
votes
1 answer

How to pick up IP packets and inject on different VM and interface

I have been trying to solve these 2 problems, but without success. I wonder if it's possible to remove specific packets from an interface with Gopacket or is it just for listening on the wire? For example when I send a UDP packet to a wrong port…
0
votes
1 answer

Golang Converting gopacket udpLayer to bytes and sending

I am using the gopacket/layers api to extract upd data out of a packet then sending it again via another udp stream, I am not sure if am doing this correct or not, also have been getting some errors, if anyone can point me in the correct direction…
octain
  • 964
  • 3
  • 10
  • 24
0
votes
1 answer

NTP detection using golang, payload coming up empty

I'm working on detecting NTP using golang and the gopacket package. I'm using a pcap I downloaded from wireshark. I've got the following code for opening PCAPs and handling them : func (d *DPI) readPCAP(pcapFile string) (*pcap.Handle, error) { …
0
votes
2 answers

Sending UDP packets with gopacket

I am trying to send UDP packets to a remote host like this conn, err := net.ListenPacket("ip4:udp", "0.0.0.0") if err != nil { panic(err) } ip := &layers.IPv4{ SrcIP: saddr, DstIP: dip, Protocol: layers.IPProtocolUDP, } udp :=…
ACC
  • 2,488
  • 6
  • 35
  • 61
0
votes
0 answers

Changing the IP address of a Gopacket and re-transmitting using raw sockets

I'm writing a program that reads all packets passing through the computer running it. I wish to grab a packet (either by dst ip or src ip), then change the dstIP and TCP dstPort and put it back on the wire. I have no problems with changing the…
Jonathan Eustace
  • 2,469
  • 12
  • 31
  • 54