gpt4 book ai didi

linux - 使用Linux bash同时向许多主机发送http-get请求

转载 作者:行者123 更新时间:2023-12-03 09:55:18 25 4
gpt4 key购买 nike

可以使用linux bash工具同时向多个主机发送http-get请求吗?
此刻我做

wget -O- http://192.168.1.20/get_data-php > out.log
但是我需要请求所有 192.168.1.0/17 IP。

最佳答案

#!/bin/sh
rm address.txt allout.txt # remove old file with addresses and contents
nmap -n -sn 192.168.1.0/17 -oG - | awk '/Up$/{print $2}' > address.txt # get all active hosts and store into a file address.txt

while IFS="" read -r add || [ -n "$add" ]
do
wget -q -O- http://"$add"/get_data-php > out"$add".log & # for every address create file with wget content
done < address.txt

wait

cat out*.log > allout.txt # put all .log file contents to allout.txt

rm -r out*.log # remove all created .log files

关于linux - 使用Linux bash同时向许多主机发送http-get请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62777037/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com