当前位置: > shell编程 >

判断windows 3389端口和linux操作系统的脚本

时间:2014-09-10 19:05来源:linux.it.net.cn 作者:it

判断windows 3389端口和linux操作系统的脚本

复制代码代码如下:

#!/bin/bash
###by gavin
##date:2012-10-12
##This is about scan windows and linux system,it can create remote'files that you use it on windows. you just only copy or mv this *.rdp  files to "C:\Documents and Settings\Administrator\My Documents" ,Okey you can use command "msts" ,seeing IP that can be remoted
##
cat>>rmote<<EOF
screen mode id:i:2
desktopwidth:i:1680
desktopheight:i:1050
session bpp:i:32
winposstr:s:0,1,22,200,822,800
compression:i:1
keyboardhook:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
disable full window drag:i:1
allow desktop composition:i:0
allow font smoothing:i:0
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:IP
audiomode:i:0
redirectprinters:i:1
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:0
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
username:s:administrator
EOF
#for i in {1..254};do
# cat 255.rdp>$IP.$i.rdp
# sed -i s/IP/$IP.$i.rdp/ ./$IP.$i.rdp
#done
IP=`ifconfig eth0 |grep "inet addr"| cut -f 2 -d ":"|cut -f 1 -d " "|awk -F. '{print $1"."$2"."$3}'`
PORT=3389
for I in {1..254};do
   nmap -sS $IP.$I -p 3389|grep open
if [ $? == 0 ];then
echo "$IP.$I:$PORT" >>./windows.txt
cat rmote >$IP.$I.rdp
sed -i 's/IP/$IP.$I/g' ./$IP.$I.rdp
fi
nmap -sS $IP.$I -p 22|grep open
if [ $? == 0 ];then
echo "$IP.$I" >>linux.txt
fi
done
echo "The windows.txt is windows system'ip,and it's 3389 port is opened !!"
echo "The linux.txt is linux system'ip,and it

 

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容