performing-linux-log-forensics-investigation
यह क्या करती है
यह टूल आपके Linux सिस्टम की log files जांचता है ताकि यह सुराग मिल सकें कि क्या हुआ था। यह पता लगाने में मदद करता है कि सिस्टम तक किसने, कब और कैसे पहुंच बनाई, इसलिए संदिग्ध गतिविधि या हमले की जांच में यह काम आता है।
कब इस्तेमाल करें
- ✓जब आपको शक हो कि किसी ने आपके Linux server में घुसपैठ की है।
- ✓किसी सुरक्षा घटना की जांच के दौरान, जब पता करना हो कि किसने क्या किया।
- ✓सिस्टम पर हुई एक्सेस हिस्ट्री और चलाए गए कमांड देखने के लिए।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-linux-log-forensics-investigation/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“पिछले 24 घंटों में किसी भी अनधिकृत एक्सेस का पता लगाने के लिए मेरे Linux server के logs का विश्लेषण करो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह auth.log और journal जैसी ज़रूरी log files पढ़ता है और एक्सेस पैटर्न, चलाए गए कमांड और लॉगिन की कोशिशें खोजता है। यह इस जानकारी को व्यवस्थित करता है, ताकि आप घटनाओं का क्रम समझ सकें।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Performing Linux Log Forensics Investigation
Overview
Linux systems maintain extensive logs that serve as primary evidence sources in forensic investigations. Unlike Windows Event Logs, Linux logs are typically plain-text files stored in /var/log/ and binary journal files managed by systemd-journald. Key forensic logs include auth.log (authentication events, sudo usage, SSH sessions), syslog (system-wide messages), kern.log (kernel events), and application-specific logs. The Linux Audit framework (auditd) provides detailed security event logging comparable to Windows Security Event Logs. Forensic analysis of these logs enables investigators to reconstruct user sessions, identify unauthorized access, detect privilege escalation, trace lateral movement, and establish comprehensive event timelines.
When to Use
- When conducting security assessments that involve performing linux log forensics investigation
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with digital forensics concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Key Log Files and Locations
| Log File | Path | Contents |
|---|---|---|
| auth.log / secure | /var/log/auth.log (Debian) or /var/log/secure (RHEL) | Authentication, sudo, SSH, PAM |
| syslog / messages | /var/log/syslog (Debian) or /var/log/messages (RHEL) | General system messages |
| kern.log | /var/log/kern.log | Kernel messages, USB events, driver loads |
| lastlog | /var/log/lastlog | Last login per user (binary) |
| wtmp | /var/log/wtmp | Login/logout records (binary, read with last) |
| btmp | /var/log/btmp | Failed login attempts (binary, read with lastb) |
| faillog | /var/log/faillog | Failed login counter (binary) |
| cron.log | /var/log/cron or /var/log/syslog | Scheduled task execution |
| audit.log | /var/log/audit/audit.log | Linux Audit Framework events |
| journal | /var/log/journal/ or /run/log/journal/ | systemd binary journal |
| dpkg.log | /var/log/dpkg.log | Package installation/removal (Debian) |
| yum.log | /var/log/yum.log | Package installation/removal (RHEL) |
Analysis Techniques
Authentication Log Analysis
# Find all successful SSH logins
grep "Accepted" /var/log/auth.log
# Find failed SSH login attempts
grep "Failed password" /var/log/auth.log
# Extract unique source IPs from failed logins
grep "Failed password" /var/log/auth.log | grep -oP '\d+\.\d+\.\d+\.\d+' | sort -u
# Find sudo command execution
grep "sudo:" /var/log/auth.log | grep "COMMAND"
# Detect brute force patterns (>10 failures from same IP)
grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20
# Find account creation events
grep "useradd\|adduser" /var/log/auth.log
# Detect SSH key authentication
grep "Accepted publickey" /var/log/auth.log
Systemd Journal Analysis
# Export journal in JSON format for forensic processing
journalctl --output=json --no-pager > journal_export.json
# Filter by time range
journalctl --since "2025-02-01" --until "2025-02-15" --output=json > timerange.json
# Filter by unit/service
journalctl -u sshd --output=json > sshd_journal.json
# Show kernel messages (USB events, module loads)
journalctl -k --output=json > kernel_journal.json
# Filter by priority (0=emerg to 7=debug)
journalctl -p err --output=json > errors.json
# Boot-specific logs
journalctl -b 0 --output=json > current_boot.json
journalctl --list-boots # List all recorded boot sessions
Linux Audit Framework Analysis
# Search audit log for specific event types
ausearch -m USER_AUTH --start today
# Search for file access events
ausearch -f /etc/shadow
# Search for process execution
ausearch -m EXECVE --start "02/01/2025" --end "02/28/2025"
# Generate report of login events
aureport --login --start "02/01/2025"
# Generate summary of failed authentications
aureport --auth --failed
# Search for specific user activity
ausearch -ua 1001 # By UID
ausearch -ua username # By username
Cron Job Investigation
# Check system-wide crontab
cat /etc/crontab
# Check user crontabs
ls -la /var/spool/cron/crontabs/
# Review cron execution logs
…
अक्सर पूछे जाने वाले सवाल
यह टूल किस तरह के logs का विश्लेषण करता है?
यह authentication logs (auth.log), system messages (syslog), kernel logs (kern.log), audit logs (auditd) और systemd journal जैसे कई logs का विश्लेषण करता है।
इस संदर्भ में 'forensics' का क्या मतलब है?
Forensics का मतलब है डिजिटल सबूतों, जैसे सिस्टम logs, की मदद से बीती घटनाओं की जांच करना, ताकि समझ आए कि क्या हुआ था। यह कुछ-कुछ पुलिस जांच जैसा है।
क्या इसे इस्तेमाल करने के लिए Linux का एक्सपर्ट होना ज़रूरी है?
एक्सपर्ट होना ज़रूरी नहीं है, लेकिन Linux कैसे काम करता है और logs क्या होते हैं, इसकी बुनियादी समझ नतीजों को समझने में मदद करती है।
जानकारी
लेखक का मूल विवरण
Perform forensic investigation of Linux system logs including syslog, auth.log, systemd journal (via journalctl), kern.log, auditd, and application logs to reconstruct user sessions, identify unauthorized access and privilege escalation, trace lateral movement, and establish event timelines. Use when investigating a suspected compromise of a Linux system and needing to analyze SSH, sudo, cron, or
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #8257
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।