Questions tagged [packets]

Packets refer to network packets. A network packet is a formatted unit of data carried by a packet-switched network.

A network packet is a formatted unit of data carried by a packet-switched network.

A packet consists of control information and user data, which is also known as the payload. Control information provides data for delivering the payload, for example: source and destination network addresses, error detection codes, and sequencing information. Typically, control information is found in packet headers and trailers.

Use this tag for programming questions related to packet creation, packets contents analysis, packet sending and receiving, or other tasks that can be done with network packets.

Source: Wikipedia

374 questions
6
votes
1 answer

How to log all incoming packets

I tried a prerouting rule to redirect incoming packets to a internal virtual IP address. How can I log an incoming packet before it gets redirected? iptables -t nat -A PREROUTING -d 46.X.XX.XX -s 78.XX.XX.XX -p tcp --dport 80 --sport 1024: -j DNAT…
Julio Fong
  • 477
  • 2
  • 5
  • 14
5
votes
0 answers

Capturing packets from Android VPNService and transfer them over sockets to proxy server

Intention is to intercept all the traffic from the android device. I did this previously by creating a local proxy server and manually adding it in the wifi settings of the device. But now to avoid that we need that settings need not be changed and…
infinite93
  • 63
  • 3
5
votes
1 answer

Java sending handshake packets to minecraft server

I have been working on a java program that basically acts like Minechat(text-based app to just view chat.) I have never really worked with networking too much, so the issue is figuring out how to send packets correctly. I am currently at the…
cameronlund4
  • 457
  • 4
  • 24
5
votes
1 answer

Reassembling fragmented UDP packet

I have a pcap of various types of traffic over 802.11 (wifi) over udf. The udp (or more precisely IP) fragments the wifi packets due to the MTU. I am currently using SharpPcap to read in and try and access the wifi traffic and am running into the…
user2731104
  • 51
  • 1
  • 3
4
votes
1 answer

Packet modification with netfilter queue?

I'm currently trying to use codes with libnetfilter_queue in userspace to modify packets that were queued in the NFQUEUE target in iptables. However I have little idea as to how to go about doing it. I have set it to copy the packet with…
4
votes
2 answers

How far out of order should I expect UDP packets to be?

Under normal circumstances, what should I expect the worse case scenario to be for out of order UDP packets? I'm currently tagging each packet with two bytes (a 0 to 65535 number) to keep track of the order. Is this enough or too much?
jnm2
  • 7,157
  • 5
  • 57
  • 92
4
votes
1 answer

RAW Sockets in C++ Windows

I want to use a RAW Socket in Visual C++. I saw a function on Linux which is int out = socket(AF_INET, SOCK_RAW, htons(ETH_P_ALL)); Using this code in linux we can do that, but how to use RAW SOCKET on Windows Platform because when I use this in…
4
votes
2 answers

Using scapy with wifi

i've tried to send packet using scapy while connected to wifi, and i got an error about "dnet.pyx". But when i connect to wired connection, it worked. I've searched a lot on the internet about this problem, but there wasn't any answer for this. Is…
tamird14
  • 451
  • 1
  • 5
  • 19
4
votes
1 answer

How to do Wake On LAN by Qt 5?

I found this tutorial for wake on LAN,but I can not understand it completely. It is implemented in Qt3. I want the wake on LAN functionality which could be compiled with Qt5. How can I use the mentioned code to wake a computer through LAN using Qt5?
flybird
  • 53
  • 6
4
votes
2 answers

how to calculate the received packets rate on a linux based pc?like pps or fps

I am writing a network program which can calculate accurate data packet rate (packet per second, frame per second, bps). Now i have a device called testcenter which can send accurate flow to a specific pc (protocol is UDP/IP) on Linux, i like to …
xiaozhu
  • 255
  • 1
  • 2
  • 8
4
votes
1 answer

C++ Strange hex dump of WSAsend Packets

http://prntscr.com/2ctnoz I'm hooking a WSAsend function and dumping the packets. ASCII dump works but HEX dump sometimes shows things like you can see on the screen (the FFFFFFDD), any idea why? code: int WINAPI myWSASend(SOCKET s, LPWSABUF…
LemoniscooL
  • 75
  • 1
  • 5
4
votes
3 answers

C# Getting packet data

I've been trying to write a script that will sniff HTTP headers. So far I've got the socket bound to port 80 and packets seem to be received, but I can't get them into string form. All that outputs is "E" continuously. I changed the bytes into hex…
James
  • 479
  • 1
  • 5
  • 15
4
votes
1 answer

How to inject a raw L2 packet as an incoming packet to an interface on Linux?

I need to inject some L2 packets(customized) to an specific interface as incoming packets in Linux to test some applications running on it. Is there any libraries(python preferred)/examples that can help? I was skimming through the Scrapy library,…
wei
  • 6,081
  • 6
  • 36
  • 46
4
votes
0 answers

Error calculating TCP Header Checksum

I am writing code to calculate the checksum of IP and TCP Headers to see if the packet is malformed. I have coded the IP checksum successfully but when I used the code for the TCP checksum it doesn't give the correct checksums. Where is my…
Anwar Mohamed
  • 597
  • 10
  • 26
4
votes
1 answer

I'd like to use union as C# with byte array

I had idea about message parsing in serial communication, there are many kind of packets which have different form. but they're all sent by byte array. so I thought using union to parse each message. but it's not working well. following code is the…
JaeSang Yoo
  • 45
  • 1
  • 3
1
2
3
24 25