12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #!/usr/bin/env bash
- set -euo pipefail
- for cmd in python3 git wget zip; do
- command -v "$cmd" >/dev/null 2>&1 || {
- printf '[%s] Required command %s not found, exiting.\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$cmd" >&2
- exit 1
- }
- done
- download_and_concatenate_common_dictionaries() {
-
- local target_file="$1"
-
-
- shift
- for url in "$@"; do
- wget -qO- "$url" >>"$target_file"
-
- echo >>"$target_file"
- done
- }
- prepare_dictionaries_for_fuzz_targets() {
- local dictionaries_dir="$1"
- local fuzz_targets_dir="$2"
- local common_base_dictionary_filename="$WORK/__base.dict"
- printf '[%s] Copying .dict files from %s to %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$dictionaries_dir" "$SRC/"
- cp -v "$dictionaries_dir"/*.dict "$SRC/"
- download_and_concatenate_common_dictionaries "$common_base_dictionary_filename" \
- "https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/utf8.dict" \
- "https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/pem.dict"
- find "$fuzz_targets_dir" -name 'fuzz_*.py' -print0 | while IFS= read -r -d '' fuzz_harness; do
- if [[ -r "$common_base_dictionary_filename" ]]; then
-
- fuzz_harness_dictionary_filename="$(basename "$fuzz_harness" .py).dict"
- local output_file="$SRC/$fuzz_harness_dictionary_filename"
- printf '[%s] Appending %s to %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$common_base_dictionary_filename" "$output_file"
- if [[ -s "$output_file" ]]; then
-
-
-
-
-
-
- echo >>"$output_file"
- fi
- cat "$common_base_dictionary_filename" >>"$output_file"
- fi
- done
- }
- prepare_dictionaries_for_fuzz_targets "$SRC/dulwich/fuzzing/dictionaries" "$SRC/dulwich/fuzzing/"
- apt-get update && apt-get install -y libgpgme-dev libgpg-error-dev
- rm -rf /usr/local/bin/cargo
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly --profile minimal -y
- python3 -m pip install --upgrade pip
- python3 -m pip install -U 'atheris>=2.3.0' 'setuptools~=73.0' 'pyinstaller>=6.10' setuptools-rust
|