Emanuel
Emanuel

Reputation: 67

Scapy: How to check if ping using srp1 (using Layer 2) was successful

I use the scapy module to create packages and want to send them over layer 2 since this is much more performant as L3. My packages look like this:

resp = srp1(Ether()/IP(dst="192.168.0.11")/ICMP(), verbose=True)

'resp' is a list of the result/answer. resp[0] shows the entire content. But since i send ethers the result is in hex.

How can i check if the ping was successfull. Simply convert/decode it doesn't work because the type is:

<class 'scapy.layers.l2.Ether'>

Is there a function provided by scapy which does the job or at least shows the result human readable in order to validate it manually?

Upvotes: 0

Views: 819

Answers (1)

Cukic0d
Cukic0d

Reputation: 5411

resp.summary()

Or

repr(resp)

Or

resp.show()

They are ordered by verbosity. Their output are all different

You should read scapy's doc over https://scapy.readthedocs.io/en/latest/

Upvotes: 1

Related Questions