#! /bin/bash set -e set +x PATH="/usr/sbin:/usr/bin:/sbin:/bin" MSG_NETWORK_SCAN="" MSG_NETWORK="" MSG_LOGIN_USER=$(gettext "User's login to connect the servers") MSG_USER=$(gettext "User:") MSG_ERROR_NAME_USER=$(gettext "Login field empty") MSG_CHECK_MACHINES=$(gettext "Checking online servers") MSG_WAITING=$(gettext "Wait please...") MSG_NO_SERVER_PRESENT=$(gettext "N") LANG="es_ES.UTF-8" #use the proxy port to scan port="80" num_servers=1 servers_file="servers" #Ask for the network to scan network=$(zenity --width="200" --entry --title="Introduce la red en la que buscar los servidores X.X.X.X/XX" --text="Red:") #Ask for a user to connect with usuario=$(zenity --width="500" --entry --title="Introduce el usuario con el que te quieres conectar" --text="Usuario:") #If the user is empty we finish if [ -z $usuario ] then echo "No ha introducido el nombre del usuario." exit fi #Obtain registrered active clients if [ true ]; then echo "1" nmap -p $port -sS -oG $servers_file $network cat $servers_file| grep open|cut -d " " -f2>servers.tmp cat servers.tmp | sed -e 's/^/'$usuario'@/g'>$servers_file rm servers.tmp echo "2" #remove the server IP #cat $servers_file| grep -v $(llxcfg-listvars --values|grep ^SRV_IP | cut -d "=" -f2|cut -d "'" -f2)>servers fi |zenity --progress --pulsate --width="300" --auto-close --title="Comprobando equipos activos" --text="Espere por favor..." --percentage=0 #Check if there are any client connected if [ ! -f $servers_file ] then echo "no se ha detectado ningún servidor" else #Show a list with the connected servers zenity --question --text="Hay "$(wc -l < $servers_file)" equipos conectados en la red "$(echo $network|cut -d "/" -f1)": \n"$(cat $servers_file|cut -d "." -f4|tr -s "\n" ",")" \n¿Desea continuar?" if [ $? -eq 0 ] then #Connect to all clients in the list cssh $(cat $servers_file) #2> /dev/null #rm $servers_file else exit fi fi