0

This is my line of code:

ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.5.0/24"),timeout=2)
ans.summary(lambda (s,r): r.sprintf("IP: %ARP.psrc%   MAC: %Ether.src%")

using python 2.7, it scans and print the hosts using arp ping scan Using python3, it doesn't work and bring up this error:

  File "arp1.py", line 9
    ans.summary(lambda (s,r): r.sprintf("IP: %ARP.psrc%   MAC: %Ether.src%")
                       ^
SyntaxError: invalid syntax
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Bob Ebert
  • 1,342
  • 4
  • 22
  • 41

1 Answers1

0

Alright, figured out this can replace the second line:

for snd,rcv in ans:
        print (rcv.sprintf(r"%ARP.psrc% & %Ether.src%"))

Since, python3 did "Removal of Tuple Parameter Unpacking"

Bob Ebert
  • 1,342
  • 4
  • 22
  • 41