脚本模拟出随机出访问日志
发布时间:2020-12-15 19:47:28 所属栏目:安全 来源:网络整理
导读:#!/bin/bash source_path='./soruce.access.log' function rand(){ min=$1 max=$(($2-$min+1)) num=$(date +%s%N) echo $(($num%$max+$min)) } while true do while read line do source_rnd=$(rand 0 1) source_http_code=(200 404) rnd=$(rand 0 2) http_c
#!/bin/bash source_path='./soruce.access.log' function rand(){ while true rnd=$(rand 0 2) http_code=(200 403 404) ip_rand=$(rand 0 2) ip_list=(192. 168. 11.) n_ip=$(rand 100 254) month_date="$(date '+%b')" last_time=`date -d '-1 minutes' +"%Y:%H:%M"` new_log=`echo $line| sed "s/20181235/${last_time}/g;s/${ip_list[$ip_rand]}/${n_ip}./g;s/${source_http_code[$source_rnd]}/${http_code[$rnd]}/g"` echo ${new_log} >> auto_access.log sleep_rand=$(rand 0 1 2 3) sleep ${sleep_rand} done < ${source_path}done (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |