Got another bug for you. This one is coming from the BGP module. It looks like a function isn't being called properly. Here's the error message:
ERROR (__init__): could not dissect or unpack: TypeError('_unpack() takes 1 positional argument but 2 were given',)
Traceback (most recent call last):
File "/home/user/python3/lib/python3.4/site-packages/pypacker/pypacker.py", line 401, in __init__
header_len = self._dissect(args[0])
File "/home/user/python3/lib/python3.4/site-packages/pypacker/layer567/bgp.py", line 175, in _dissect
pypacker.Packet._unpack(self, buf[:4])
TypeError: _unpack() takes 1 positional argument but 2 were given
I was running the script on the bgp.pcap file available here.
Here is the one-off script I'm working with. Again, it's not very pretty, but I'm not really going anywhere specific with it.
import pcapy
import os
from pypacker.layer12 import ethernet
from pypacker.layer4 import tcp
from pypacker.layer567 import bgp
#https://wiki.wireshark.org/SampleCaptures#Routing_Protocols
PCAPFILE = os.path.join(os.environ['HOME'], "pcap", "bgp.pcap")
BPF = "tcp and port 179"
capture = pcapy.open_offline(PCAPFILE)
capture.setfilter(BPF)
while True:
try:
header, packet = capture.next()
except pcapy.PcapError:
break
pkt = ethernet.Ethernet(packet)
bgp_pkt = pkt.highest_layer
if isinstance(bgp_pkt, tcp.TCP):
continue
if isinstance(bgp_pkt, bgp.BGP):
print("BGP")
elif isinstance(bgp_pkt, bgp.BGP.Open):
print("OPEN")
elif isinstance(bgp_pkt, bgp.BGP.Update):
print("UPDATE")
else:
print("OTHER", type(bgp_pkt))
And here is the full output:
> python3 bgp_error_test.py
OPEN
OPEN
BGP
BGP
OTHER <class 'pypacker.layer567.bgp.BGP.Keepalive'>
ERROR (__init__): could not dissect or unpack: TypeError('_unpack() takes 1 positional argument but 2 were given',)
Traceback (most recent call last):
File "/home/joshuae/python3/lib/python3.4/site-packages/pypacker/pypacker.py", line 401, in __init__
header_len = self._dissect(args[0])
File "/home/joshuae/python3/lib/python3.4/site-packages/pypacker/layer567/bgp.py", line 175, in _dissect
pypacker.Packet._unpack(self, buf[:4])
TypeError: _unpack() takes 1 positional argument but 2 were given
UPDATE
BGP
Got another bug for you. This one is coming from the BGP module. It looks like a function isn't being called properly. Here's the error message:
I was running the script on the bgp.pcap file available here.
Here is the one-off script I'm working with. Again, it's not very pretty, but I'm not really going anywhere specific with it.
And here is the full output: