SOLVED: Scapy Error with CIDR Notation

Status
Not open for further replies.

datallboy

datallboy
Server Admin
Fennec
Ruppell
Red
Member
Is scapy currently broken with CIDR notation? Following an online course and using ARP as a network scanner (similar to netdiscover).

Python Code:
Python:
import scapy.all as scapy


def scan(ip):
    arp_request = scapy.ARP()
    arp_request.pdst=ip
    arp_request.show()
    broadcast = scapy.Ether()
    broadcast.dst="ff:ff:ff:ff:ff"
    broadcast.show()
    arp_request_broadcast = broadcast/arp_request
    arp_request_broadcast.show()


scan("10.1.10.1/24")

Code:
Traceback (most recent call last):
  File "network_scanner.py", line 17, in <module>
    scan("10.1.10.1/24")
  File "network_scanner.py", line 9, in scan
    arp_request.show()
  File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1261, in show
    return self._show_or_dump(dump, indent, lvl, label_lvl)
  File "/usr/lib/python3/dist-packages/scapy/packet.py", line 1235, in _show_or_dump
    reprval = f.i2repr(self, fvalue)
  File "/usr/lib/python3/dist-packages/scapy/fields.py", line 376, in i2repr
    return fld.i2repr(pkt, val)
  File "/usr/lib/python3/dist-packages/scapy/fields.py", line 502, in i2repr
    x = self.i2h(pkt, x)
  File "/usr/lib/python3/dist-packages/scapy/layers/l2.py", line 136, in i2h
    iff = self.getif(pkt)
  File "/usr/lib/python3/dist-packages/scapy/layers/l2.py", line 132, in <lambda>
    self.getif = (lambda pkt: pkt.route()[0]) if getif is None else getif
  File "/usr/lib/python3/dist-packages/scapy/layers/l2.py", line 400, in route
    fld, dst = fld._find_fld_pkt_val(self, dst)
  File "/usr/lib/python3/dist-packages/scapy/fields.py", line 313, in _find_fld_pkt_val
    if val == dflts_pkt[self.name] and self.name not in pkt.fields:
  File "/usr/lib/python3/dist-packages/scapy/base_classes.py", line 133, in __eq__
    p2, nm2 = self._parse_net(other)
  File "/usr/lib/python3/dist-packages/scapy/base_classes.py", line 99, in _parse_net
    tmp = net.split('/') + ["32"]
AttributeError: 'NoneType' object has no attribute 'split'
 

datallboy

datallboy
Server Admin
Fennec
Ruppell
Red
Member
Solved.

Video should range as 10.1.10.1/24. Range should be 10.1.10.0/24. .0 works as intended.
 
Status
Not open for further replies.