zgrab2/integration_tests.sh
justinbastress a244ec15e6 TLS scan prototype + Travis integration (#25)
* Fix typo

* Actually call init per sender for each goroutine

* split out TLS handling

* Rename tls_handshake; update docs

* fix comments

* format fixes

* merge updates

* fix path

* refactor heartbleed logging (now the same as original zgrab)

* add ScanStatus, update modules to return it

* fix threaded for loop; fix styling of dict literal

* fix compile errors, note un-bubbled handshake error

* initial schema commit

* fix comment

* schema cleanup

* comments

* fix TODOs

* first attempt at docker integration in travis; also add schema validation

* add integration_tests.sh

* need sudo?

* try pip install --user

* revert regression

* add docker service again

* chmod +x integration_tests.sh

* fix path of binary

* Dump output file to stdout

* travis work

* use jp's build-self-contained script

* use go get/go build to get jp

* fix jp path

* switch from bogus regex to wildcard

* do all mysql versions; fix version comparison

* re-enable notifications; fix successful version check log message; comment TryGetScanStatus

* move to conf.d layout for integration tests

* update README

* add missing scripts

* add ./ to path
2017-12-15 09:25:17 -05:00

46 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -e
# Do all integration tests for all protocols
# To add tests for a new protocol, create a directory integration_tests/<new_protocol>, and drop its setup.sh, test.sh, and cleanup.sh there.
if [ -z $ZSCHEMA_PATH ]; then
ZSCHEMA_PATH="$(pwd)/zschema"
fi
# <protocol>_integration_tests.sh should drop its output into $ZGRAB_OUTPUT/<protocol>/* so that it can be validated
if [ -z $ZGRAB_OUTPUT ]; then
ZGRAB_OUTPUT="$(pwd)/zgrab-output"
fi
export ZGRAB_OUTPUT=$ZGRAB_OUTPUT
export ZGRAB_ROOT=$(pwd)
pushd integration_tests
for mod in $(ls); do
if [ -d "$mod" ]; then
pushd $mod
for test in $(ls test*.sh); do
echo "Running integration_tests/$mod/$test"
./$test
done
popd
fi
done
popd
if [ -d $ZSCHEMA_PATH ]; then
echo "Doing schema validation..."
for protocol in $(ls $ZGRAB_OUTPUT); do
for outfile in $(ls $ZGRAB_OUTPUT/$protocol); do
target="$ZGRAB_OUTPUT/$protocol/$outfile"
echo "Validating $target [{("
cat $target
echo ")}]:"
PYTHONPATH=$ZSCHEMA_PATH python -m zschema validate schemas/__init__.py:zgrab2 $target
echo "validation of $target succeeded."
done
done
else
echo "Skipping schema validation: point ZSCHEMA_PATH to your zschema checkout to enable"
fi