You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created the following bash script so your program can process multiple sites and output them all as text files and compress them.
#!/bin/bash
# Ask the user for the filename
echo "Please enter the filename:"
read filename
# Check if the file exists
if [ ! -f "$filename" ]; then
echo "File not found!"
exit 1
fi
# Create a results directory
mkdir -p results
# Read each line from the file
while IFS= read -r line
do
# Split the line by ':' and get the first part
host=${line%%:*}
# Inform the user of the current progress
echo "Processing $host"
# Run the program with the host, remove ANSI colors and redirect output to a temporary file
# The timeout command will terminate the python command if it runs for more than 30 seconds
timeout 30 python3 ./securityheaders.py "$host" | sed 's/\x1b\[[0-9;]*m//g' > "${host}.tmp" 2>>errors.log
# If the python command was terminated by the timeout command, print an error message
if [ $? -eq 124 ]; then
echo "Command timed out for host: $host" | tee -a errors.log
fi
# Check if the output file is zero size
if [ ! -s "${host}.tmp" ]; then
echo "$host file is zero size" >> logs.txt
rm "${host}.tmp"
else
mv "${host}.tmp" "results/${host}.txt"
fi
done < "$filename"
# Wait for all background processes to finish
wait
# Compress the results directory
zip -r results.zip results/
# Print a completion message
echo "Script completed successfully!"
The text was updated successfully, but these errors were encountered:
I created the following bash script so your program can process multiple sites and output them all as text files and compress them.
The text was updated successfully, but these errors were encountered: