From 71633a70ba1c9cca1fa51ac03c05be53b9b094e9 Mon Sep 17 00:00:00 2001 From: PierreGode Date: Tue, 22 May 2018 13:37:51 +0200 Subject: [PATCH] Update ADconnection.sh --- ADconnection.sh | 170 ------------------------------------------------ 1 file changed, 170 deletions(-) diff --git a/ADconnection.sh b/ADconnection.sh index b24ac8f..b218ea4 100644 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -1026,174 +1026,4 @@ while [ opt != '' ] fi done } -clear -while test $# -gt 0; do - case "$1" in - -h|--help) - readmes - ;; - -d) - if test $# -gt 0; then - linuxclientdebug - else - echo "" - exit 1 - fi - ;; - -l) - if test $? -gt 0; then - DATE=`date +%H:%M` - MENU_FN 2>&1 | sudo tee adconnection.log - else - echo "" - exit 1 - fi - ;; - -j) - if test $# -gt 0; then - sudo realm join -v -U $2 $3 --install=/ - exit - else - echo "" - exit 1 - fi - ;; - -s) - if test $# -gt 0; then - sudo realm discover - exit - else - echo "" - exit 1 - fi - ;; - -o) - if test $# -gt 0; then -desktop=$( sudo apt list --installed | grep -i desktop | grep -i ubuntu | cut -d '-' -f1 | grep -i desktop ) -rasp=$( lsb_release -a | grep -i Distributor | awk '{print $3}' ) -kalilinux=$( lsb_release -a | grep -i Distributor | awk '{print $3}' ) - -if [ "$desktop" = "desktop" ] -then -if [ "$rasp" = "Raspbian" ] -then -echo "${INTRO_TEXT}"Detecting Raspberry Pi"${END}" -raspberry -else -if [ "$kalilinux" = "Kali" ] -then -echo "${INTRO_TEXT}"Detecting Kali linux"${END}" -kalijoin -else -echo "" -fi -fi -else -echo "this seems to be a server, swithching to server mode" -ubuntuserver14 -fi -export HOSTNAME -myhost=$( hostname ) -clear -sudo echo "${RED_TEXT}"Installing pakages do no abort!......."${INTRO_TEXT}" -sudo apt-get -qq install realmd adcli sssd -y -sudo apt-get -qq install ntp -y -sudo apt-get install -f -y -clear -sudo dpkg -l | grep realmd -if [ $? = 0 ] -then -clear -sudo echo "${INTRO_TEXT}"Pakages installed"${END}" -else -clear -sudo echo "${RED_TEXT}"Installing pakages failed.. please check connection ,dpkg and apt-get update then try again."${INTRO_TEXT}" -exit -fi -echo "hostname is $myhost" -echo "Looking for Realms.. please wait" -DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}') -ping -c 2 $DOMAIN >/dev/null -if [ $? = 0 ] -then -clear -echo "${NUMBER}I searched for an available domain and found ${MENU}>>> $DOMAIN <<<${END}${END}" -read -p "Do you wish to use it (y/n)?" yn - case $yn in - [Yy]* ) echo "";; - - [Nn]* ) echo "Please enter the domain you wish to join:" - read -r DOMAIN;; - * ) echo 'Please answer yes or no.';; - esac -else -clear -echo "${NUMBER}I searched for an available domain and found nothing, please type your domain manually below... ${END}" -echo "Please enter the domain you wish to join:" -read -r DOMAIN -fi -NetBios=$(echo $DOMAIN | cut -d '.' -f1) -clear -var=$(lsb_release -a | grep -i release | awk '{print $2}' | cut -d '.' -f1) -if [ "$var" -eq "14" ] -then -echo "Installing additional dependencies" -sudo apt-get -qq install -y realmd sssd sssd-tools samba-common krb5-user -sudo apt-get install -f -y -clear -echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}" -sudo echo "${INTRO_TEXT}"Realm=$DOMAIN"${INTRO_TEXT}" -echo "${INTRO_TEXT}"Joining Ubuntu $var"${END}" -echo "" -echo "${INTRO_TEXT}"Please log in with domain admin to $DOMAIN to connect"${END}" -echo "${INTRO_TEXT}"Please type Admin user:"${END}" -read ADMIN -realm join -v --user="$ADMIN" --computer-ou="$2" $DOMAIN --install=/ -else - if [ "$var" -eq "16" ] - then - echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}" - clear -sudo echo "${INTRO_TEXT}"Realm=$DOMAIN"${INTRO_TEXT}" -echo "${INTRO_TEXT}"Joining Ubuntu $var"${END}" -echo "" -echo "${INTRO_TEXT}"Please log in with domain admin to $DOMAIN to connect"${END}" -echo "${INTRO_TEXT}"Please type Admin user:"${END}" -read ADMIN - realm join -v --user="$ADMIN" --computer-ou="$2" $DOMAIN - else - if [ "$var" -eq "17" ] || [ "$var" -eq "18" ] - then - echo "${INTRO_TEXT}"Detecting Ubuntu $var"${END}" - sleep 1 - clear -sudo echo "${INTRO_TEXT}"Realm=$DOMAIN"${INTRO_TEXT}" -echo "${INTRO_TEXT}"Joining Ubuntu $var"${END}" -echo "" -echo "${INTRO_TEXT}"Please log in with domain admin to $DOMAIN to connect"${END}" -echo "${INTRO_TEXT}"Please type Admin user:"${END}" -read ADMIN - realm join -v --user="$ADMIN" --computer-ou="$2" $DOMAIN --install=/ - else - clear - sudo echo "${RED_TEXT}"I am having issuers to detect your Ubuntu version"${INTRO_TEXT}" - exit - fi - fi -fi -if [ $? -ne 0 ]; then - echo "${RED_TEXT}"AD join failed.please check that computer object is already created and test again "${END}" - exit -fi -fi_auth - else - echo "" - exit 1 - fi - ;; - *) - break - ;; - esac -done MENU_FN