简体   繁体   中英

How to add to a bash script 2 enter button commands?

Evening everyone,

My question is im working on a bash script. Im having it ping a host and also banner grab using netcat. However ive no clue how to add the two enter buttons taps to the HEAD /HTTP/1.0 for it to banner grab the http port. Any suggestions are much welcome. Thank you Wez

Script is as follows:

#!/bin/bash

for ip in $(cat ip-list.txt); 
do ping -c 1 $ip |grep "bytes from" |cut -d " " -f 4 |cut -d ":" -f 1 |sort -u &
done 

for ip in $ip 
do nc -nv $ip 80
done

for ip in $ip
do 
    HEAD /HTTP/1.0
done

Figured it out. I just used this:

#!/bin/bash

for ip in $(cat ip-list.txt); 
do ping -c 1 $ip |grep "bytes from" |cut -d " " -f 4 |cut -d ":" -f 1 |sort -u &
done 

nc -v ${ip} 80 << EOF
HEAD / HTTP/1.0

EOF

For anyone who may need it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM