-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrdpScan.nse
69 lines (54 loc) · 1.53 KB
/
rdpScan.nse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#
# rdpScan - scan a network segment for RDP-Server
# author: [email protected]
# requires: fgrep awk nmap
scriptname="rdpScan"
version="1.0"
rdpips="/tmp/tmprdp.$$"
declare -i rdpfound=0
function is_installed {
which $1 > /dev/null 2>&1
if [ $? -ne 0 ]
then
printf "\nERROR: %s not installed.\n\n" $1
exit 255
fi
}
is_installed fgrep
is_installed awk
is_installed nmap
if [ $# -ne 1 ]; then
printf "\n \n"
printf "rdpScan - scan a network segment for RDP-Server \n\n"
printf "version %s by [email protected] \n\n" $version
printf "Usage: %s {target network}\n\n" $scriptname
printf "target network:\n"
printf " can pass hostnames, IP's, networks, etc.\n"
printf " server.company.com, company.com/24, 192.168.0.1/16, 10.0.0-255.1-254\n"
printf "example:\n"
printf " %s 80.187.0.0/24\n\n" $scriptname
exit 255
fi
iprange=$1
printf "\nScanning for RDP-Server..."
nmap -n -P0 -sS -p 3389 -oG - $iprange | fgrep 'Ports: 3389/open/tcp//ms-term-serv///' | awk '{print $2}' > $rdpips
printf "\n\n"
exec 3< $rdpips
echo "*****************"
echo "RDP IP Address"
echo "*****************"
while read rdpip <&3 ; do
rdpfound=$rdpfound+1
printf "%-15s %s\n" $rdpip
done
if [ $rdpfound -eq 0 ] ; then
printf "No RDP-Server found on network target %s. \n\n" $iprange
rm -f $rdpips
exit 255
fi
printf "\n%d RDP-Server found on network target %s.\n" $rdpfound $iprange
printf "Now try ur luck ;)\n"
printf "have fun ;) \n"
rm -f $rdpips
exit 0