Last active
March 21, 2018 11:42
-
-
Save richardsonlima/24e597a0ff21fd19f0ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
### sudo apt-get install cifs-utils | |
#set -x | |
LinuxLocalUser=$(whoami) | |
Base="/home/$LinuxLocalUser" | |
BaseSub="/home/$LinuxLocalUser/WinShare" | |
Download="/home/$LinuxLocalUser/Downloads" | |
File="SysinternalsSuite.zip" | |
function MakeEnv(){ | |
for dirs in $Base/{WinShare} | |
do | |
[ ! -d "$dirs" ] && \ | |
echo -e '\033[1;31m [!] Creating environment directory \033[0m' && \ | |
mkdir -p "$dirs" | |
sudo chown -R $LinuxLocalUser:$LinuxLocalUser $Base/* | |
done | |
for subdirs in $BaseSub/{c_mount,sysinternals_tools} | |
do | |
[ ! -d "$subdirs" ] && \ | |
echo -e '\033[1;31m [!] Creating environment subdirectory \033[0m' && \ | |
mkdir -p "$subdirs" | |
done | |
if [ -f "$Download/$File" ] | |
then | |
echo -e '\033[1;33m [!] File SysInternal Suite found. \033[0m' | |
else | |
echo -e '\033[1;31m [!] File SysInternal Suite not found!!! \033[0m' | |
echo -e '\033[1;31m [!] Waiting a moment !!! \033[0m'; sleep 3 | |
wget -P $Download/ https://download.sysinternals.com/files/SysinternalsSuite.zip | |
sudo cp $Download/SysinternalsSuite.zip $Base/WinShare/sysinternals_tools/ | |
sudo unzip $Base/WinShare/sysinternals_tools/SysinternalsSuite.zip -d $Base/WinShare/sysinternals_tools/ | |
fi | |
} | |
function Interact(){ | |
echo -en "\033[1;32m [+] Enter Windows Server Ip address: \n \033[0m" | |
read WinSrvIp | |
echo -en "\033[1;32m [+] Enter Windows Server UserName: \n \033[0m" | |
read WinUser | |
echo -en "\033[1;32m [+] Enter Domain Name: \n \033[0m" | |
read WinDomain | |
echo -en "\033[1;32m [+] Enter Windows Server User Password: \n \033[0m" | |
read -s Passwd | |
} | |
function WinRemoteAccess(){ | |
sudo mount.cifs -o username=$WinUser,password=$Passwd,rw,file_mode=0777,dir_mode=0777 //$WinSrvIp/c\$ /home/$LinuxLocalUser/WinShare/c_mount | |
if [[ $? -ne 0 ]]; then | |
sudo apt-get install cifs-utils | |
exit 1 | |
fi | |
rdesktop -g 1024x768 $WinSrvIp -d $WinDomain -u $WinUser -p $Passwd -r disk:tools=/home/$LinuxLocalUser/WinShare/sysinternals_tools | |
if [[ $? -ne 0 ]]; then | |
sudo apt-get install rdesktop | |
exit 1 | |
fi | |
} | |
# Call Functions | |
MakeEnv | |
Interact | |
WinRemoteAccess |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment