Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

ValueError: chr() arg not in range(256) #2

@TusharKashyap

Description

@TusharKashyap

I have written a small script that reads a cap/pcap file, chnages its source mac and destination mac and send it over the wireless network. The error is seen in "Python27\lib\site-packages\scapy\utils.py" file.

error logs:
<Sniffed: TCP:0 UDP:1 ICMP:0 Other:0>
Traceback (most recent call last):
File "C:\scapy_try_1.py", line 57, in
send(inPcapFile)
File "C:\Python27\lib\site-packages\scapy\sendrecv.py", line 270, in send
realtime=realtime, return_packets=return_packets)
File "C:\Python27\lib\site-packages\scapy\sendrecv.py", line 248, in __gen_send
s.send(p)
File "C:\Python27\lib\site-packages\scapy\arch\pcapdnet.py", line 313, in send
sx = str(cls()/x)
File "C:\Python27\lib\site-packages\scapy\packet.py", line 277, in str
return self.build()
File "C:\Python27\lib\site-packages\scapy\packet.py", line 354, in build
p = self.do_build()
File "C:\Python27\lib\site-packages\scapy\packet.py", line 344, in do_build
pay = self.do_build_payload()
File "C:\Python27\lib\site-packages\scapy\packet.py", line 336, in do_build_payload
return self.payload.do_build()
File "C:\Python27\lib\site-packages\scapy\packet.py", line 341, in do_build
pkt = self.self_build()
File "C:\Python27\lib\site-packages\scapy\packet.py", line 332, in self_build
p = f.addfield(self, p, val)
File "C:\Python27\lib\site-packages\scapy\fields.py", line 72, in addfield
return s+struct.pack(self.fmt, self.i2m(pkt,val))
File "C:\Python27\lib\site-packages\scapy\layers\l2.py", line 105, in i2m
return MACField.i2m(self, pkt, self.i2h(pkt, x))
File "C:\Python27\lib\site-packages\scapy\fields.py", line 205, in i2m
return mac2str(x)
File "C:\Python27\lib\site-packages\scapy\utils.py", line 295, in mac2str
return "".join(map(lambda x: chr(int(x,16)), mac.split(":")))
File "C:\Python27\lib\site-packages\scapy\utils.py", line 295, in
return "".join(map(lambda x: chr(int(x,16)), mac.split(":")))
ValueError: chr() arg not in range(256)

Any help is highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions