Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i assign a number to another using sprintf?

import scapy.all as scapy
pkt = scapy.rdpcap('99.pcap')
test = pkt[0].sprintf("%IP.src%=%127.0.0.1%")
print(test)

result:

scapy.error.Scapy_Exception: Bad format string [%127.0.0.1%]

How can i assign 127.0.0.1 using the sprintf function ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

try this it may work:

import scapy.all as scapy
pkt = #the file
assignment = pkt[0].sprintf('%IP.src%')
assignment = '127.0.0.1'
print(assignment)

Note: sprintf expression cannot have the assignment operator

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading