**************************************** ****************************************
RTCS v1.10
Remote Telnet Configure Script, by zzzEVAzzz
Welcome to visite www.isgrey.com
Usage:
Cscript c: \ scriptpath \ RTCS. vbe targetIP username password NTLMAuthor telnetport
It will auto change state of target telnet server.
**************************************** ****************************************
Description: windows Script for remotely enabling/disabling the target telnet service.
Feature: whether the target ipc $ is enabled or not.
Principle: directly access the target windows Management Specification Service (WMI ). This service is an important system service and is started by default.
Supported platforms: win2kpro win2kserver winxp win.net
Usage:
Use the script cscript.exe in the command line to call the script. For example:
C: \> cscript RTCS. vbe <target IP address> <username> <password> <NTLM authentication method> <telnet Service port>
The NTLM value can be 0, 1, 2:
0: NTLM authentication is not used;
1: First try NTLM authentication. If the password fails, use the user name and password;
2: Only NTLM authentication is used.
The empty password is represented by two double quotes.
The script automatically checks the target telnet service. If it is not started, it is started. Otherwise, it is disabled.
Run the same command twice to enable/disable the service once.
When you disable the service, you must enter a total of five parameters to restore the service to the default value (NTLM = 2, port 23) as needed ).
If the telnet service is disabled, it is automatically changed to "Manual ".
If you want to use it locally, the IP address is 127.0.0.1 or a point (expressed by.). The user name and password are empty (expressed ).
This script is free software, and the change and release should be written by the original author. Thank you for your cooperation.
I provide limited technical support. If you have any questions, please send me a short message on the forum. My ID is zzzevazzz
Last Updated: 2002-8-23
Update record:
1.10 changed the output display format.
1.09 solve the problem of empty passwords.
1.08 The code is encrypted and released as a test version.
1.07 added the function of "disabling" services.
1.06 solve the problem of running on the GUI.
1.05 make a simple judgment on the parameters to prevent misoperation.
1.04 added the Usage display and detailed process functions.
1.03 added the function of disabling services.
1.02 added the manual port setting and NTLM function.
1.00 complete basic functions, remotely start the telnet service, and set NTLM = 1.
Copy codeThe Code is as follows:
On error resume next
Set outstreem = wscript. stdout
If (lcase (right (wscript. fullname, 11) = "wscript.exe") then
Set objShell = wscript. createObject ("wscript. shell ")
ObjShell. Run ("cmd.exe/k cscript // nologo" & chr (34) & wscript. scriptfullname & chr (34 ))
Wscript. quit
End if
If wscript. arguments. count <5 then
Usage ()
Wscript. echo "Not enough parameters ."
Wscript. quit
End if
Ipaddress = wscript. arguments (0)
Username = wscript. arguments (1)
Password = wscript. arguments (2)
Ntlm = wscript. arguments (3)
Port = wscript. arguments (4)
If not isnumeric (ntlm) or ntlm <0 or ntlm> 2 then
Usage ()
Wscript. echo "The value of NTML is wrong ."
Wscript. quit
End if
If not isnumeric (port) then
Usage ()
Wscript. echo "The value of port is wrong ."
Wscript. quit
End if
Usage ()
Outstreem. write "Conneting" & ipaddress &"...."
Set objlocator = createobject ("wbemscripting. swbemlocator ")
Set objswbemservices = objlocator. connectserver (ipaddress, "root/default", username, password)
Showerror (err. number)
Outstreem. write "Setting NTLM =" & ntlm &"...."
Set objinstance = objswbemservices. get ("stdregprov ")
Set objmethod = objinstance. methods _ ("SetDWORDvalue ")
Set objinparam = objmethod. inparameters. spawninstance _()
Objinparam. hdefkey = & h80000002
Objinparam. ssubkeyname = "SOFTWARE \ Microsoft \ TelnetServer \ 1.0"
Objinparam. svaluename = "NTLM"
Objinparam. uvalue = ntlm
Set objoutparam1_objinstance.exe cmethod _ ("SetDWORDvalue", objinparam)
Showerror (objoutparam. returnvalue)
Outstreem. write "Setting port =" & port &"...."
Objinparam. svaluename = "TelnetPort"
Objinparam. uvalue = port
Set objoutparam1_objinstance.exe cmethod _ ("SetDWORDvalue", objinparam)
Showerror (objoutparam. returnvalue)
Outstreem. write "Querying state of telnet server ...."
Set objswbemservices = objlocator. connectserver (ipaddress, "root \ cimv2", username, password)
Set colinstances=objswbemservices.exe cquery ("select * from win32_service where name = 'tlntsvr '")
Showerror (err. number)
For each objinstance in colinstances
If objinstance. startmode = "Disabled" then
Outstreem. write "Telnet server has been disabled. Now changeing start mode to manual ...."
Set objmethod = objinstance. methods _ ("changestartmode ")
Set objinparam = objmethod. inparameters. spawninstance _()
Objinparam. startmode = "Manual"
Set objoutparam1_objinstance.exe cmethod _ ("changestartmode", objinparam)
Showerror (objoutparam. returnvalue)
End if
Outstreem. write "Changeing state ...."
If objinstance. started = true then
Intstatus = objinstance. stopservice ()
Showerror (intstatus)
Wscript. echo "Target telnet server has been STOP Successfully ."
Else
Intstatus = objinstance. startservice ()
Showerror (intstatus)
Wscript. echo "Target telnet server has been START Successfully! "
Wscript. echo "Now, you can try: telnet" & ipaddress & "& port &", to get a shell ."
End if
Next
Function showerror (errornumber)
If errornumber <> 0 then
Wscript. echo "Error! "
Wscript. quit
Else
Wscript. echo "OK! "
End if
End function
Function usage ()
Wscript. echo string (79 ,"*")
Wscript. echo "RTCS v1.10"
Wscript. echo "Remote Telnet Configure Script, by zzzEVAzzz"
Wscript. echo "Welcome to visite www.isgrey.com"
Wscript. echo "Usage :"
Wscript. echo "cscript" & wscript. scriptfullname & "targetIP username password NTLMAuthor telnetport"
Wscript. echo "It will auto change state of target telnet server ."
Wscript. echo string (79, "*") & vbcrlf
End function