Skip to content

Instantly share code, notes, and snippets.

View squizzi's full-sized avatar

Kyle Squizzato squizzi

View GitHub Profile
@squizzi
squizzi / tcpdump-watch_docker-log.sh
Created July 27, 2018 21:06
tcpdump watch modified to work with docker logs -f
#!/bin/bash
## tcpdump-watch
## Maintainer: Kyle Squizzato - [email protected]
## Simple tool to capture tcpdump until certain log message is matched.
## Fill in each of the variables in the SETUP section then invoke the script and wait
## for the issue to occur, the script will stop on it's own when the $match is seen
## in the desired $container_name.
@squizzi
squizzi / download_lotsa_images.sh
Last active August 23, 2018 21:58
when you need to download a silly amount of images for a silly reproducer
#!/bin/bash
# Search terms are of images and their derivatives that should be
# relatively small in size it's a total guessing game but whatever
declare -a searchTerms=(
"alpine" "fedora" "ubuntu" "python" "small" "curl" "busybox" "mini" "hello-world" "graphql" "tiny"
"cirros" "opensuse" "dind" "maven" "multistage"
)
for element in "${searchTerms[@]}"
do
for each in $(docker search $element --limit 100 | awk '{print $1}')
@squizzi
squizzi / load_env.py
Last active September 26, 2019 18:54
Load a UCP client bundle in python3
"""
load_env is the functional equivalent of loading a UCP client bundle
"""
def load_env(client_bundle="/client-bundle"):
logging.info("Loading UCP client bundle...")
try:
# Open the extracted, mounted client_bundle directory and use its
# contents
bundle_env = client_bundle + "/env.sh"
with open(bundle_env) as f:
{"lastUpload":"2020-09-30T16:53:06.954Z","extensionVersion":"v3.4.3"}
@squizzi
squizzi / reset_cve_db.sh
Created July 21, 2021 17:31
Reset a MSR CVE DB for testing.
docker exec -it -u postgres $(docker ps -aq --filter name=dtr-scanningstore) psql -d fuzzomatic -c "UPDATE public.appcheck_nvdfeed set summary=0 where cve='NOT-ACTUAL-CVE'"
REPLICA_ID=$(docker ps -lf name='^/dtr-rethinkdb-.{12}$' --format '{{.Names}}' | cut -d- -f3)
echo "r.db('dtr2').table('properties').get('scan_info').update({value : '{"scannerFingerprint":{"scannerType":0,"version":["0","0"]},"scannerUpdatedAt":"2021-01-01T01:00:00.000000000Z","lastDBUpdateFailed":false,"lastVulnOverridesDBUpdateFailed":false}'})" | docker run -e DTR_REPLICA_ID=$REPLICA_ID -i --rm --net dtr-ol -v dtr-ca-$REPLICA_ID:/ca dockerhubenterprise/rethinkcli:v2.2.0-ni non-interactive; echo
echo -e "CVE DB reset to version 0"
@squizzi
squizzi / images.sh
Last active December 16, 2022 19:40
Pull MSR 3 images and package as tarball
#!/bin/sh
MSR_TAG=3.0.5
ENZI_TAG=1.0.5
OUTPUT_FILE="/tmp/msr-${MSR_TAG}.tar"
echo "Pulling all MSR images for version: ${MSR_TAG}, enzi version: ${ENZI_TAG}"
declare -a IMAGES=(
registry.mirantis.com/msr/msr-api:$MSR_TAG