Debian Codegraph @

scripts/update_autocomplete.sh

raw
1 #!/usr/bin/env bash
2
3 USER_AGENT="censys-python/$(uv version | cut -d ' ' -f 2)"
4
5 update_autocomplete() {
6 echo "Updating autocomplete data for $1..."
7 # Write a temporary file to avoid corrupting the original if the download fails
8 tmp_file=$(mktemp)
9 wget "https://search.censys.io/static/data/autocomplete-$1.json" -U "$USER_AGENT" -O "$tmp_file" && echo "" >> "$tmp_file"
10 mv "$tmp_file" "censys/cli/data/$1_autocomplete.json"
11 }
12
13 update_autocomplete hosts
14 update_autocomplete certificates