her3ticAVI / conpot

ICS/SCADA honeypot
GNU General Public License v2.0
2 stars 1 forks source link

Packages/Dependencies not found #2

Closed KorpoleRithika0x1 closed 1 year ago

KorpoleRithika0x1 commented 1 year ago
adhd@DESKTOP-I1T2G01:/mnt/c/Users/adhd/conpot$ python3.11 setup.py
Traceback (most recent call last):
  File "/mnt/c/Users/adhd/conpot/setup.py", line 1, in <module>
    from setuptools import setup, find_packages
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils.core'

adhd@DESKTOP-I1T2G01:/mnt/c/Users/adhd/conpot$ python3.11 setup.py build
Traceback (most recent call last):
  File "/mnt/c/Users/adhd/conpot/setup.py", line 1, in <module>
    from setuptools import setup, find_packages
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils.core'
KorpoleRithika0x1 commented 1 year ago

Seems like it's trying to access the modules from python3 while i am trying to run it with 3.11. Also indicates that the modules might not be present in the given path either.

KorpoleRithika0x1 commented 1 year ago
Traceback (most recent call last):
  File "/home/rinz0x0cruz/.local/bin/conpot", line 45, in <module>
    from conpot.protocols.IEC104.IEC104_server import IEC104Server
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/IEC104_server.py", line 17, in <module>
    from conpot.protocols.IEC104.DeviceDataController import DeviceDataController
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/DeviceDataController.py", line 19, in <module>
    from conpot.protocols.IEC104.frames import *
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/frames.py", line 18, in <module>
    from scapy.all import *
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/scapy/all.py", line 18, in <module>
    from scapy.arch import *
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/scapy/arch/__init__.py", line 28, in <module>
    from scapy.arch.bpf.core import get_if_raw_addr
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/scapy/arch/bpf/core.py", line 29, in <module>
    LIBC = cdll.LoadLibrary(find_library("libc"))
  File "/usr/lib/python3.10/ctypes/util.py", line 341, in find_library
    _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
  File "/usr/lib/python3.10/ctypes/util.py", line 147, in _findLib_gcc
    if not _is_elf(file):
  File "/usr/lib/python3.10/ctypes/util.py", line 99, in _is_elf
    with open(filename, 'br') as thefile:
FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a'
KorpoleRithika0x1 commented 1 year ago

Alright, so building it properly even in my own pc gave these errors when i finally ran conpot

KorpoleRithika0x1 commented 1 year ago

Most of the stuff has been deprecated, some code seems to be incomplete but it may also have been left in that condition with intentions of user customizing it on their own

KorpoleRithika0x1 commented 1 year ago

so it seems that the code fetches from a native python library called "scapy" which in my case was a bit old. But after resolving that it gave me a new error in frames .py

Traceback (most recent call last):
  File "/home/rinz0x0cruz/.local/bin/conpot", line 45, in <module>
    from conpot.protocols.IEC104.IEC104_server import IEC104Server
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/IEC104_server.py", line 17, in <module>
    from conpot.protocols.IEC104.DeviceDataController import DeviceDataController
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/DeviceDataController.py", line 19, in <module>
    from conpot.protocols.IEC104.frames import *
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/conpot/protocols/IEC104/frames.py", line 258, in <module>
    class QOS(Packet):
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/scapy/base_classes.py", line 341, in __new__
    ] + [
  File "/home/rinz0x0cruz/.local/lib/python3.10/site-packages/scapy/base_classes.py", line 342, in <listcomp>
    inspect.Parameter(f.name,
  File "/usr/lib/python3.10/inspect.py", line 2666, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'S/E' is not a valid parameter name
KorpoleRithika0x1 commented 1 year ago

Got it running

adhd@DESKTOP-I1T2G01:~/job/conpot/bin$ conpot -f
/home/adhd/.local/lib/python2.7/site-packages/gevent/builtins.py:96: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  result = _import(*args, **kwargs)
/home/adhd/.local/lib/python2.7/site-packages/scapy/base_classes.py:319: SyntaxWarning: Packet 'SPE' has a duplicated 'SL2' field ! If you are using several ConditionalFields, have a look at MultipleTypeField instead ! This will become a SyntaxError in a future version of Scapy !
  warnings.warn(war_msg, SyntaxWarning)

                       _
   ___ ___ ___ ___ ___| |_
  |  _| . |   | . | . |  _|
  |___|___|_|_|  _|___|_|
              |_|

  Version 0.5.2
  MushMush Foundation

2023-06-06 04:49:09,450 --force option specified. Using testing configuration:
/usr/local/lib/python2.7/dist-packages/conpot/testing.cfg
--------------------------------------------------
 Available templates:
--------------------------------------------------

   --template ipmi
       Unit:        IPMI - 371
       Desc:        Creates a simple IPMI device
       Protocols:   IPMI
       Created by:  Lukas Rist

   --template IEC104
       Unit:        Siemens - S7-300
       Desc:        Creates a simple device for IEC 60870-5-104
       Protocols:   IEC104, SNMP
       Created by:  Patrick Reichenberger

   --template guardian_ast
       Unit:        Guardian - Guardian AST tank-monitoring system
       Desc:        Guardian AST tank-monitoring system
       Protocols:   guardian_ast
       Created by:  the conpot team

   --template default
       Unit:        Siemens - S7-200
       Desc:        Rough simulation of a basic Siemens S7-200 CPU with 2 slaves
       Protocols:   HTTP, MODBUS, s7comm, SNMP
       Created by:  the conpot team

   --template kamstrup_382
       Unit:        Kamstrup - 382
       Desc:        Register clone of an existing Kamstrup 382 smart meter
       Protocols:   Kamstrup
       Created by:  Johnny Vestergaard

   --template proxy
       Unit:        None - Proxy
       Desc:        Sample template that demonstrates the proxy feature.
       Protocols:   Proxy
       Created by:  the conpot team
KorpoleRithika0x1 commented 1 year ago

Left to solve ->

 /home/adhd/.local/lib/python2.7/site-packages/gevent/builtins.py:96: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  result = _import(*args, **kwargs)
/home/adhd/.local/lib/python2.7/site-packages/scapy/base_classes.py:319: SyntaxWarning: Packet 'SPE' has a duplicated 'SL2' field ! If you are using several ConditionalFields, have a look at MultipleTypeField instead ! This will become a SyntaxError in a future version of Scapy !
  warnings.warn(war_msg, SyntaxWarning)
KorpoleRithika0x1 commented 1 year ago

Alright, to solve this, just do

- git clone <conpot's git repo>
- cd conpot && pip3 install -r requirements.txt && pip3 install conpot
- python3.11 setup.py build
- cd bin && conpot -f