diff --git a/README.md b/README.md index 8b705af..be5c93a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# garbage redo + # Experimental usage Download the scripts **send_files.sh** and **distribute.sh** @@ -61,6 +63,10 @@ Place the files on the working structure (aka. script folder) ./user2/ <---- directory from the user ./user2/p <---- txt with password of the user + +./_proxy_route1/ <---- Directory for the proxy route 'proxy_route1' +./_proxy_route1/u <---- txt with the username used to authenticate to 'proxy_route1' +./_proxy_route1/p <---- txt with password used to authenticate to 'proxy_route1' ``` ##### diff --git a/distribute.sh b/distribute.sh index 86af9bb..ff32654 100644 --- a/distribute.sh +++ b/distribute.sh @@ -8,7 +8,7 @@ ### VAR export _USERS="$(cat ./users)" - +export _PROXY_ROUTES="$(cat ./proxy_routes)" ### Main @@ -16,32 +16,53 @@ sed '/^$/d' h | tee ./curr_h >/dev/null # remove empty lines printf "Attempting to SSH\n" -for u in $_USERS +for username in $_USERS do - printf "\033[0;33m $u\n\033[0m" - rm ./${u}/h - touch ./${u}/h - for h in $(cat ./curr_h) + printf "\033[0;33m ${username}\n\033[0m" + cat > "./${username}/h" + for hostname in $(cat ./curr_h) do - printf "${h}: -->" -# sshpass -f "./${u}/p" ssh -q -o GSSAPIAuthentication=no -o StrictHostKeyChecking=no -T "${u}@${h}" 'echo true' &> /dev/null && - - sshpass -f "./${u}/p" ssh -q -o StrictHostKeyChecking=no -T "${u}@${h}" 'echo true' &> /dev/null && - printf "${h}: \033[1;32mYES \033[0m\n" && - printf "${h}\n" | tee -a "./${u}/h" > /dev/null || - printf "${h}: \033[1;31mNo \033[0m\n" < "./${u}/p" + printf "${hostname}: -->" + sshpass -f "./${username}/p" ssh -q -o StrictHostKeyChecking=no -T "${username}@${hostname}" 'echo true' &> /dev/null && + printf "${hostname}: \033[1;32mYES \033[0m\n" && + printf "${hostname}\n" | tee -a "./${username}/h" > /dev/null || + printf "${hostname}: \033[1;31mNo \033[0m\n" done - diff --new-line-format="" --unchanged-line-format="" ./curr_h "${u}/h" > left_h + diff --new-line-format="" --unchanged-line-format="" ./curr_h "${username}/h" > left_h mv ./left_h ./curr_h done mv curr_h discards_h +# Proxy / Triangulate +for proxy in $_PROXY_ROUTES +do + printf "\033[0;33m ${username}\n\033[0m" + for username in $_USERS + do + false +# printf "\033[0;33m ${username}\n\033[0m" +# rm ./${username}/h +# touch ./${username}/h +# for hostname in $(cat ./curr_h) +# do +# printf "${hostname}: -->" +# sshpass -f "./${username}/p" ssh -q -o StrictHostKeyChecking=no -T "${username}@${hostname}" 'echo true' &> /dev/null && +# printf "${hostname}: \033[1;32mYES \033[0m\n" && +# printf "${hostname}\n" | tee -a "./${username}/h" > /dev/null || +# printf "${hostname}: \033[1;31mNo \033[0m\n" < "./${username}/p" +# done +# diff --new-line-format="" --unchanged-line-format="" ./curr_h "${username}/h" > left_h +# mv ./left_h ./curr_h + done +done +mv curr_h discards_h + printf "Distributed hosts\n" -for u in $_USERS +for username in $_USERS do - printf "\033[0;32m $u\n\033[0m" - awk '{ printf" %s\n",$0 }' < "./${u}/h" + printf "\033[0;32m ${username}\n\033[0m" + awk '{ printf" %s\n",$0 }' < "./${username}/h" done printf "\033[0;31mDISCARDS:\033[0m\n" diff --git a/proxy_routes b/proxy_routes new file mode 100644 index 0000000..104f06d --- /dev/null +++ b/proxy_routes @@ -0,0 +1,2 @@ +proxy_route1 +proxy_route2 \ No newline at end of file