Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions rpcfiend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ fi

HOST=$1

##### get domain users ######
function get_domain_users(){
DM_RIDS=`rpcclient -U '' -N $HOST -c "querygroupmem 0x201" | sed 's/rid:\[//g' | tr -d ']' | sed 's/attr:\[0x7//g'`
DM_RID_ARRAY=($DM_RIDS)

echo "The array contains ${#DM_RID_ARRAY[@]} items"
echo "+++++++++ DOMAIN Users +++++++++"

#let's use a maxsize of 500 items per query bc too much will result in rpcclient error
maxarraycount=${#DM_RID_ARRAY[@]}
arraystart=0
arrayend=500
arraycount=500
while [ $arrayend -lt $maxarraycount ]; do
echo "Testing from $arraystart to $arrayend"
temparray=(${DM_RID_ARRAY[@]:$arraystart:$arraycount})

#flatten the array into a string
tempstring=`echo "${temparray[@]}"`
rpcclient -U '' -N $HOST -c "samlookuprids domain $tempstring" | cut -d ' ' -f3 | tee -a rpcfiend_domain_users.txt
arraystart=$(( $arraystart + $arraycount ))
arrayend=$(( $arrayend + $arraycount ))
#echo "Arraystart is now $arraystart and Arrayend is now $arrayend"
done

}

##### get domain admins ######
function get_domain_admins(){

Expand Down Expand Up @@ -64,6 +91,7 @@ function get_domain_machines(){

}

get_domain_users
get_domain_admins
get_domain_controllers
get_domain_machines
Expand Down