Recovering Deleted Files With Photorec
Overview
Cybersecurity skill for recovering deleted files with photorec. Follows industry best practices and security standards.
When to Use
Trigger phrases:
"recovering deleted files with photorec"
"Recover deleted files from disk images and storage media using PhotoRec's file s"
When recovering deleted files from a forensic disk image or storage device
When the file system is corrupted, formatted, or overwritten
During investigations requiring recovery of documents, images, videos, or databases
When file system metadata is unavailable but raw data sectors remain intact
For recovering files from memory cards, USB drives, and hard drives
When NOT to Use
- When you lack proper authorization for testing
- For production systems without change management
- When the task requires legal or compliance expertise beyond technical scope
Prerequisites
- PhotoRec installed (part of TestDisk suite)
- Forensic disk image or direct device access (read-only)
- Sufficient output storage space (potentially larger than source)
- Write-blocker if working with original media
- Root/sudo privileges for device access
- Knowledge of target file types for focused recovery
Workflow
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Define Objectives — Clarify the goals and scope for deleted files.
- Gather Resources — Collect tools, data, and access needed for deleted files.
- Execute Process — Carry out deleted files operations methodically.
- Verify Quality — Check results against acceptance criteria.
- Document Outcomes — Record findings, decisions, and next steps.
Tools
- photorec — Primary tool for this skill
- Analysis Platform — Data processing and visualization
- Collaboration Tools — Team coordination and knowledge sharing
Process
- Prepare — Gather requirements, verify prerequisites, set up environment
- Execute — Run recovering deleted files with photorec workflow with configured parameters
- Verify — Validate output meets requirements, document results
Verification
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: recovering-deleted-files-with-photorec3description: Use when recover deleted files from disk images and storage media using PhotoRec's file signature-based carving engine regardless of file system damage. Use when working with recovering deleted files with photorec.4license: Apache-2.05---67# Recovering Deleted Files With Photorec89## Overview1011Cybersecurity skill for recovering deleted files with photorec. Follows industry best practices and security standards.1213## When to Use14**Trigger phrases:**15- "recovering deleted files with photorec"16- "Recover deleted files from disk images and storage media using PhotoRec's file s"1718- When recovering deleted files from a forensic disk image or storage device19- When the file system is corrupted, formatted, or overwritten20- During investigations requiring recovery of documents, images, videos, or databases21- When file system metadata is unavailable but raw data sectors remain intact22- For recovering files from memory cards, USB drives, and hard drives232425## When NOT to Use2627- When you lack proper authorization for testing28- For production systems without change management29- When the task requires legal or compliance expertise beyond technical scope303132## Prerequisites33- PhotoRec installed (part of TestDisk suite)34- Forensic disk image or direct device access (read-only)35- Sufficient output storage space (potentially larger than source)36- Write-blocker if working with original media37- Root/sudo privileges for device access38- Knowledge of target file types for focused recovery3940## Workflow4142```python43# Example: IOC detection44import re4546IOC_PATTERNS = {47 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",48 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",49 "hash_md5": r"\b[a-f0-9]{32}\b",50 "hash_sha256": r"\b[a-f0-9]{64}\b",51}5253def extract_iocs(text: str) -> dict:54 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}55```56571. **Define Objectives** — Clarify the goals and scope for deleted files.582. **Gather Resources** — Collect tools, data, and access needed for deleted files.593. **Execute Process** — Carry out deleted files operations methodically.604. **Verify Quality** — Check results against acceptance criteria.615. **Document Outcomes** — Record findings, decisions, and next steps.6263## Tools6465- **photorec** — Primary tool for this skill66- **Analysis Platform** — Data processing and visualization67- **Collaboration Tools** — Team coordination and knowledge sharing686970## Process71721. **Prepare** — Gather requirements, verify prerequisites, set up environment731. **Execute** — Run recovering deleted files with photorec workflow with configured parameters741. **Verify** — Validate output meets requirements, document results7576## Verification7778- [ ] All deleted files procedures executed completely and documented79- [ ] Findings validated against multiple data sources80- [ ] False positives identified and filtered81- [ ] Results documented with evidence and timestamps82- [ ] Recommendations provided with risk-based prioritization8384## Anti-Rationalization Table8586| Rationalization | Reality |87|---|---|88| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |89| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |90| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |