YueZeJun / SOMEIP

汽车 SOMEIP
23 stars 6 forks source link

import error #2

Open pureGavin opened 6 months ago

pureGavin commented 6 months ago

just install and import SOMEIP, and here is error

Traceback (most recent call last):
  File "/home/gavin/SOMEIP/demo/./snifferDemo.py", line 1, in <module>
    import SOMEIP
  File "/usr/local/lib/python3.10/dist-packages/SOMEIP/__init__.py", line 1, in <module>
    from .bin.protocol.SOMEIP_SD import *
  File "/usr/local/lib/python3.10/dist-packages/SOMEIP/bin/protocol/SOMEIP_SD.py", line 270, in <module>
    class SD(_SDPacketBase):
  File "/usr/local/lib/python3.10/dist-packages/SOMEIP/bin/protocol/SOMEIP_SD.py", line 299, in SD
    PacketListField("entry_array", None, cls=_SDEntry, length_from=lambda pkt:pkt.len_entry_array),     # Entries Array[variable size]
TypeError: PacketListField.__init__() got an unexpected keyword argument 'cls'

what should i do?

pureGavin commented 6 months ago

i use python 3.10 ubuntu22 by the way

YueZeJun commented 6 months ago

hi pureGavin I'm so glad that you can use this project, but I haven't maintained it since the scapy upgrade because SOMEIP is already supported in the lastest scapy. If you still want to use the library for learning, you can downgrade scapy's version to 2.4.4.

In addition, this is the way someip is used in scapy:https://scapy.readthedocs.io/en/latest/layers/automotive.html#creating-a-some-ip-message

Please do not hesitate to contact me if you have any further questions

YueZeJun commented 6 months ago

hi pureGavin I'm so glad that you can use this project, but I haven't maintained it since the scapy upgrade because SOMEIP is already supported in the lastest scapy. If you still want to use the library for learning, you can downgrade scapy's version to 2.4.4.

In addition, this is the way someip is used in scapy:https://scapy.readthedocs.io/en/latest/layers/automotive.html#creating-a-some-ip-message

Please do not hesitate to contact me if you have any further questions

pureGavin commented 6 months ago

hi pureGavin I'm so glad that you can use this project, but I haven't maintained it since the scapy upgrade because SOMEIP is already supported in the lastest scapy. If you still want to use the library for learning, you can downgrade scapy's version to 2.4.4.

In addition, this is the way someip is used in scapy:https://scapy.readthedocs.io/en/latest/layers/automotive.html#creating-a-some-ip-message

Please do not hesitate to contact me if you have any further questions

thanks for your reply i think i solve the problem, i rewrite the source code from "cls" to "pkt_cls" but there is a new problem

  File "/usr/local/lib/python3.10/dist-packages/scapy/sendrecv.py", line 478, in sendp
    return _send(
  File "/usr/local/lib/python3.10/dist-packages/scapy/sendrecv.py", line 414, in _send
    socket = socket or _func(iface)(iface=iface, **kargs)
  File "/usr/local/lib/python3.10/dist-packages/scapy/arch/linux.py", line 499, in __init__
    set_promisc(self.ins, self.iface)
  File "/usr/local/lib/python3.10/dist-packages/scapy/arch/linux.py", line 179, in set_promisc
    mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
  File "/usr/local/lib/python3.10/dist-packages/scapy/arch/linux.py", line 399, in get_if_index
    return int(struct.unpack("I", get_if(iff, SIOCGIFINDEX)[16:20])[0])
  File "/usr/local/lib/python3.10/dist-packages/scapy/arch/unix.py", line 42, in get_if
    return ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
OSError: [Errno 19] No such device

my question is, does vlan necessary? it may a stupid cause i am start to learn some ip :p

YueZeJun commented 6 months ago

For SOMEIP protocol, vlan is not must. However, most of the actual projects will use vlan to increase speed and security.

And I think you should use the "ipconfig" command to check if you have a net interface which named "vEthernet" like me.If not you should change the "ip" "port"and the "iface" to fit your computer.