diff --git a/.coveragerc b/.coveragerc index bb88ac6c..58a9a7ce 100644 --- a/.coveragerc +++ b/.coveragerc @@ -7,7 +7,6 @@ omit = conpot/core/loggers/sqlite_log.py conpot/core/loggers/stix_transform.py conpot/core/loggers/taxii_log.py - conpot/utils/mac_addr.py .tox/* diff --git a/.dockerignore b/.dockerignore index 0f4fc436..fb181d08 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,11 @@ .gitignore .landscape.yaml .travis.yaml +.venv +.pytest_cache + +**/__pycache__ + Changelog.txt docker-compose.xml Dockerfile diff --git a/Dockerfile b/Dockerfile index bb09f31f..0b07d907 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,7 @@ WORKDIR /opt/conpot COPY . . # Install specific dependencies -RUN pip3 install --no-cache-dir pysnmp==4.4.12 \ - && pip3 install --no-cache-dir pysmi==0.3.2 \ - && pip3 install --no-cache-dir pyasn1==0.4.8 \ - && pip3 install --no-cache-dir cryptography==3.4.8 \ - && pip3 install --no-cache-dir . +RUN pip3 install --no-cache-dir . # Stage 2: Runtime stage FROM python:3.8-slim diff --git a/Makefile b/Makefile index 40db88f8..010d4fcc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ build-docker: docker build -t conpot:latest . run-docker: - docker run -it -p 80:8800 -p 102:10201 -p 502:5020 -p 161:16100/udp -p 47808:47808/udp -p 623:6230/udp -p 21:2121 -p 69:6969/udp -p 44818:44818 --network=bridge --name conpot conpot:latest + docker run --rm -it -p 80:8800 -p 102:10201 -p 502:5020 -p 161:16100/udp -p 47808:47808/udp -p 623:6230/udp -p 21:2121 -p 69:6969/udp -p 44818:44818 --network=bridge --name conpot conpot:latest format: black . diff --git a/bin/conpot b/bin/conpot index 5e293eb6..075adc40 100755 --- a/bin/conpot +++ b/bin/conpot @@ -39,7 +39,6 @@ from conpot.core.log_worker import LogWorker from conpot.protocols.proxy.proxy import Proxy from conpot.utils import ext_ip from conpot.utils.greenlet import spawn_startable_greenlet -from conpot.utils import mac_addr from conpot.utils.networking import fix_sslwrap logger = logging.getLogger() @@ -365,8 +364,6 @@ def main(): if config.getboolean("fetch_public_ip", "enabled"): public_ip = ext_ip.get_ext_ip(config) - - for protocol_name, server_class in protocols.name_mapping.items(): protocol_template = os.path.join( root_template_directory, protocol_name, "{0}.xml".format(protocol_name) @@ -384,9 +381,7 @@ def main(): if ast.literal_eval( dom_protocol.xpath("//{0}/@enabled".format(protocol_name))[0] ): - host = dom_protocol.xpath("//{0}/@host".format(protocol_name))[ - 0 - ] + host = dom_protocol.xpath("//{0}/@host".format(protocol_name))[0] # -- > Are we running on testing config? if "testing.cfg" in args.config: if "127." not in host: @@ -405,15 +400,11 @@ def main(): greenlet.link_exception(on_unhandled_greenlet_exception) servers.append((server, greenlet)) logger.info( - "Found and enabled {} protocol.".format( - protocol_name, server - ) + "Found and enabled {} protocol.".format(protocol_name, server) ) else: logger.info( - "{} available but disabled by configuration.".format( - protocol_name - ) + "{} available but disabled by configuration.".format(protocol_name) ) else: logger.debug( @@ -430,9 +421,7 @@ def main(): # TODO: Line up Proxy init with other protocols template_proxy = os.path.join(root_template_directory, "proxy", "proxy.xml") if os.path.isfile(template_proxy): - xsd_file = os.path.join( - os.path.dirname(inspect.getfile(Proxy)), "proxy.xsd" - ) + xsd_file = os.path.join(os.path.dirname(inspect.getfile(Proxy)), "proxy.xsd") validate_template(template_proxy, xsd_file) dom_proxy = etree.parse(template_proxy) if dom_proxy.xpath("//proxies"): diff --git a/requirements.txt b/requirements.txt index d1ddeb21..eb1e79dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,8 @@ gevent>=1.0 -pysnmp +pysnmp==4.4.12 pysnmp-mibs -pysmi +pysmi==0.3.2 +pyasn1==0.4.8 lxml requests sphinx @@ -25,6 +26,6 @@ tftpy # some freezegun versions broken freezegun!=0.3.13 pytest -cryptography +cryptography==3.4.8 sphinx_rtd_theme psutil