# Title: RDP Checker for Bash Bunny
# Author: Hak5Darren
# Version: 1.0
# 
# Checks whether RDP is enabled on target machine
# 
# REQUIREMENTS
# impacket installed in /pentest (run tools-installer if not)
#
# LED STATUS
# white (blinking)...dependencies not installed
# purple.............setup
# amber (blinking)...scanning
# red................RDP not enabled
# green..............RDP enabled

# Check for dependencies. If not met, blink white and end.
if [ ! -d /pentest/impacket/ ]; then
  LED R G B 100
  exit 1
fi

# Setup Ethernet
LED R B
ATTACKMODE RNDIS_ETHERNET
# ATTACKMODE ECM_ETHERNET

# Get $TARGET_IP from Bunny Helpers
source bunny_helpers.sh

# Start scan
LED G R 100
/pentest/impacket/examples/rdp_check.py $TARGET_IP >> /tmp/rdp_check

# Check scan results and set LED red or green accordingly
if grep Granted /tmp/rdp_check
then
# RDP is enabled
LED G
else
# RDP is not enabled
LED R
fi
