Jebathon
Jebathon

Reputation: 4561

Scapy: Attribute Error: 'Tuple' Object has no attribute 'x'

pkt = srp(Dot11(type=0,subtype=4,addr1 = 'xx:xx:xx:xx:xx:xx', addr2 = 'xx:xx:xx:xx:xx:xx'), iface = 'wlan0')

If I type:

pkt.summary()
pkt.show()
pkt.sprintf()
pkt.decode_payload_as() pkt.pdfdump()
pkt.command()

I get the Attribute error: 'tuple' object has no attribute 'e.g. summary'

This works if it's an IP or eth0 packet but not if its a WLAN

Upvotes: 2

Views: 1522

Answers (1)

Pierre
Pierre

Reputation: 6237

You have a mistake in your code. Unlike sniff(), srp() (like sr()) returns a Tuple of two elements:

  • a SndRcvList instance, for packets for which Scapy has received an asnwer.
  • a PacketList instance, for sent packets for which Scapy has not received an answer.

You could write:

>>> ans, unans = srp([your packet here], iface='wlan0')
>>> ans.summary()
[...]
>>> unans.summary()
[...]

Upvotes: 2

Related Questions