Skip to content

Commit

Permalink
Merge 956f875 into ff09e00
Browse files Browse the repository at this point in the history
  • Loading branch information
glaslos committed Nov 3, 2020
2 parents ff09e00 + 956f875 commit 3b2f2a4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ exclude_lines =
if 0:
if __name__ == .__main__.:

ignore_errors = True
ignore_errors = True
60 changes: 30 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
language: python
python:
- '3.7'
- "3.7"
virtualenv:
system_site_packages: false
sudo: false
cache:
- apt
- pip
- apt
- pip
before_install:
- export TRAVIS_COMMIT_MSG="$(git log --format=%B --no-merges -n 1)"
- REPO=`pwd`
- echo $REPO
- echo $TRAVIS_TAG
- pwd
- export TRAVIS_COMMIT_MSG="$(git log --format=%B --no-merges -n 1)"
- REPO=`pwd`
- echo $REPO
- echo $TRAVIS_TAG
- pwd
services:
- mysql
addons:
apt:
packages:
- python3-pip
- git
- unzip
- python-dev
- libevent-dev
- libxml2
- libxml2-dev
- libxml2-utils
- python-mysqldb
- libmysqlclient-dev
- ipmitool
- python3-pip
- git
- unzip
- python-dev
- libevent-dev
- libxml2
- libxml2-dev
- libxml2-utils
- python-mysqldb
- libmysqlclient-dev
- ipmitool
install:
- export PYTHONIOENCODING=UTF8
- git show HEAD:conpot/__init__.py > docs/source/conpot_version.py
- pip install coveralls
- pip install tox
- pip install -r requirements.txt
- export PYTHONIOENCODING=UTF8
- git show HEAD:conpot/__init__.py > docs/source/conpot_version.py
- pip install coveralls
- pip install tox
- pip install -r requirements.txt
before_script:
- mysql -e 'CREATE DATABASE IF NOT EXISTS conpot_unittest;'
- chmod +x "$REPO/bin/conpot"
- mysql -e 'CREATE DATABASE IF NOT EXISTS conpot_unittest;'
- chmod +x "$REPO/bin/conpot"
script:
- tox
- xmllint --schema conpot/tests/template_schemas/core.xsd conpot/templates/default/template.xml
- tox
- xmllint --schema conpot/tests/template_schemas/core.xsd conpot/templates/default/template.xml
after_success:
- coveralls
- coveralls
notifications:
irc:
- irc.freenode.org#conpot-dev
- irc.freenode.org#conpot-dev
slack:
secure: kNsZ0yGar7bcvU4xazqCeGf8zJ8PfbQ16X+Q4Fzu4mHNcnmmal80BHMwHKHfg5SBZViDVqZeA+yEGFAK4z93IXGKLhcCkXiw7qm9K29dP7DWgAFwDn42XNPjx5mQF9elr6T8AD0S1oQM4ML+0h1I+nYY+SK28UUjvDh65o9NHqA=
8 changes: 4 additions & 4 deletions conpot/protocols/snmp/conpot_cmdrsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def handleMgmtOperation(self, snmpEngine, stateReference, contextName, PDU, acIn
self.log(snmp_version, "Get", addr, varBinds, rspVarBinds, sock)

# apply tarpit delay
if self.tarpit is not 0:
if self.tarpit != 0:
self.do_tarpit(self.tarpit)

# send response
Expand Down Expand Up @@ -204,7 +204,7 @@ def handleMgmtOperation(self, snmpEngine, stateReference, contextName, PDU, acIn
rspVarBinds = rspModBinds

# apply tarpit delay
if self.tarpit is not 0:
if self.tarpit != 0:
self.do_tarpit(self.tarpit)

# send response
Expand Down Expand Up @@ -281,7 +281,7 @@ def handleMgmtOperation(self, snmpEngine, stateReference, contextName, PDU, acIn
self.log(snmp_version, "Bulk", addr, varBinds, rspVarBinds, sock)

# apply tarpit delay
if self.tarpit is not 0:
if self.tarpit != 0:
self.do_tarpit(self.tarpit)

# send response
Expand Down Expand Up @@ -321,7 +321,7 @@ def handleMgmtOperation(self, snmpEngine, stateReference, contextName, PDU, acIn
rspVarBinds = None

# apply tarpit delay
if self.tarpit is not 0:
if self.tarpit != 0:
self.do_tarpit(self.tarpit)

try:
Expand Down
45 changes: 23 additions & 22 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
FROM alpine:3.8 as conpot-builder
FROM alpine:3.12.1 as conpot-builder

# Install dependencies
RUN apk add --no-cache ipmitool tcpdump git python3-dev build-base wget py-cffi libxslt-dev openssl-dev libffi-dev
RUN apk update \
&& apk add --no-cache ipmitool git python3-dev build-base py-cffi libxslt-dev libffi-dev py3-pip \
&& apk add --virtual build-deps gcc musl-dev \
&& apk add --no-cache mariadb-dev

# Copy the app from the host folder (probably a cloned repo) to the container
RUN adduser -s /bin/ash -D conpot

WORKDIR /opt/
RUN git clone --depth=1 https://github.com/mushorg/conpot.git
RUN chown conpot:conpot -R /opt/conpot

# Install Python requirements
USER conpot
WORKDIR /opt/conpot
RUN pip3 install --user --no-cache-dir -U pip==18.1 setuptools
RUN pip3 install --user --no-cache-dir coverage
RUN pip3 install --user --no-cache-dir -r requirements.txt

# Install the Conpot application
RUN python3 setup.py install --user --prefix=
WORKDIR /opt/conpot

# Run test cases
ENV PATH=$PATH:/home/conpot/.local/bin
RUN py.test -v

RUN pip3 uninstall -y setuptools

WORKDIR /home/conpot
RUN pip3 install --user --no-cache-dir -U pip wheel
RUN pip3 install --user --no-cache-dir setuptools
RUN pip3 install --user --no-cache-dir -r requirements.txt

FROM alpine:3.8
# Install the Conpot application
RUN python3 setup.py install --user --prefix=

USER root

# Run container
FROM alpine:3.12.1

RUN apk add --no-cache ipmitool ca-certificates tcpdump python3 wget py-cffi libxslt openssl
RUN apk update \
&& apk add --no-cache ipmitool ca-certificates python3 wget py-cffi libxslt openssl

RUN adduser -s /bin/ash -D conpot
WORKDIR /home/conpot

COPY --from=conpot-builder --chown=conpot:conpot /home/conpot/.local/ /home/conpot/.local/
RUN mkdir -p /etc/conpot /var/log/conpot /usr/share/wireshark && \
wget https://github.com/wireshark/wireshark/raw/master/manuf -o /usr/share/wireshark/manuf
RUN mkdir -p /etc/conpot /var/log/conpot /usr/share/wireshark \
&& wget https://github.com/wireshark/wireshark/raw/master/manuf -o /usr/share/wireshark/manuf

# Create directories
RUN mkdir -p /var/log/conpot/
RUN mkdir -p /data/tftp/
RUN chown conpot:conpot /var/log/conpot
RUN chown conpot:conpot -R /data
RUN mkdir -p /var/log/conpot/ \
&& mkdir -p /data/tftp/ \
&& chown conpot:conpot /var/log/conpot \
&& chown conpot:conpot -R /data

# Clean
RUN apk del --purge wget ca-certificates
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ envdir = {toxinidir}/.tox/py37
basepython = python3.7
commands =
{envpython} setup.py install
{posargs:conpot -f}
{posargs:conpot -f}

0 comments on commit 3b2f2a4

Please sign in to comment.