Skip to content

Commit 22e39fd

Browse files
Update zgrab's python2 dependency to python3 (zmap#485)
* python2 -> python3 * bump integration test action version 22.04->24.04 and install jp normally * correct README * fix bug in installing pip hopefully * bump mssql version and specify the platform so mac arm chips don't complain * virtual env fix * venv fix pt. 2 * venv fix pt. 3 * venv fix pt. 4
1 parent 0286323 commit 22e39fd

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

.github/workflows/integration-test.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
integration-test:
3939
name: Integration Test
40-
runs-on: ubuntu-22.04
40+
runs-on: ubuntu-24.04
4141
steps:
4242
- name: Check out source
4343
uses: actions/checkout@v4
@@ -58,17 +58,16 @@ jobs:
5858
- name: Install dependencies
5959
run: |
6060
set -e
61-
sudo wget https://github.com/jmespath/jp/releases/download/0.2.1/jp-linux-amd64 -O /usr/local/bin/jp
62-
sudo chmod +x /usr/local/bin/jp
63-
# Install Python 2.7
6461
sudo apt update
65-
sudo apt install -y python2
66-
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
67-
sudo python2 get-pip.py
62+
# Install latest Python
63+
sudo apt install -y python3 jp python3-pip
64+
python3 -m venv venv
65+
source venv/bin/activate
6866
# Install Python dependencies
69-
pip2 install --user zschema
70-
pip2 install --user -r requirements.txt
67+
pip install zschema
68+
pip install -r requirements.txt
7169
7270
- name: Run tests
7371
run: |
72+
source venv/bin/activate
7473
make integration-test

integration_tests/mssql/cleanup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set +e
44

5-
CONTAINER_NAME="zgrab_mssql-2017-linux"
5+
CONTAINER_NAME="zgrab_mssql-2022-linux"
66

77
echo "mssql/cleanup: Tests cleanup for mssql"
88

integration_tests/mssql/setup.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
echo "mssql/setup: Tests setup for mssql"
44

55
CONTAINER_IMAGE="mcr.microsoft.com/mssql/server"
6-
CONTAINER_VERSION="2017-latest"
7-
CONTAINER_NAME="zgrab_mssql-2017-linux"
6+
CONTAINER_VERSION="2022-latest"
7+
CONTAINER_NAME="zgrab_mssql-2022-linux"
88

99
# Supported MSSQL_PRODUCT_ID values are Developer, Express, Standard, Enterprise, EnterpriseCore
1010
MSSQL_PRODUCT_ID="Enterprise"
@@ -14,7 +14,7 @@ if docker ps --filter "name=$CONTAINER_NAME" | grep $CONTAINER_NAME; then
1414
exit 0
1515
fi
1616

17-
docker run -td --rm -e "MSSQL_PID=$MSSQL_PRODUCT_ID" -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$(openssl rand -base64 12)" --name $CONTAINER_NAME $CONTAINER_IMAGE:$CONTAINER_VERSION
17+
docker run -td --rm -e "MSSQL_PID=$MSSQL_PRODUCT_ID" -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$(openssl rand -base64 12)" --platform "linux/amd64" --name $CONTAINER_NAME $CONTAINER_IMAGE:$CONTAINER_VERSION
1818

1919
echo -n "mssql/setup: Waiting on $CONTAINER_NAME..."
2020

integration_tests/mssql/test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ TEST_ROOT=$MODULE_DIR/..
66
ZGRAB_ROOT=$(git rev-parse --show-toplevel)
77
ZGRAB_OUTPUT=$ZGRAB_ROOT/zgrab-output
88

9-
CONTAINER_NAME="zgrab_mssql-2017-linux"
9+
CONTAINER_NAME="zgrab_mssql-2022-linux"
1010

1111
mkdir -p $ZGRAB_OUTPUT/mssql
1212

13-
OUTPUT_FILE="$ZGRAB_OUTPUT/mssql/2017-linux.json"
13+
OUTPUT_FILE="$ZGRAB_OUTPUT/mssql/2022-linux.json"
1414

1515
echo "mssql/test: Tests runner for mssql"
1616
CONTAINER_NAME=$CONTAINER_NAME $ZGRAB_ROOT/docker-runner/docker-run.sh mssql > $OUTPUT_FILE

integration_tests/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ for protocol in $(ls $ZGRAB_OUTPUT); do
7878
echo "Validating $target [{("
7979
cat $target
8080
echo ")}]:"
81-
if ! python2 -m zschema validate zgrab2 $target --path . --module zgrab2_schemas.zgrab2 ; then
81+
if ! python3 -m zschema validate zgrab2 $target --path . --module zgrab2_schemas.zgrab2 ; then
8282
echo "Schema validation failed for $protocol/$outfile"
8383
err="schema failure@$protocol/$outfile"
8484
if [[ $status -eq 0 ]]; then

zgrab2_schemas/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ you can follow these steps:
1515
4. Pass in the zgrab2 JSON file to validate
1616
* ```
1717
echo 127.0.0.1 | ./cmd/zgrab2/zgrab2 mysql > output.json
18-
PYTHONPATH=/path/to/zschema python2 -m zschema validate zgrab2 output.json --path . --module zgrab2_schemas.zgrab2
18+
PYTHONPATH=/path/to/zschema python3 -m zschema validate zgrab2 output.json --path . --module zgrab2_schemas.zgrab2
1919
```
2020
2121
## Adding new module schemas

0 commit comments

Comments
 (0)