Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #51052
    encryptedn00b
    Participant

    When I run the network scanner I get this error.
    IP MAC Address
    ———————————————————-
    Traceback (most recent call last):
    File “main.py”, line 15, in <module>
    scan(“10.0.2.15/24”)
    File “main.py”, line 12, in scan
    for element in answered_list():
    TypeError: ‘SndRcvList’ object is not callable

    Here is my code.

    #!/usr/bin/env python

    import scapy.all as scapy

    def scan(ip):
    arp_request = scapy.ARP(pdst=ip)
    broadcast = scapy.Ether(dst=”ff:ff:ff:ff:ff:ff”)
    arp_request_broadcast = broadcast/arp_request
    answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0]

    print(“IP\t\t\tMAC Address\n———————————————————-“)
    for element in answered_list():
    print(element[1].psrc + “\t\t” + element[1].hwsrc)

    scan(“10.0.2.15/24”)

    #51076
    Diego PérezDiego Pérez
    Moderator

    Hi!
    There’s no need to use () in for element in answered_list():, answered_list is a variable not a function. Please watch the lecture again and pay attention to the proper syntax.

    Greetings!
    Diego

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.