Raw
is a file class packet.py
of Scapy. You can see the source code here.
class Raw(Packet):
name = "Raw"
fields_desc = [ StrField("load", "") ]
def answers(self, other):
return 1
#s = str(other)
#t = self.load
#l = min(len(s), len(t))
#return s[:l] == t[:l]
def mysummary(self):
cs = conf.raw_summary
if cs:
if callable(cs):
return "Raw %s" % cs(self.load)
else:
return "Raw %r" % self.load
return Packet.mysummary(self)
The letter b
or B
prior to string in Python 2 is ignored:
A prefix b
or B
is ignored in Python 2; this indicates that
literal should become a byte literal in Python 3. The prefix u
or b
can be followed by a prefix r
.
In Python 3, according to documentation:
(In free translation)
Bytes
literals are always prefixed with b
or B
; they produce an instance of the bytes
instead of the kind str
.
They can only contain ASCII characters; bytes
with a numerical value of
128 or greater must be expressed with escapes.
You must pass the variables ans
and unans
because the function sr
returns a tuple returning unanswered packages and responses and packages.
I am using python3. They said that in python 2 we use: Raw("Olaa") without b in front. They said that b is placed in python3... It’s true?
– Paul Sigonoso
@Paulsigonoso Yes. In Python 2 o
b
is ignored as you can read in documentation.– stderr
What is pkt = ip/tcp/raw ?
– Paul Sigonoso
@Paulsigonoso Place in
pkt
the ip, information from door and the raw. Take a look at this article on..: https://thepacketgeek.com/scapy-p-06-sending-and-receiving-with-scapy/– stderr
thanks for the help!
– Paul Sigonoso