Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #61467
    Jamal Releford
    Participant

    When running the packet sniffer, I continue to getting multiple errors stating the following:

    Traceback (most recent call last):
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 372, in __getattr__
    fld, v = self.getfield_and_val(attr)
    TypeError: cannot unpack non-iterable NoneType object

    The other error said the following:
    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 28, in <module>
    sniff(“eth0”)
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 6, in sniff
    scapy.sniff(iface = interface, store = False, prn = process_sniffed_packet)
    File “/usr/lib/python3/dist-packages/scapy/sendrecv.py”, line 1036, in sniff
    sniffer._run(*args, **kwargs)
    File “/usr/lib/python3/dist-packages/scapy/sendrecv.py”, line 989, in _run
    session.on_packet_received(p)
    File “/usr/lib/python3/dist-packages/scapy/sessions.py”, line 82, in on_packet_received
    result = self.prn(pkt)
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 20, in process_sniffed_packet
    if packet.hasLayer(http.HTTPRequest):
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 374, in __getattr__
    return self.payload.__getattr__(attr)
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 374, in __getattr__
    return self.payload.__getattr__(attr)
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 374, in __getattr__
    return self.payload.__getattr__(attr)
    [Previous line repeated 1 more time]
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 372, in __getattr__
    fld, v = self.getfield_and_val(attr)
    File “/usr/lib/python3/dist-packages/scapy/packet.py”, line 1600, in getfield_and_val
    raise AttributeError(attr)
    AttributeError: hasLayer

    Any help you can provide would be appreciated. I’ve attached my code as well.

    Attachments:
    You must be logged in to view attached files.
    #61494
    Diego PérezDiego Pérez
    Moderator

    Hi!

    You have used a capital L in haslayer and that’s a wrong syntax, check Zaid’s code and make sure yours is exactly the same, especially pay attention to the syntax.

    Greetings!
    Diego

    #61495
    Jamal Releford
    Participant

    Thanks for your continued help, Diego. It seems now I’m getting the following error around the Raw field (see message below). I’ve also attached my code as it’s been written exactly as Zaid or so I thought when I checked it again.

    [+] HTTP Request >> http://www.bing.com/fd/ls/l?IG=0F644CBDB97F475084D8232545A7016D&Type=Event.ClientInst&DATA=%5B{%22T%22:%22CI.ReturnTop%22,%22FID%22:%22CI%22,%22Name%22:%22ReturnTop60%22,%22Text%22:%22Triggered%22}]
    Traceback (most recent call last):
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 28, in <module>
    sniff(“eth0”)
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 6, in sniff
    scapy.sniff(iface = interface, store = False, prn = process_sniffed_packet)
    File “/usr/lib/python3/dist-packages/scapy/sendrecv.py”, line 1036, in sniff
    sniffer._run(*args, **kwargs)
    File “/usr/lib/python3/dist-packages/scapy/sendrecv.py”, line 989, in _run
    session.on_packet_received(p)
    File “/usr/lib/python3/dist-packages/scapy/sessions.py”, line 82, in on_packet_received
    result = self.prn(pkt)
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 24, in process_sniffed_packet
    login_info = get_login_info(packet)
    File “/root/PycharmProjects/packet_sniffer/packet_sniffer.py”, line 12, in get_login_info
    if packet.haslayer(scapy, Raw):
    NameError: name ‘Raw’ is not defined

    After which I thought it might be because I needed to import scapy so I attempted to install the module and got the following:

    root@kali:~/PycharmProjects/packet_sniffer# python
    Python 2.7.18 (default, Apr 20 2020, 20:30:41)
    [GCC 9.3.0] on linux2
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> pip install scapy_http
    File “<stdin>”, line 1
    pip install scapy_http
    ^
    SyntaxError: invalid syntax
    >>> apt-get install scapy
    File “<stdin>”, line 1
    apt-get install scapy
    ^
    SyntaxError: invalid syntax
    >>> apt-get update
    File “<stdin>”, line 1
    apt-get update
    ^
    SyntaxError: invalid syntax
    >>> pip install scapy.all as scapy
    File “<stdin>”, line 1
    pip install scapy.all as scapy

    Attachments:
    You must be logged in to view attached files.
    #61511
    Diego PérezDiego Pérez
    Moderator

    Hi!
    Again there’s a syntax error, you are using a comma and add a blank space. Where are you watching the lectures? I mean which device are you using.

    Don’t use Bing as it uses hsts protection now a days, use a simple http sites like vulnweb.com or speedbit.com.

    Greetings!
    Diego

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