Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The script simulates the random access log

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

#! / 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= (200404)

Rnd=$ (rand 0 2) http_code= (200 403 404) ip_rand=$ (rand 0 2) ip_list= (192. one hundred and sixty eight。 11.) Month_date= "$(rand 100254) month_date=" $(date'+% b') "last_time= `date-d'- 1 minutes' +"% Y:%H:%M "`date-d'- 1 minutes' +"% Y:%H:%M "`date `echo $line | sed" last_time $20181235 ip_rand ${last_time} / gclesCompact ${ip_list [$date]} / ${n_ip}. / g Source_http_code ${source_http_code [$source_rnd]} / ${http_code [$rnd]} / g "`echo ${new_log} > > auto_access.logsleep_rand=$ (rand 0 1 2 3) sleep ${sleep_rand}

Done < ${source_path}

Done

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report