>_ SOC Analyst Command Reference

Essential commands and tools for incident investigation

🔍 Process Investigation

ps aux | grep [process]
Поиск процессов по имени
ps aux | grep nginx
ps aux | grep -i malware
lsof -p [PID]
Открытые файлы процессом
lsof -p 1234
lsof -i :80 # процессы на порту 80
strace -p [PID]
Трассировка системных вызовов
strace -p 1234 -o trace.log
strace -e network -p 1234
pstree -p
Дерево процессов с PID
pstree -p | grep httpd
pstree -p -h 1234

🌐 Network Analysis

netstat -tulpn
Активные сетевые соединения
netstat -tulpn | grep LISTEN
netstat -anp | grep :443
ss -tulpn
Современная альтернатива netstat
ss -tulpn | grep :22
ss -t state established
tcpdump -i [interface]
Захват сетевого трафика
tcpdump -i eth0 -w capture.pcap
tcpdump -i any port 80 -A
iptables -L -n -v
Правила файрвола
iptables -L INPUT -n -v
iptables -A INPUT -s 10.0.0.1 -j DROP

📁 File System Forensics

find / -mtime -1
Файлы изменённые за последние 24 часа
find /var/log -mtime -1 -type f
find / -mmin -60 # за последний час
find / -perm -4000
Файлы с SUID битом
find / -perm -4000 2>/dev/null
find / -perm -2000 # SGID
ls -la /tmp
Проверка временных файлов
ls -la /tmp | grep -E '\.(sh|py|pl)$'
ls -la /dev/shm
stat [file]
Детальная информация о файле
stat /etc/passwd
stat --format=%y /var/log/auth.log

📜 Log Analysis

grep -i 'failed' /var/log/auth.log
Поиск неудачных попыток входа
grep -i 'failed password' /var/log/auth.log | tail -20
grep 'Accepted' /var/log/auth.log
journalctl -u [service]
Логи systemd сервиса
journalctl -u ssh -f
journalctl --since "1 hour ago"
last -f /var/log/wtmp
История входов в систему
last -10
lastb # неудачные попытки
aureport --summary
Отчёт аудита системы
aureport --auth
ausearch -m USER_LOGIN

👤 User Activity

w
Текущие пользователи в системе
w -h
who -a
history
История команд пользователя
history | grep sudo
cat ~/.bash_history
crontab -l
Запланированные задачи
crontab -l -u username
cat /etc/crontab
getent passwd
Список всех пользователей
getent passwd | grep -E 'bash|sh$'
cat /etc/shadow

💾 Memory Forensics

cat /proc/[PID]/maps
Карта памяти процесса
cat /proc/1234/maps | grep heap
cat /proc/1234/environ
strings /proc/[PID]/mem
Строки в памяти процесса
strings /proc/1234/mem | grep password
gcore 1234 # дамп памяти
vmstat 1
Статистика использования памяти
vmstat 1 10
free -h
lsmod
Загруженные модули ядра
lsmod | grep -i vbox
modinfo [module_name]

🔍 Process Analysis

tasklist /v
Список процессов с деталями
tasklist /v /fi "STATUS eq RUNNING"
tasklist /m kernel32.dll
wmic process list brief
Процессы через WMI
wmic process where name="cmd.exe" get processid,parentprocessid,commandline
wmic process get name,processid,parentprocessid
Get-Process | Where-Object
PowerShell анализ процессов
Get-Process | Where-Object {$_.CPU -gt 50}
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
handle.exe
Открытые handles процессов
handle.exe -p chrome.exe
handle.exe file.txt

🌐 Network Commands

netstat -anob
Сетевые соединения с процессами
netstat -anob | findstr :443
netstat -anob | findstr ESTABLISHED
netsh advfirewall show
Правила Windows Firewall
netsh advfirewall firewall show rule name=all
netsh advfirewall set allprofiles state on
arp -a
ARP таблица
arp -a | findstr 192.168
nbtstat -a [IP]
nslookup
DNS запросы
nslookup suspicious-domain.com
nslookup -type=txt domain.com

📋 Event Log Analysis

wevtutil qe Security
Запрос событий безопасности
wevtutil qe Security /c:10 /f:text
wevtutil qe Security "/q:*[System[(EventID=4625)]]"
Get-EventLog -LogName Security
PowerShell анализ логов
Get-EventLog -LogName Security -Newest 100
Get-EventLog -LogName Security | Where-Object {$_.EventID -eq 4625}
Get-WinEvent
Расширенный анализ событий
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624}
Get-WinEvent -ListLog * | Where-Object {$_.RecordCount -gt 0}

🔐 Registry Analysis

reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
Автозапуск программ
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKLM\SYSTEM\CurrentControlSet\Services
Get-ItemProperty
PowerShell чтение реестра
Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run"
Get-ChildItem -Path HKLM:\SOFTWARE -Recurse | Where-Object {$_.Name -match "suspicious"}

👤 User Investigation

net user
Список пользователей
net user administrator
net localgroup administrators
query user
Активные сессии
query user /server:localhost
qwinsta
Get-LocalUser
PowerShell управление пользователями
Get-LocalUser | Where-Object {$_.Enabled -eq $true}
Get-LocalGroupMember -Group "Administrators"

📁 File System

dir /a:h
Скрытые файлы
dir /a:h C:\Users
dir /s /b *.exe | findstr /i "temp"
forfiles /P C:\ /S /D -1
Файлы изменённые за последний день
forfiles /P C:\Windows\Temp /S /D -7 /C "cmd /c echo @path"
forfiles /M *.log /D -30 /C "cmd /c del @path"
Get-ChildItem -Hidden
PowerShell поиск файлов
Get-ChildItem -Path C:\ -Include *.ps1,*.bat -Recurse -ErrorAction SilentlyContinue
Get-ChildItem | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-1)}

🔍 Network Discovery

nmap -sV -sC [target]
Сканирование портов и сервисов
nmap -sV -sC -p- 192.168.1.1
nmap -sn 192.168.1.0/24 # ping sweep
masscan -p1-65535 [target]
Быстрое сканирование портов
masscan -p1-65535 192.168.1.0/24 --rate=1000
masscan -p80,443,445,3389 10.0.0.0/8
arp-scan -l
Обнаружение устройств в локальной сети
arp-scan -l -I eth0
arp-scan 192.168.1.0/24

📡 Traffic Analysis

wireshark -i [interface]
GUI анализатор трафика
wireshark -i eth0 -k
wireshark -r capture.pcap
tshark -i [interface]
CLI версия Wireshark
tshark -i eth0 -f "tcp port 443"
tshark -r file.pcap -Y "http.request"
tcpflow -c
Восстановление TCP сессий
tcpflow -c -i eth0
tcpflow -r capture.pcap

🔒 Security Testing

nikto -h [target]
Сканер веб-уязвимостей
nikto -h https://example.com
nikto -h 192.168.1.1 -p 80,443
sqlmap -u [URL]
Тестирование SQL injection
sqlmap -u "http://site.com/page?id=1"
sqlmap -r request.txt --batch
dirb [URL]
Брутфорс директорий
dirb http://example.com
gobuster dir -u http://site.com -w wordlist.txt

🛠️ Essential SOC Tools

Volatility
Memory forensics framework
YARA
Pattern matching for malware
Autopsy/Sleuth Kit
Disk forensics
Sysmon
Windows system monitoring
OSQuery
SQL-based OS instrumentation
CyberChef
Data transformation tool
Velociraptor
Endpoint visibility tool
GRR
Remote live forensics

🎯 Quick Reference - Common IOCs

Suspicious Processes
cmd.exe spawned by winword.exe
powershell.exe -enc [base64]
svchost.exe from wrong path
rundll32.exe without arguments
Common Ports
4444, 5555 - Metasploit default
1337, 31337 - Common backdoors
6666, 6667 - IRC botnet
3389 - RDP brute force target
Persistence Locations
HKLM\...\Run
%APPDATA%\Microsoft\Windows\Start Menu
Scheduled Tasks
WMI Event Subscriptions
Log Locations
/var/log/auth.log - Linux auth
C:\Windows\System32\winevt\Logs
~/.bash_history
IIS: C:\inetpub\logs\LogFiles