I'm creating a tool that makes security searches. My printer detection script is getting strings in another .txt file like "Printer Firmware Version" and using grep tool to check if its exist in target host website. But my script split this strings and uses them as different variables like Printer, Firmware, Version. How can I get that strings without splitting them?
found=(`cat temp.txt`) # <- This line for target
httarr=(`cat httpport.txt`)
printer_array=(`cd ..; cat keywords/printerwords.txt`)
for lo in ${httarr[*]}
do
ifacelook=`curl -sSL http://$found:$lo`
for pr in ${printer_array[*]}
do
echo $pr # <-This line is to see incoming variables
echo $found | grep -o '${pr}' &>/dev/null
if [ $? -eq 0 ];then
echo -en "$cyan>$green|${red}printer$green|$cyan>$default This device is a printer check: http://$found:$lo \n"
fi
done
done
Incoming variables:
Printer
Firmware
Version
.
.
.
Variables I want:
Printer Firmware Version
.
.
.
mapfile -t found < temp.txtandmapfile -t httarr < httpport.txt. Get rid offound=(cat temp.txt)andhttarr=(cat httpport.txt)(or setIFS=$'\n'and then restore the default afterwards).