diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29bd4cc97e5aa888a02688ac446c4cbfaa84b6ad..e5c3a2873990004b7323b0eebfab4dc556035f6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: docker:stable stages: - build +- test - push before_script: @@ -12,6 +13,14 @@ build: stage: build script: docker build -t registry-gitlab.xlab.si/cyberwiser/$SERVICE:$VERSION . +test: + stage: test + script: + - docker run -e "TARGET=${TARGET}" -v /tmp/:/mnt/output registry-gitlab.xlab.si/cyberwiser/$SERVICE:$VERSION + - cat /tmp/genscan-out.json + - grep -q "W3af" /tmp/genscan-out.json + - grep -q "OWASP ZAdP" /tmp/genscan-out.json + push: stage: push script: diff --git a/Makefile b/Makefile index fb377b660410528b705a9105dcc82e3f37932d0c..6a20cde531d00383b0cded4009a6c7ad5738a333 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,17 @@ VERSION = $(shell grep VERSION MANIFEST | cut -d '=' -f2) TARGET ?= http://10.10.43.182 +TEST_DIR = /tmp/test-$(SERVICE)-$(VERSION)-$(shell date +%s)/ + build: docker build -t registry-gitlab.xlab.si/cyberwiser/$(SERVICE):$(VERSION) . +test: + mkdir $(TEST_DIR) + docker run -e "TARGET=$(TARGET)" -v $(TEST_DIR):/mnt/output/ registry-gitlab.xlab.si/cyberwiser/$(SERVICE):$(VERSION) + grep -q "W3af" $(TEST_DIR)genscan-out.json + grep -q "OWASP ZAP" $(TEST_DIR)genscan-out.json + start: ifdef OUTPUT_DIR docker run -e "TARGET=$(TARGET)" -v $(OUTPUT_DIR):/mnt/output/ registry-gitlab.xlab.si/cyberwiser/$(SERVICE):$(VERSION) diff --git a/install.sh b/install.sh index 54be29fcd680e40d359c92fe4ddcec876922d2d4..6d70301248ad17b696ee0eb7cbb12e061c900175 100644 --- a/install.sh +++ b/install.sh @@ -1,10 +1,16 @@ #!/bin/bash apt update && -apt install -y python2.7 python-pip wget unzip git && +apt install -y python2.7 wget unzip git && +cd /tmp && +#newer version of pip than through apt +wget -nv https://bootstrap.pypa.io/get-pip.py && +python2.7 get-pip.py && #requirements for w3af apt install -y python2.7-dev build-essential libxml2-dev libxslt1-dev zlib1g-dev libssl-dev && +#pip (again) only because strict w3af dependency checks +apt install -y python-pip && pip install -r /tmp/requirements.txt && pip install git+git://github.com/hay/xml2json.git@3a674efad91e0f1e978babc41a72f297d5e5144b && #node and retire