filter the packets Wireshark with size - wireshark

I am trying to solve the below question:
filter the UDP packets having a size equal to 242 bytes.
I looked to this answer udp.length==209 set a filter of packet length in wireshark, but instead of getting packets with length 209 bytes I get packets with length 243 bytes.
screenshot. can anyone explain?

Your image shows a packet like
Frame 243 bytes
'-> Ethernet
'-> IPv4
'-> UDP
'-> Dropbox LAN Sync
Ethernet will be 14 bytes with 6 per src/dst MAC address and 2 bytes for Ethertype.
The IPv4 header will be a minimum of 20 bytes, but could be more with options. It just so happens to be 20 here.
Eth 14 bytes + IP 20 bytes = 34 bytes
243 bytes - 34 bytes of Eth/IP = 209 bytes of UDP data

Related

Lua - Using string.find to find a sentence?

Following a previous Stack Overflow response, (here) I am trying to check if a particular sentence/string is returned in the response of a io.popen command I’m running..
local function DevicePing(ip)
local handler = io.popen("ping -c 3 " ..ip.. " 2>&1")
local response = handler:read("*a")
print(response)
if string.find(response, "0% packet loss") then
print ("Pings were all successfull.")
else
print ("Pings were all unsuccessfull.")
end
end
DevicePing("192.168.1.180")
But every time I run it, it doesn’t find the requested string/sentence; see the print output below..
PING 192.168.1.180 (192.168.1.180): 56 data bytes
64 bytes from 192.168.1.180: seq=0 ttl=64 time=2.983 ms
64 bytes from 192.168.1.180: seq=1 ttl=64 time=1.620 ms
64 bytes from 192.168.1.180: seq=2 ttl=64 time=2.465 ms
--- 192.168.1.180 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.620/2.356/2.983 ms
Pings were all unsuccessfull.
What am I doing wrong for it not to see ‘0% packet loss‘ is present and say it was successfull?
% is the escape character in Lua patterns.
Use "0%% packet loss" to mean a literal %.
However, this pattern will also matches 100% packet loss. I suggest ", 0%% packet loss".
Also, it won't work in macOS which shows decimals in the report: 0.0% packet loss.

Why is there something written in the data section of an ICMPv4 echo ping request?

(My question differs from this one.)I am connected to a AP in a wireless network and I've send a simple ping request to www.google.com. When I analyze the packet in wireshark, I can see, that there are 48 bytes written in the data section of ICMP. After 8 bytes of trash values, the values are sequentially increasing from 0x10 to 0x37.Is there any particular reason, why ICMPv4 fits values instead of just using a bunch of zeroes?
The hexdump of the ICMPv4 data section:
0030 09 d9 0d 00 00 00 00 00 10 11 12 13 14 15 .Ù............
0040 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 .......... !"#$%
0050 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 &'()*+,-./012345
0060 36 37 67
After 8 bytes of trash values
First of all, these are not trash values. In some implementations of ping, the 1st 8 bytes may represent a timestamp.
As #ross-jacobs mentioned, RFC 792 describes the ICMP Echo Request/Reply Packets. For clarity, these two packets are described, in relevant part, as follows:
Echo or Echo Reply Message
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier | Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data ...
+-+-+-+-+-
...
Description
The data received in the echo message must be returned in the echo
reply message.
Here you can see that the contents of the Data is not described at all; therefore an implementation is free to use whatever data it wishes, including none at all.
Now, since ping is a network test tool, one of the things it can help test is fragmentation/reassembly. Every ping implementation I'm aware of allows the user to specify the size of the payload, and if you exceed the MTU, you should see the ICMP packet fragmented/reassembled. If you examine the payload of the first fragment, you can tell where the second fragment should start just by looking at the sequence of bytes in the payload of the first fragment. If the data was all 0's, it wouldn't be possible to do this. Similarly, if an ICMP packet wasn't reassembled properly, not only would the checksum likely be wrong, but you would most likely be able to tell exactly where the reassembly failed due to a gap or other inconsistency in the payload. This is just one example of why a payload with a sequence of bytes instead of all 0's is more useful to the user.

IPv4 total length exceeds packet length - always 8.0.69.0

I have a problem... we are capturing packets off the wire in our network but are getting a lot of "IPv4 total length exceeds packet length" errors and always from, 8.0.69.0.
This IP is spurious and the destination seems to be 0.x, 5.x or 1.x, i.e. not valid either.
Some Googling seems to suggest that others have also seen 8.0.69.0 when working with GRE/NAT scenarios. Does anyone have any idea at all what this might be please?
PCAP uploaded here.
Error is Accurate
The error "IPv4 total length exceeds packet length" means exactly what it says: The number of bytes in the IPv4 packet exceeds the number of bytes recorded for the entire frame.
Looking at Fields
We can specify both fields of frame length (frame.len, frame.cap_len) and IP length (ip.len) to see this in more depth:
$ tshark -r exceed-length.pcap -T fields -e frame.len -e frame.cap_len -e ip.len
1478 1478 3114
1536 1536 3114
1476 1476 13615
1399 1399 13781
1478 1478 3114
228 228 13615
195 195 13615
1478 1478 3114
1476 1476 13615
1478 1478 3114
265 265 3114
505 505 3114
1478 1478 3114
88 88 33514
1478 1478 3114
1478 1478 3114
1478 1478 3114
As we can see, each and every frame has a frame length exceeded by packet length, sometimes by an order of magnitude.
What Causes This?
When a capturing program saves a packet in the pcap format (as this file is), it prepends each packet with the length the frame that it captured (frame.cap_len), the actual frame length (frame.len) and capture), and the timestamp. In most cases frame.cap_len and frame.len, won't differ at all, and they don't here either.
How to Fix?
If you want to manually edit the hex of the packet length, it's possible to make this error go away.
Next Steps
More likely than not, "IPv4 total length exceeds packet length" is incidental to your actual problem. Just because you see an Expert Infos in Wireshark, that does not necessarily mean that it's relevant. You should continue troubleshooting.
THere's an extra weird header in the packet, as per the answers when you asked this on the Wireshark Q&A site.
This turned out to be extra layers of encapsulation.
Removing the leading 22 bytes was the answer and revealed the correctly formed packets inside. Many thanks

Best option for DNS management

From last few days traffic on website(https://www.fanspole.com/) is too high, so we are trying to optimise website. One thing I notice was DNS resolve time is too high..
#MacBook-Air ~ $ ping fanspole.com
PING fanspole.com (139.162.35.126): 56 data bytes
64 bytes from 139.162.35.126: icmp_seq=0 ttl=56 time=717.688 ms
64 bytes from 139.162.35.126: icmp_seq=1 ttl=56 time=606.560 ms
64 bytes from 139.162.35.126: icmp_seq=2 ttl=56 time=654.942 ms
64 bytes from 139.162.35.126: icmp_seq=3 ttl=56 time=677.301 ms
64 bytes from 139.162.35.126: icmp_seq=4 ttl=56 time=699.991 ms
Request timeout for icmp_seq 5
64 bytes from 139.162.35.126: icmp_seq=6 ttl=56 time=601.355 ms
64 bytes from 139.162.35.126: icmp_seq=7 ttl=56 time=660.974 ms
64 bytes from 139.162.35.126: icmp_seq=8 ttl=56 time=605.084 ms
--- fanspole.com ping statistics ---
10 packets transmitted, 8 packets received, 20.0% packet loss
round-trip min/avg/max/stddev = 601.355/652.987/717.688/42.087 ms
we are using Linode DNS Manager as of now..
Can someone suggest better alternatives.
This is not a DNS resolution issue, its a network congestion issue.
traceroute to 139.162.35.126 (139.162.35.126), 30 hops max, 60 byte packets
<internal hops removed>
4 10gigabitethernet5-1.core1.lon1.he.net (5.57.80.128) 22.367 ms 22.618 ms 22.841 ms
5 10ge2-9.core1.lon2.he.net (72.52.92.222) 24.056 ms 24.277 ms 24.500 ms
6 100ge1-1.core1.nyc4.he.net (72.52.92.166) 94.769 ms 93.549 ms 93.694 ms
7 100ge14-2.core1.sjc2.he.net (184.105.81.213) 156.692 ms 147.815 ms 147.974 ms
8 * * *
9 * * *
10 xe0-2-0.gw1.sin2.pacnet.net (202.147.52.66) 320.731 ms 321.978 ms 321.950 ms
11 * * *
12 139.162.0.10 (139.162.0.10) 252.825 ms 251.826 ms 251.285 ms
13 li1448-126.members.linode.com (139.162.35.126) 251.746 ms 252.270 ms 251.406 ms
That is a traceroute from London UK - you can see on line 7 when it hits the he.net it starts to pick up latency. By the time it gets to line 10 in pacnet.net its 300+ms
The only option here is to move to a different Linode region or different hosting provider with better/less congested network links.

Security mp_init and init memory leaks

I build an iPad application and profile it with XCode, I got memory leaks in Security framework, following is some of them from Instruments:
Leaked Object # Address Size Responsible Library Responsible Frame
Malloc 128 Bytes,4 < multiple > 512 Bytes Security mp_init
Malloc 128 Bytes, 0x824aa70 128 Bytes Security mp_init
Malloc 128 Bytes, 0x824a9f0 128 Bytes Security mp_init
Malloc 128 Bytes, 0x824a970 128 Bytes Security mp_init
Malloc 128 Bytes, 0x824a8f0 128 Bytes Security mp_init
Leaked Object # Address Size Responsible Library Responsible Frame
Malloc 16 Bytes,4 < multiple > 64 Bytes Security init
Malloc 16 Bytes, 0x824a550 16 Bytes Security init
Malloc 16 Bytes, 0x824a540 16 Bytes Security init
Malloc 16 Bytes, 0x82493d0 16 Bytes Security init
Malloc 16 Bytes, 0x8237ca0 16 Bytes Security init
and some of the details:
# Category Event Type Timestamp RefCt Address Size Responsible Library Responsible Caller
0 Malloc 128 Bytes Malloc 00:02.240.888 1 0x824aa70 128 Security mp_init
# Category Event Type Timestamp RefCt Address Size Responsible Library Responsible Caller
0 Malloc 16 Bytes Malloc 00:02.240.886 1 0x824a550 16 Security init
I use ASIHTTP, FMDatabase and some other frameworks(I do not think they will cause the problem) in my application, and no Security framework in "Link Binary With Libraries", so I have no idea what's going wrong.
Can anyone figure out what may cause the leaks?

Resources