Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
programmation of sr1
#1
hi,

i'm learning Python for a few days and i don't understand this command , specially the usage of "/"

here is my code

p = sr1(IP(dst="www.slashdot.org")/ICMP()/"XXXXXXXXXXX")

i didn't find an explanation in documentation

can you help me please?

Regards
Thierry
Reply
#2
(Aug-14-2020, 10:41 AM)trazom Wrote: i'm learning Python for a few days and i don't understand this command , specially the usage of "/"
With sr1(IP you are using Scapy.
In normal Python usage the operator / is division.
Scapy change the behavior of / to use it a composition operator between two layers.
So they parse/check for / and give it a special task.
Stacking layers
scapy Wrote:The / operator has been used as a composition operator between two layers.
When doing so, the lower layer can have one or more of its defaults fields overloaded according to the upper layer.
(You still can give the value you want).
A string can be used as a raw layer
Reply
#3
thanks a lot
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020