proxy ongoing

This commit is contained in:
ofilter 2022-03-25 05:22:02 +01:00
parent 4ce4f71d6b
commit e5c862378b
3 changed files with 46 additions and 17 deletions

View File

@ -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'
```
#####

View File

@ -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"

2
proxy_routes Normal file
View File

@ -0,0 +1,2 @@
proxy_route1
proxy_route2