[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AFWJJV9SARY3W4727TN0YE":3,"skill-same:01M6AFWJJV9SARY3W4727TN0YE":130},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":71,"commitSha":72,"skillDirectory":73,"forksCount":74,"repositoryHtmlUrl":75,"repositoryHomepageUrl":76,"ownerHtmlUrl":77,"ownerBlogUrl":78,"ownerDescription":79,"updatedAt":80,"install":81,"resources":94},"01M6AFWJJV9SARY3W4727TN0YE","performing-linux-log-forensics-investigation","Linux 日志取证调查","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 kernel-level activity from plain-text or systemd journal logs.","对 Linux 系统日志（包括 syslog、auth.log、systemd journal（通过 journalctl）、kern.log、auditd 和应用日志）进行取证调查，以重建用户会话、识别未授权访问和权限提升、追踪横向移动并建立事件时间线。适用于调查疑似 Linux 系统被入侵、需要分析来自纯文本或 systemd journal 日志中的 SSH、sudo、cron 或内核级活动时使用。","mukul975\u002FAnthropic-Cybersecurity-Skills","mukul975","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42860185?v=4","01M6ADEQR8T5M4EEG6C67BQCWF","Mahipal","01M6ADJPMYWG1E5GM1FWBE3128",36146,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR4MYFKGCC4WCWVJ50KJ2C","安全工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C9JZH3GWXPJ6CQG5P7J48Y","数字取证与电子证据分析","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"performing linux log forensics investigation","forensics","investigation","linux","t1074","ssh-forensics","linux-logs","journalctl","systemd-journal","auth-log","analysis","syslog","digital-forensics","log-analysis","linux-forensics","auditd","logs","audit","auth","cybersecurity","2026-11-10 10:12:30",false,"---\nname: performing-linux-log-forensics-investigation\ndescription: Perform forensic investigation of Linux system logs including syslog,\n  auth.log, systemd journal (via journalctl), kern.log, auditd, and application logs\n  to reconstruct user sessions, identify unauthorized access and privilege escalation,\n  trace lateral movement, and establish event timelines. Use when investigating a\n  suspected compromise of a Linux system and needing to analyze SSH, sudo, cron, or\n  kernel-level activity from plain-text or systemd journal logs.\ndomain: cybersecurity\nsubdomain: digital-forensics\ntags:\n- linux-forensics\n- syslog\n- auth-log\n- systemd-journal\n- journalctl\n- linux-logs\n- ssh-forensics\n- cron\n- audit-log\n- log-analysis\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- RS.AN-03\n- DE.AE-02\n- RS.MA-01\nmitre_attack:\n- T1005\n- T1074\n- T1119\n- T1070\n- T1059\n---\n\n# Performing Linux Log Forensics Investigation\n\n## Overview\n\nLinux 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 \u002Fvar\u002Flog\u002F 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.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing linux log forensics investigation\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Familiarity with digital forensics concepts and tools\n- Access to a test or lab environment for safe execution\n- Python 3.8+ with required dependencies installed\n- Appropriate authorization for any testing activities\n\n## Key Log Files and Locations\n\n| Log File | Path | Contents |\n|----------|------|----------|\n| auth.log \u002F secure | \u002Fvar\u002Flog\u002Fauth.log (Debian) or \u002Fvar\u002Flog\u002Fsecure (RHEL) | Authentication, sudo, SSH, PAM |\n| syslog \u002F messages | \u002Fvar\u002Flog\u002Fsyslog (Debian) or \u002Fvar\u002Flog\u002Fmessages (RHEL) | General system messages |\n| kern.log | \u002Fvar\u002Flog\u002Fkern.log | Kernel messages, USB events, driver loads |\n| lastlog | \u002Fvar\u002Flog\u002Flastlog | Last login per user (binary) |\n| wtmp | \u002Fvar\u002Flog\u002Fwtmp | Login\u002Flogout records (binary, read with `last`) |\n| btmp | \u002Fvar\u002Flog\u002Fbtmp | Failed login attempts (binary, read with `lastb`) |\n| faillog | \u002Fvar\u002Flog\u002Ffaillog | Failed login counter (binary) |\n| cron.log | \u002Fvar\u002Flog\u002Fcron or \u002Fvar\u002Flog\u002Fsyslog | Scheduled task execution |\n| audit.log | \u002Fvar\u002Flog\u002Faudit\u002Faudit.log | Linux Audit Framework events |\n| journal | \u002Fvar\u002Flog\u002Fjournal\u002F or \u002Frun\u002Flog\u002Fjournal\u002F | systemd binary journal |\n| dpkg.log | \u002Fvar\u002Flog\u002Fdpkg.log | Package installation\u002Fremoval (Debian) |\n| yum.log | \u002Fvar\u002Flog\u002Fyum.log | Package installation\u002Fremoval (RHEL) |\n\n## Analysis Techniques\n\n### Authentication Log Analysis\n\n```bash\n# Find all successful SSH logins\ngrep \"Accepted\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Find failed SSH login attempts\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Extract unique source IPs from failed logins\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log | grep -oP '\\d+\\.\\d+\\.\\d+\\.\\d+' | sort -u\n\n# Find sudo command execution\ngrep \"sudo:\" \u002Fvar\u002Flog\u002Fauth.log | grep \"COMMAND\"\n\n# Detect brute force patterns (>10 failures from same IP)\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20\n\n# Find account creation events\ngrep \"useradd\\|adduser\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Detect SSH key authentication\ngrep \"Accepted publickey\" \u002Fvar\u002Flog\u002Fauth.log\n```\n\n### Systemd Journal Analysis\n\n```bash\n# Export journal in JSON format for forensic processing\njournalctl --output=json --no-pager > journal_export.json\n\n# Filter by time range\njournalctl --since \"2025-02-01\" --until \"2025-02-15\" --output=json > timerange.json\n\n# Filter by unit\u002Fservice\njournalctl -u sshd --output=json > sshd_journal.json\n\n# Show kernel messages (USB events, module loads)\njournalctl -k --output=json > kernel_journal.json\n\n# Filter by priority (0=emerg to 7=debug)\njournalctl -p err --output=json > errors.json\n\n# Boot-specific logs\njournalctl -b 0 --output=json > current_boot.json\njournalctl --list-boots  # List all recorded boot sessions\n```\n\n### Linux Audit Framework Analysis\n\n```bash\n# Search audit log for specific event types\nausearch -m USER_AUTH --start today\n\n# Search for file access events\nausearch -f \u002Fetc\u002Fshadow\n\n# Search for process execution\nausearch -m EXECVE --start \"02\u002F01\u002F2025\" --end \"02\u002F28\u002F2025\"\n\n# Generate report of login events\naureport --login --start \"02\u002F01\u002F2025\"\n\n# Generate summary of failed authentications\naureport --auth --failed\n\n# Search for specific user activity\nausearch -ua 1001  # By UID\nausearch -ua username  # By username\n```\n\n### Cron Job Investigation\n\n```bash\n# Check system-wide crontab\ncat \u002Fetc\u002Fcrontab\n\n# Check user crontabs\nls -la \u002Fvar\u002Fspool\u002Fcron\u002Fcrontabs\u002F\n\n# Review cron execution logs\ngrep \"CRON\" \u002Fvar\u002Flog\u002Fsyslog\n\n# Check for at\u002Fbatch jobs\nls -la \u002Fvar\u002Fspool\u002Fat\u002F\natq\n```\n\n## Python Forensic Log Parser\n\n```python\nimport re\nimport json\nimport sys\nimport os\nfrom datetime import datetime\nfrom collections import defaultdict\n\n\nclass LinuxLogForensicAnalyzer:\n    \"\"\"Analyze Linux system logs for forensic investigation.\"\"\"\n\n    def __init__(self, log_dir: str, output_dir: str):\n        self.log_dir = log_dir\n        self.output_dir = output_dir\n        os.makedirs(output_dir, exist_ok=True)\n\n    def parse_auth_log(self, auth_log_path: str) -> dict:\n        \"\"\"Parse auth.log for authentication events.\"\"\"\n        events = {\n            \"successful_logins\": [],\n            \"failed_logins\": [],\n            \"sudo_commands\": [],\n            \"account_changes\": [],\n            \"ssh_sessions\": []\n        }\n\n        ssh_accepted = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sshd\\[\\d+\\]:\\s+Accepted\\s+(\\S+)\\s+for\\s+(\\S+)\\s+from\\s+([\\d.]+)'\n        )\n        ssh_failed = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sshd\\[\\d+\\]:\\s+Failed\\s+password\\s+for\\s+(\\S*)\\s+from\\s+([\\d.]+)'\n        )\n        sudo_cmd = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sudo:\\s+(\\S+)\\s+:.*COMMAND=(.*)'\n        )\n        useradd = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+useradd\\[\\d+\\]:\\s+new user: name=(\\S+)'\n        )\n\n        with open(auth_log_path, \"r\", errors=\"replace\") as f:\n            for line in f:\n                m = ssh_accepted.search(line)\n                if m:\n                    events[\"successful_logins\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"method\": m.group(3), \"user\": m.group(4), \"source_ip\": m.group(5)\n                    })\n                    continue\n\n                m = ssh_failed.search(line)\n                if m:\n                    events[\"failed_logins\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"user\": m.group(3), \"source_ip\": m.group(4)\n                    })\n                    continue\n\n                m = sudo_cmd.search(line)\n                if m:\n                    events[\"sudo_commands\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"user\": m.group(3), \"command\": m.group(4).strip()\n                    })\n                    continue\n\n                m = useradd.search(line)\n                if m:\n                    events[\"account_changes\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"new_user\": m.group(3)\n                    })\n\n        return events\n\n    def detect_brute_force(self, auth_events: dict, threshold: int = 10) -> list:\n        \"\"\"Detect brute force attempts from auth log data.\"\"\"\n        ip_failures = defaultdict(int)\n        for event in auth_events.get(\"failed_logins\", []):\n            ip_failures[event[\"source_ip\"]] += 1\n\n        brute_force = []\n        for ip, count in ip_failures.items():\n            if count >= threshold:\n                brute_force.append({\"source_ip\": ip, \"failed_attempts\": count})\n\n        return sorted(brute_force, key=lambda x: x[\"failed_attempts\"], reverse=True)\n\n    def generate_report(self, auth_log_path: str) -> str:\n        \"\"\"Generate comprehensive forensic analysis report.\"\"\"\n        auth_events = self.parse_auth_log(auth_log_path)\n        brute_force = self.detect_brute_force(auth_events)\n\n        report = {\n            \"analysis_timestamp\": datetime.now().isoformat(),\n            \"log_source\": auth_log_path,\n            \"summary\": {\n                \"successful_logins\": len(auth_events[\"successful_logins\"]),\n                \"failed_logins\": len(auth_events[\"failed_logins\"]),\n                \"sudo_commands\": len(auth_events[\"sudo_commands\"]),\n                \"account_changes\": len(auth_events[\"account_changes\"]),\n                \"brute_force_sources\": len(brute_force)\n            },\n            \"brute_force_detected\": brute_force,\n            \"auth_events\": auth_events\n        }\n\n        report_path = os.path.join(self.output_dir, \"linux_log_forensics.json\")\n        with open(report_path, \"w\") as f:\n            json.dump(report, f, indent=2)\n\n        print(f\"[*] Successful logins: {report['summary']['successful_logins']}\")\n        print(f\"[*] Failed logins: {report['summary']['failed_logins']}\")\n        print(f\"[*] Sudo commands: {report['summary']['sudo_commands']}\")\n        print(f\"[*] Brute force sources: {report['summary']['brute_force_sources']}\")\n        return report_path\n\n\ndef main():\n    if len(sys.argv) \u003C 3:\n        print(\"Usage: python process.py \u003Cauth_log_path> \u003Coutput_dir>\")\n        sys.exit(1)\n    analyzer = LinuxLogForensicAnalyzer(os.path.dirname(sys.argv[1]), sys.argv[2])\n    analyzer.generate_report(sys.argv[1])\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## References\n\n- Linux Forensics In Depth: https:\u002F\u002Famr-git-dot.github.io\u002Fforensic%20investigation\u002FLinux_Forensics\u002F\n- SANS Practical Linux Forensics: https:\u002F\u002Fnostarch.com\u002Flinuxforensics\n- HackTricks Linux Forensics: https:\u002F\u002Fbook.hacktricks.xyz\u002Fgeneric-methodologies-and-resources\u002Fbasic-forensic-methodology\u002Flinux-forensics\n- Log Sources for Digital Forensics: https:\u002F\u002Fletsdefend.io\u002Fblog\u002Flog-sources-for-digital-forensics-windows-and-linux\n","# Performing Linux Log Forensics Investigation\n\n## Overview\n\nLinux 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 \u002Fvar\u002Flog\u002F 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.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing linux log forensics investigation\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Familiarity with digital forensics concepts and tools\n- Access to a test or lab environment for safe execution\n- Python 3.8+ with required dependencies installed\n- Appropriate authorization for any testing activities\n\n## Key Log Files and Locations\n\n| Log File | Path | Contents |\n|----------|------|----------|\n| auth.log \u002F secure | \u002Fvar\u002Flog\u002Fauth.log (Debian) or \u002Fvar\u002Flog\u002Fsecure (RHEL) | Authentication, sudo, SSH, PAM |\n| syslog \u002F messages | \u002Fvar\u002Flog\u002Fsyslog (Debian) or \u002Fvar\u002Flog\u002Fmessages (RHEL) | General system messages |\n| kern.log | \u002Fvar\u002Flog\u002Fkern.log | Kernel messages, USB events, driver loads |\n| lastlog | \u002Fvar\u002Flog\u002Flastlog | Last login per user (binary) |\n| wtmp | \u002Fvar\u002Flog\u002Fwtmp | Login\u002Flogout records (binary, read with `last`) |\n| btmp | \u002Fvar\u002Flog\u002Fbtmp | Failed login attempts (binary, read with `lastb`) |\n| faillog | \u002Fvar\u002Flog\u002Ffaillog | Failed login counter (binary) |\n| cron.log | \u002Fvar\u002Flog\u002Fcron or \u002Fvar\u002Flog\u002Fsyslog | Scheduled task execution |\n| audit.log | \u002Fvar\u002Flog\u002Faudit\u002Faudit.log | Linux Audit Framework events |\n| journal | \u002Fvar\u002Flog\u002Fjournal\u002F or \u002Frun\u002Flog\u002Fjournal\u002F | systemd binary journal |\n| dpkg.log | \u002Fvar\u002Flog\u002Fdpkg.log | Package installation\u002Fremoval (Debian) |\n| yum.log | \u002Fvar\u002Flog\u002Fyum.log | Package installation\u002Fremoval (RHEL) |\n\n## Analysis Techniques\n\n### Authentication Log Analysis\n\n```bash\n# Find all successful SSH logins\ngrep \"Accepted\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Find failed SSH login attempts\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Extract unique source IPs from failed logins\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log | grep -oP '\\d+\\.\\d+\\.\\d+\\.\\d+' | sort -u\n\n# Find sudo command execution\ngrep \"sudo:\" \u002Fvar\u002Flog\u002Fauth.log | grep \"COMMAND\"\n\n# Detect brute force patterns (>10 failures from same IP)\ngrep \"Failed password\" \u002Fvar\u002Flog\u002Fauth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20\n\n# Find account creation events\ngrep \"useradd\\|adduser\" \u002Fvar\u002Flog\u002Fauth.log\n\n# Detect SSH key authentication\ngrep \"Accepted publickey\" \u002Fvar\u002Flog\u002Fauth.log\n```\n\n### Systemd Journal Analysis\n\n```bash\n# Export journal in JSON format for forensic processing\njournalctl --output=json --no-pager > journal_export.json\n\n# Filter by time range\njournalctl --since \"2025-02-01\" --until \"2025-02-15\" --output=json > timerange.json\n\n# Filter by unit\u002Fservice\njournalctl -u sshd --output=json > sshd_journal.json\n\n# Show kernel messages (USB events, module loads)\njournalctl -k --output=json > kernel_journal.json\n\n# Filter by priority (0=emerg to 7=debug)\njournalctl -p err --output=json > errors.json\n\n# Boot-specific logs\njournalctl -b 0 --output=json > current_boot.json\njournalctl --list-boots  # List all recorded boot sessions\n```\n\n### Linux Audit Framework Analysis\n\n```bash\n# Search audit log for specific event types\nausearch -m USER_AUTH --start today\n\n# Search for file access events\nausearch -f \u002Fetc\u002Fshadow\n\n# Search for process execution\nausearch -m EXECVE --start \"02\u002F01\u002F2025\" --end \"02\u002F28\u002F2025\"\n\n# Generate report of login events\naureport --login --start \"02\u002F01\u002F2025\"\n\n# Generate summary of failed authentications\naureport --auth --failed\n\n# Search for specific user activity\nausearch -ua 1001  # By UID\nausearch -ua username  # By username\n```\n\n### Cron Job Investigation\n\n```bash\n# Check system-wide crontab\ncat \u002Fetc\u002Fcrontab\n\n# Check user crontabs\nls -la \u002Fvar\u002Fspool\u002Fcron\u002Fcrontabs\u002F\n\n# Review cron execution logs\ngrep \"CRON\" \u002Fvar\u002Flog\u002Fsyslog\n\n# Check for at\u002Fbatch jobs\nls -la \u002Fvar\u002Fspool\u002Fat\u002F\natq\n```\n\n## Python Forensic Log Parser\n\n```python\nimport re\nimport json\nimport sys\nimport os\nfrom datetime import datetime\nfrom collections import defaultdict\n\n\nclass LinuxLogForensicAnalyzer:\n    \"\"\"Analyze Linux system logs for forensic investigation.\"\"\"\n\n    def __init__(self, log_dir: str, output_dir: str):\n        self.log_dir = log_dir\n        self.output_dir = output_dir\n        os.makedirs(output_dir, exist_ok=True)\n\n    def parse_auth_log(self, auth_log_path: str) -> dict:\n        \"\"\"Parse auth.log for authentication events.\"\"\"\n        events = {\n            \"successful_logins\": [],\n            \"failed_logins\": [],\n            \"sudo_commands\": [],\n            \"account_changes\": [],\n            \"ssh_sessions\": []\n        }\n\n        ssh_accepted = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sshd\\[\\d+\\]:\\s+Accepted\\s+(\\S+)\\s+for\\s+(\\S+)\\s+from\\s+([\\d.]+)'\n        )\n        ssh_failed = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sshd\\[\\d+\\]:\\s+Failed\\s+password\\s+for\\s+(\\S*)\\s+from\\s+([\\d.]+)'\n        )\n        sudo_cmd = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+sudo:\\s+(\\S+)\\s+:.*COMMAND=(.*)'\n        )\n        useradd = re.compile(\n            r'(\\w+\\s+\\d+\\s+[\\d:]+)\\s+(\\S+)\\s+useradd\\[\\d+\\]:\\s+new user: name=(\\S+)'\n        )\n\n        with open(auth_log_path, \"r\", errors=\"replace\") as f:\n            for line in f:\n                m = ssh_accepted.search(line)\n                if m:\n                    events[\"successful_logins\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"method\": m.group(3), \"user\": m.group(4), \"source_ip\": m.group(5)\n                    })\n                    continue\n\n                m = ssh_failed.search(line)\n                if m:\n                    events[\"failed_logins\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"user\": m.group(3), \"source_ip\": m.group(4)\n                    })\n                    continue\n\n                m = sudo_cmd.search(line)\n                if m:\n                    events[\"sudo_commands\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"user\": m.group(3), \"command\": m.group(4).strip()\n                    })\n                    continue\n\n                m = useradd.search(line)\n                if m:\n                    events[\"account_changes\"].append({\n                        \"timestamp\": m.group(1), \"host\": m.group(2),\n                        \"new_user\": m.group(3)\n                    })\n\n        return events\n\n    def detect_brute_force(self, auth_events: dict, threshold: int = 10) -> list:\n        \"\"\"Detect brute force attempts from auth log data.\"\"\"\n        ip_failures = defaultdict(int)\n        for event in auth_events.get(\"failed_logins\", []):\n            ip_failures[event[\"source_ip\"]] += 1\n\n        brute_force = []\n        for ip, count in ip_failures.items():\n            if count >= threshold:\n                brute_force.append({\"source_ip\": ip, \"failed_attempts\": count})\n\n        return sorted(brute_force, key=lambda x: x[\"failed_attempts\"], reverse=True)\n\n    def generate_report(self, auth_log_path: str) -> str:\n        \"\"\"Generate comprehensive forensic analysis report.\"\"\"\n        auth_events = self.parse_auth_log(auth_log_path)\n        brute_force = self.detect_brute_force(auth_events)\n\n        report = {\n            \"analysis_timestamp\": datetime.now().isoformat(),\n            \"log_source\": auth_log_path,\n            \"summary\": {\n                \"successful_logins\": len(auth_events[\"successful_logins\"]),\n                \"failed_logins\": len(auth_events[\"failed_logins\"]),\n                \"sudo_commands\": len(auth_events[\"sudo_commands\"]),\n                \"account_changes\": len(auth_events[\"account_changes\"]),\n                \"brute_force_sources\": len(brute_force)\n            },\n            \"brute_force_detected\": brute_force,\n            \"auth_events\": auth_events\n        }\n\n        report_path = os.path.join(self.output_dir, \"linux_log_forensics.json\")\n        with open(report_path, \"w\") as f:\n            json.dump(report, f, indent=2)\n\n        print(f\"[*] Successful logins: {report['summary']['successful_logins']}\")\n        print(f\"[*] Failed logins: {report['summary']['failed_logins']}\")\n        print(f\"[*] Sudo commands: {report['summary']['sudo_commands']}\")\n        print(f\"[*] Brute force sources: {report['summary']['brute_force_sources']}\")\n        return report_path\n\n\ndef main():\n    if len(sys.argv) \u003C 3:\n        print(\"Usage: python process.py \u003Cauth_log_path> \u003Coutput_dir>\")\n        sys.exit(1)\n    analyzer = LinuxLogForensicAnalyzer(os.path.dirname(sys.argv[1]), sys.argv[2])\n    analyzer.generate_report(sys.argv[1])\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## References\n\n- Linux Forensics In Depth: https:\u002F\u002Famr-git-dot.github.io\u002Fforensic%20investigation\u002FLinux_Forensics\u002F\n- SANS Practical Linux Forensics: https:\u002F\u002Fnostarch.com\u002Flinuxforensics\n- HackTricks Linux Forensics: https:\u002F\u002Fbook.hacktricks.xyz\u002Fgeneric-methodologies-and-resources\u002Fbasic-forensic-methodology\u002Flinux-forensics\n- Log Sources for Digital Forensics: https:\u002F\u002Fletsdefend.io\u002Fblog\u002Flog-sources-for-digital-forensics-windows-and-linux\n",{"name":5,"tags":56,"author":59,"domain":50,"license":16,"version":60,"nist_csf":61,"subdomain":43,"description":7,"mitre_attack":65},[45,42,40,39,38,37,36,57,58,44],"cron","audit-log","mahipal","1.0",[62,63,64],"RS.AN-03","DE.AE-02","RS.MA-01",[66,67,68,69,70],"T1005","T1074","T1119","T1070","T1059","main","54a798831d2266a3ca61ce68a7acb80b81160d57","skills\u002Fperforming-linux-log-forensics-investigation",4425,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","https:\u002F\u002Fmahipal.engineer\u002FAnthropic-Cybersecurity-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fmukul975","Mahipal.engineer","🔐 Cybersecurity | 💻 Dev | 📷 Street Photographer\r\n🎓 MSc | 📚 Research & AI Security","2026-08-31 12:32:44",{"source":9,"skillName":5,"commands":82,"prompt":92,"zipAvailable":93},[83,86,89],{"tool":84,"command":85},"npx","npx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill performing-linux-log-forensics-investigation",{"tool":87,"command":88},"bunx","bunx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill performing-linux-log-forensics-investigation",{"tool":90,"command":91},"pnpm","pnpm dlx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill performing-linux-log-forensics-investigation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002FSKILL.md",true,[95,101,106,112,116,120,126],{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"assets\u002Ftemplate.md","ASSET","资产文件",399,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Fassets\u002Ftemplate.md",{"path":102,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":104,"sourceHtmlUrl":105},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002FLICENSE",{"path":107,"resourceType":108,"resourceTypeDesc":109,"sizeBytes":110,"sourceHtmlUrl":111},"references\u002Fapi-reference.md","REFERENCE","参考文档",1710,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Freferences\u002Fapi-reference.md",{"path":113,"resourceType":108,"resourceTypeDesc":109,"sizeBytes":114,"sourceHtmlUrl":115},"references\u002Fstandards.md",660,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Freferences\u002Fstandards.md",{"path":117,"resourceType":108,"resourceTypeDesc":109,"sizeBytes":118,"sourceHtmlUrl":119},"references\u002Fworkflows.md",634,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Freferences\u002Fworkflows.md",{"path":121,"resourceType":122,"resourceTypeDesc":123,"sizeBytes":124,"sourceHtmlUrl":125},"scripts\u002Fagent.py","SCRIPT","脚本",6838,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Fscripts\u002Fagent.py",{"path":127,"resourceType":122,"resourceTypeDesc":123,"sizeBytes":128,"sourceHtmlUrl":129},"scripts\u002Fprocess.py",2160,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-linux-log-forensics-investigation\u002Fscripts\u002Fprocess.py",[131,163,192,224,251,283],{"skillNo":132,"name":133,"nameZh":134,"description":135,"descriptionZh":136,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":137,"categories":138,"keywords":143,"publishedAt":51},"01M6AGDM3HJXTKXX15ZZ0ZVCJ3","verifying-build-provenance-with-slsa-sigstore","SLSA 构建来源验证","Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI\u002FCD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.","使用 Sigstore 的 cosign（verify、verify-attestation、verify-blob-attestation）和 slsa-verifier（verify-artifact）验证工件签名和 SLSA 来源（provenance），强制校验 keyless OIDC 构建者身份和源仓库是否符合 SLSA Build 级别。适用于 CI\u002FCD 中部署工件前、消费第三方证明时、建立 SLSA Build L3 管道，或在事件响应或准入控制期间确认来源的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fverifying-build-provenance-with-slsa-sigstore\u002FSKILL.md",[139,140],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":141,"categoryName":142,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C32Q37WAMK06SGMFC02VFP","软件供应链安全",[144,145,146,147,148,50,149,150,151,152,153,154,155,156,157,158,159,160,161,162],"sigstore","provenance","slsa","verifying build provenance with slsa sigstore","security","incident response","identity","pr","code","artifacts","ci","supply-chain","pipeline","supply-chain-security","t1195","attestation","code-signing","cosign","keyless",{"skillNo":164,"name":165,"nameZh":166,"description":167,"descriptionZh":168,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":169,"categories":170,"keywords":175,"publishedAt":51},"01M6AGDGBPWYVZ2F11GFKJ4HZ9","validating-tpm-measured-boot-attestation","TPM 测量启动验证","Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote\u002Ftpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware\u002Fkernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.","使用 tpm2-tools 验证 TPM 2.0 测量启动（measured boot）的完整性和远程证明：读取 PCR（tpm2_pcrread）、重放启动事件日志、生成并检查签名报价（tpm2_quote\u002Ftpm2_checkquote），以及将机密封印（seal）到 PCR 策略。适用于确认系统已启动可信固件\u002F内核以实现零信任（Zero Trust）设备状态、通过 PCR 漂移检测启动链篡改，或构建黄金值基线用于机群（fleet）证明。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-tpm-measured-boot-attestation\u002FSKILL.md",[171,172],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":173,"categoryName":174,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C89JJEXGGRGHS6XVXDA46K","终端安全加固",[176,159,177,178,148,179,50,151,180,181,182,183,184,185,186,187,188,189,190,191],"boot","TPM","validating tpm measured boot attestation","policy","verification","ZeRO","firmware","Tools","measured-boot","PCR","integrity","secrets","remote-attestation","tpm2-tools","integrity-verification","trusted-computing",{"skillNo":193,"name":194,"nameZh":195,"description":196,"descriptionZh":197,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":198,"categories":199,"keywords":206,"publishedAt":51},"01M6AGDCW0Y4FXZ3362GT1941M","validating-backup-integrity-for-recovery","备份完整性验证","Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable\u002Fair-gapped backups for silent corruption or tampering.","通过加密哈希验证、自动化恢复测试、损坏检测和可恢复性检查来验证备份完整性，确认备份对于灾难恢复和勒索软件响应是可靠的。适用于在依赖备份进行恢复之前、构建备份后验证管道、审计备份基础设施以满足合规要求，或检查不可变\u002Fair-gapped（气隙）备份是否存在静默损坏或篡改的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[200,203],{"categoryNo":201,"categoryName":202,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师",{"categoryNo":204,"categoryName":205,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSSTY86MWS6W5GDQWB1ADQ","备份与灾难恢复",[186,207,208,209,210,50,211,212,180,213,214,215,216,217,218,219,220,221,222,223],"backup","recovery","validating backup integrity for recovery","testing","infrastructure","validation","compliance","hash-verification","incident-response","ransomware","cryptocurrency","detection","t1078","t1490","immutable","disaster-recovery","restore-testing",{"skillNo":225,"name":226,"nameZh":227,"description":228,"descriptionZh":229,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":230,"categories":231,"keywords":234,"publishedAt":51},"01M6AGD9GBG2KZ336AE763J3WH","triaging-windows-with-kape","KAPE Windows 取证收集","Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment\u002Ftriage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.","运行 KAPE（Kroll Artifact Parser and Extractor），通过 Targets 收集目标取证工件（注册表配置单元、$MFT、事件日志、prefetch、浏览器数据），并使用封装 Eric Zimmerman 的 EZ Tools（PECmd、MFTECmd、RECmd）的 Modules 进行解析。适用于事件遏制\u002F分诊早期阶段——此时完整磁盘镜像不切实际，但需要快速获得可采信、可解析的 Windows 工件集，包括大规模远程收集。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-windows-with-kape\u002FSKILL.md",[232,233],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[235,236,237,50,238,239,47,240,241,242,243,244,245,246,43,247,183,248,249,250],"windows","kape","triaging windows with kape","registry","browser","windows-forensics","dfir","mft","mftecmd","data","prefetch","eric-zimmerman","SET","collection","pecmd","artifact-collection",{"skillNo":252,"name":253,"nameZh":254,"description":255,"descriptionZh":256,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":257,"categories":258,"keywords":263,"publishedAt":51},"01M6AGD5PW5J4EVZM958WD74ZQ","triaging-vulnerabilities-with-ssvc-framework","SSVC 漏洞优先级分诊","Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track\u002FTrack*\u002FAttend\u002FAct decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.","使用 CISA 的 Stakeholder-Specific Vulnerability Categorization（SSVC，利益相关方特定漏洞分类）决策树对漏洞进行分诊和优先级排序，权衡利用状态（通过 CISA KEV 目录和 FIRST EPSS API）、技术影响、自动化程度和任务普遍性，输出 Track\u002FTrack*\u002FAttend\u002FAct 决策。适用于对漏洞扫描结果（OpenVAS、Nessus、Qualys）进行优先级排序以制定修复计划，而不局限于原始 CVSS 分数的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[259,262],{"categoryNo":260,"categoryName":261,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQV98CYQ7TEW2D1MRQ00TE","安全公告与漏洞管理",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[264,265,266,50,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282],"vulnerabilities","framework","triaging vulnerabilities with ssvc framework","status","planning","CISA","vulnerability-management","risk-management","nessus","qualys","openvas","cvss","remediation","risk","vulnerability","api","prioritization","ssvc","decision-tree",{"skillNo":284,"name":285,"nameZh":286,"description":287,"descriptionZh":288,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":289,"categories":290,"keywords":295,"publishedAt":51},"01M6AGD24TTQQM4CXG69E3B9TJ","triaging-security-incident","安全事件初步分诊","Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM\u002FEDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.","使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初步分诊，分类事件类型、按业务影响分配优先级，并路由到相应的响应团队。适用于 SIEM\u002FEDR 告警需要人工分类、并发告警必须确定优先级，或用户报告或威胁情报 IOC 匹配需要初步事件分类的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-security-incident\u002FSKILL.md",[291,292],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":293,"categoryName":294,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTHYSJPJ500X64JJ5CH06D","安全事件响应与威胁狩猎",[148,296,50,297,298,299,300,301,302,303,304,219,305,220,41,306,307,308,309,310],"triaging security incident","siem","file","ioc","soc","NIST-800-61","NIST","severity","edr","execution","classification","severity-classification","incident-triage","SANS-PICERL","SOC-operations"]