Last active
February 17, 2017 12:51
-
-
Save EikeDehling/9cce7826f2627968df08ab2772aea218 to your computer and use it in GitHub Desktop.
Bash script to generate a random (apache) log line every random seconds
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
#!/usr/bin/env bash | |
while true | |
do | |
random_ip=$(dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -An -tu1 | sed -e 's/^ *//' -e 's/ */./g') | |
random_size=$(( (RANDOM % 65535) + 1 )) | |
current_date_time=$(date '+%d/%b/%Y:%H:%M:%S %z') | |
echo "$random_ip - - [$current_date_time] \"GET /data.php HTTP/1.1\" 200 $random_size" | tee -a 'random_log' | |
sleep $[ ( $RANDOM % 10 ) + 1 ]s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment