-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: multish | ||
Version: 1.0.0 | ||
Version: 1.0.3 | ||
Architecture: all | ||
Maintainer: Raul Tierno<[email protected]> | ||
Depends: tmux,sshpass,nmap | ||
Depends: tmux,sshpass,nmap,ldapscripts,wakeonlan | ||
Description: multish allows you to connect and act in multiple ssh connection simultaneously |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
prompt="Select group:" | ||
options=( $(find /etc/multish/group -type f -name "*" -print0 | xargs -0) ) | ||
echo "" | ||
echo "Send Wake up message to group" | ||
echo "------------------------" | ||
PS3="$prompt " | ||
select opt in "${options[@]}" "Quit" ; do | ||
if (( REPLY == 1 + ${#options[@]} )) ; then | ||
break | ||
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then | ||
echo "You picked $opt which is file $REPLY" | ||
echo -n Password: | ||
read -s password | ||
|
||
for name in $(cat $opt | awk -F\# '$1!="" { print $1 ;}' | sed 's/.*@//' | sed 's/\..*//'); | ||
do | ||
echo "" | ||
echo $name | ||
/usr/share/multish/despierta.sh $name | ||
done | ||
break | ||
else | ||
echo "Invalid option. Try another one." | ||
fi | ||
done | ||
|
||
multish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# despierta.sh | ||
# Victor Martinez Pajares | ||
# Envia una señal wakeonlan a un equipo según su nombre | ||
# Se puede hacer con etherwake, pero obliga a generar un fichero de macs-name y es un rollo. | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Send a wakeonlan magic packet to a hostname" | ||
echo "Use: $0 hostname" | ||
exit | ||
fi | ||
|
||
# Search in group 1 | ||
echo "Searching $1 in group 1." | ||
SEARCH=`ldapsearch -xLLL -h ldap -b cn=$1,cn=group1,cn=INTERNAL,cn=DHCP\ Config,dc=instituto,dc=extremadura,dc=es "dhcpHWAddress" 2> /dev/null` | ||
|
||
# If fails, search in group 2 | ||
if [ "$?" -ne 0 ]; then | ||
echo "Can't find $1 in the group 1." | ||
echo "Searching $1 in group 2." | ||
SEARCH=`ldapsearch -xLLL -h ldap -b cn=$1,cn=group2,cn=INTERNAL,cn=DHCP\ Config,dc=instituto,dc=extremadura,dc=es "dhcpHWAddress" 2> /dev/null` | ||
fi | ||
|
||
# If can't find, exit | ||
if [ "$?" -ne 0 ]; then | ||
echo "Can't find the hostname $1." | ||
echo "No WakeOnLAN package was sended to the net." | ||
exit | ||
fi | ||
|
||
MAC=`echo $SEARCH | grep -o '[^ ]*$'` | ||
|
||
echo "Sending WakeOnLan package to $1 with MAC: $MAC" | ||
wakeonlan $MAC |