I would like to make a bash script where I read a list of IP addresses and run the following command:
smbclient \\\\ $ ip \\ ipc $ -U ". \ User" --pw-nt-hash
which does an exit and try with another IP, regardless of that it throws a message if the connection was successful, it does not execute with the IPs that are inside the list, it only tries with the first one in the list.
#/bin/bash
IPLIST="ip"
for ip in $(cat ip)
do
smbclient \\\\$ip\\C$ -U ".\user" --pw-nt-hash "user"
exit
done
If you don't want the script to exit after the first
smbclient
, drop theexit
command.This
exit
is not done bysmbclient
, but rather by the script; therefore it ends.