Python variables in scapy (sendp) -


i'm trying generate arbitrary wireless beacon frames. i'm taking string based ssid values file place scapy sendp statement. can put ssid strings sendp need dynamically strings length (len=) can place packet details. packets malformed without length.

this error "struct.error: cannot convert argument integer"

code looks this:

with open ('ssid.txt') f: line in f:     sendp(radiotap()/dot11(addr1="ff:ff:ff:ff:ff:ff",addr2=randmac(),addr3=randmac())/dot11beacon(cap="ess")/dot11elt(id="ssid", len='%d' % len(line.strip()),info='%d' % (line))/dot11elt(id="rates",info='\x82\x84\x0b\x16')/dot11elt(id="dsset",info="\x03")/dot11elt(id="tim",info="\x00\x01\x00\x00"),iface="mon0") 

my guess problem part:

dot11elt(id="ssid", len='%d' % len(line.strip()),info='%d' % (line)) 

if len parameter supposed integer, cause error seeing, since passing string. try removing first '%d' %, i.e. replace above with:

dot11elt(id="ssid", len=len(line.strip()), info='%d' % line) 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -