Enhanced iOS Forensics with Artificial Intelligence
Comprehensive documentation of the iLEAPP AI API for developers
The iLEAPP AI API provides a comprehensive set of tools for integrating AI-powered forensic analysis capabilities into your applications. This reference documents all the available modules, classes, and methods that you can use to interact with iLEAPP AI programmatically.
Note: This API reference assumes you have a basic understanding of Python programming and digital forensics concepts. If you're new to iLEAPP AI, we recommend starting with the Getting Started guide.
To use the iLEAPP AI API in your Python code, you first need to import the necessary modules:
from ileapp_ai import Analyzer, LLMClient
from ileapp_ai.analyzers import MessageAnalyzer, AppUsageAnalyzer
from ileapp_ai.security import ChainOfCustody
from ileapp_ai.visualization import TimelineGenerator
A basic example of using the API to analyze iOS messages:
from ileapp_ai import Analyzer, LLMClient
# Initialize the LLM client with your API key
llm_client = LLMClient(provider="openrouter", api_key="your_api_key")
# Create an analyzer instance
analyzer = Analyzer(llm_client=llm_client)
# Analyze iOS messages
results = analyzer.analyze_artifact(
artifact_path="/path/to/sms.db",
artifact_type="messages",
analysis_depth="comprehensive"
)
# Print the results
print(results.summary)
print(results.insights)
# Generate a report
report = analyzer.generate_report(results, output_format="html")
print(f"Report generated at: {report.path}")
The Analyzer class is the main entry point for the iLEAPP AI API. It provides methods for analyzing iOS artifacts and generating reports.
Constructor for the Analyzer class.
| Name | Type | Description |
|---|---|---|
| llm_client | LLMClient | An instance of the LLMClient class for communicating with AI models. |
| config | dict, optional | Configuration options for the analyzer. Defaults to None. |
from ileapp_ai import Analyzer, LLMClient
llm_client = LLMClient(provider="openrouter", api_key="your_api_key")
analyzer = Analyzer(llm_client=llm_client)
Analyzes an iOS artifact using AI capabilities.
| Name | Type | Description |
|---|---|---|
| artifact_path | str | Path to the artifact file or directory. |
| artifact_type | str | Type of artifact (e.g., "messages", "app_usage", "browser_history"). |
| analysis_depth | str, optional | Depth of analysis: "basic", "standard", or "comprehensive". Defaults to "standard". |
| options | dict, optional | Additional options for the analysis. Defaults to None. |
AnalysisResult: An object containing the analysis results, including summary, insights, and raw data.
results = analyzer.analyze_artifact(
artifact_path="/path/to/sms.db",
artifact_type="messages",
analysis_depth="comprehensive"
)
Analyzes multiple artifacts from an iOS case directory.
| Name | Type | Description |
|---|---|---|
| case_path | str | Path to the case directory containing multiple artifacts. |
| artifacts | list, optional | List of artifact types to analyze. If None, analyzes all supported artifacts. |
| analysis_depth | str, optional | Depth of analysis: "basic", "standard", or "comprehensive". Defaults to "standard". |
| options | dict, optional | Additional options for the analysis. Defaults to None. |
CaseAnalysisResult: An object containing the analysis results for all artifacts, including cross-artifact correlations.
case_results = analyzer.analyze_case(
case_path="/path/to/case_directory",
artifacts=["messages", "app_usage", "browser_history"],
analysis_depth="comprehensive"
)
Generates a report from analysis results.
| Name | Type | Description |
|---|---|---|
| analysis_result | AnalysisResult or CaseAnalysisResult | The result object from analyze_artifact or analyze_case. |
| output_format | str, optional | Format of the report: "html", "pdf", or "json". Defaults to "html". |
| template | str, optional | Path to a custom report template. Defaults to None (uses built-in template). |
| output_path | str, optional | Path where the report should be saved. Defaults to None (auto-generated). |
Report: An object containing information about the generated report, including its path.
report = analyzer.generate_report(
analysis_result=results,
output_format="pdf",
output_path="/path/to/output/report.pdf"
)
The LLMClient class provides an interface for communicating with various AI models through different providers.
Constructor for the LLMClient class.
| Name | Type | Description |
|---|---|---|
| provider | str | The AI provider to use: "openrouter", "anthropic", "openai", or "local". |
| api_key | str, optional | API key for the provider. Not required for "local" provider. |
| model | str, optional | Specific model to use. If None, uses the provider's default model. |
| config | dict, optional | Additional configuration options for the client. Defaults to None. |
from ileapp_ai import LLMClient
# Using OpenRouter
client = LLMClient(
provider="openrouter",
api_key="your_openrouter_api_key",
model="anthropic/claude-3-opus-20240229"
)
# Using a local model
local_client = LLMClient(
provider="local",
model="llama-3-70b"
)
Analyzes text using the configured AI model.
| Name | Type | Description |
|---|---|---|
| text | str | The text to analyze. |
| prompt | str, optional | Custom prompt to guide the analysis. Defaults to None (uses standard prompt). |
| options | dict, optional | Additional options for the analysis. Defaults to None. |
dict: The analysis result from the AI model.
result = client.analyze_text(
text="Hello, how are you doing today?",
prompt="Analyze the sentiment and tone of this message."
)
Analyzes structured data (JSON, dict, etc.) using the configured AI model.
| Name | Type | Description |
|---|---|---|
| data | dict or list | The structured data to analyze. |
| prompt | str, optional | Custom prompt to guide the analysis. Defaults to None (uses standard prompt). |
| options | dict, optional | Additional options for the analysis. Defaults to None. |
dict: The analysis result from the AI model.
app_usage_data = [
{"app": "Messages", "duration": 3600, "timestamp": "2025-04-01T12:00:00"},
{"app": "Safari", "duration": 1800, "timestamp": "2025-04-01T13:00:00"},
{"app": "Camera", "duration": 300, "timestamp": "2025-04-01T15:00:00"}
]
result = client.analyze_structured_data(
data=app_usage_data,
prompt="Identify patterns in this app usage data."
)
The ArtifactProcessor classes handle the extraction and preprocessing of different types of iOS artifacts before they are analyzed by AI models.
Factory method to get the appropriate processor for a given artifact type.
| Name | Type | Description |
|---|---|---|
| artifact_type | str | Type of artifact (e.g., "messages", "app_usage", "browser_history"). |
ArtifactProcessor: An instance of the appropriate processor class.
from ileapp_ai.processors import get_processor
processor = get_processor("messages")
processed_data = processor.process("/path/to/sms.db")
iLEAPP AI includes specialized analyzers for different types of iOS artifacts. These analyzers extend the base Analyzer class with artifact-specific functionality.
The MessageAnalyzer class provides specialized analysis for iOS messages and conversations.
Constructor for the MessageAnalyzer class.
| Name | Type | Description |
|---|---|---|
| llm_client | LLMClient | An instance of the LLMClient class for communicating with AI models. |
| config | dict, optional | Configuration options for the analyzer. Defaults to None. |
from ileapp_ai import LLMClient
from ileapp_ai.analyzers import MessageAnalyzer
llm_client = LLMClient(provider="openrouter", api_key="your_api_key")
message_analyzer = MessageAnalyzer(llm_client=llm_client)
Analyzes conversations from iOS messages data.
| Name | Type | Description |
|---|---|---|
| messages_data | dict or list | Processed messages data from a MessageProcessor. |
| options | dict, optional | Additional options for the analysis. Defaults to None. |
ConversationAnalysisResult: An object containing the analysis results for conversations.
from ileapp_ai.processors import get_processor
processor = get_processor("messages")
messages_data = processor.process("/path/to/sms.db")
conversation_results = message_analyzer.analyze_conversations(messages_data)
The visualization module provides tools for creating visual representations of forensic data and analysis results.
Constructor for the TimelineGenerator class, which creates interactive timelines from forensic data.
| Name | Type | Description |
|---|---|---|
| config | dict, optional | Configuration options for the timeline generator. Defaults to None. |
from ileapp_ai.visualization import TimelineGenerator
timeline_generator = TimelineGenerator()
Generates an interactive timeline from a list of events.
| Name | Type | Description |
|---|---|---|
| events | list | List of event dictionaries, each with at least 'timestamp' and 'description' keys. |
| output_path | str, optional | Path where the timeline should be saved. Defaults to None (auto-generated). |
| options | dict, optional | Additional options for the timeline generation. Defaults to None. |
Timeline: An object containing information about the generated timeline, including its path.
events = [
{
"timestamp": "2025-04-01T12:00:00",
"description": "Message sent to John",
"type": "message",
"details": {"recipient": "John", "content": "Hello"}
},
{
"timestamp": "2025-04-01T12:05:00",
"description": "Opened Safari",
"type": "app_usage",
"details": {"app": "Safari", "duration": 300}
}
]
timeline = timeline_generator.generate_timeline(
events=events,
output_path="/path/to/output/timeline.html"
)
The report generation module provides tools for creating comprehensive forensic reports from analysis results.
Constructor for the ReportGenerator class.
| Name | Type | Description |
|---|---|---|
| config | dict, optional | Configuration options for the report generator. Defaults to None. |
from ileapp_ai.reporting import ReportGenerator
report_generator = ReportGenerator()
Generates a report from analysis results.
| Name | Type | Description |
|---|---|---|
| analysis_results | dict or AnalysisResult | The analysis results to include in the report. |
| template | str, optional | Path to a custom report template. Defaults to None (uses built-in template). |
| output_format | str, optional | Format of the report: "html", "pdf", or "json". Defaults to "html". |
| output_path | str, optional | Path where the report should be saved. Defaults to None (auto-generated). |
| options | dict, optional | Additional options for the report generation. Defaults to None. |
Report: An object containing information about the generated report, including its path.
from ileapp_ai import Analyzer, LLMClient
from ileapp_ai.reporting import ReportGenerator
llm_client = LLMClient(provider="openrouter", api_key="your_api_key")
analyzer = Analyzer(llm_client=llm_client)
results = analyzer.analyze_artifact("/path/to/sms.db", "messages")
report_generator = ReportGenerator()
report = report_generator.generate_report(
analysis_results=results,
output_format="pdf",
output_path="/path/to/output/report.pdf"
)
The security module provides tools for maintaining forensic integrity and chain of custody.
Constructor for the ChainOfCustody class, which tracks all actions performed on forensic data.
| Name | Type | Description |
|---|---|---|
| case_id | str | Unique identifier for the case. |
| investigator | str, optional | Name or ID of the investigator. Defaults to None. |
| config | dict, optional | Configuration options for the chain of custody. Defaults to None. |
from ileapp_ai.security import ChainOfCustody
chain_of_custody = ChainOfCustody(
case_id="CASE-2025-001",
investigator="John Doe"
)
Logs an action in the chain of custody.
| Name | Type | Description |
|---|---|---|
| action | str | Description of the action performed. |
| artifact | str, optional | The artifact affected by the action. Defaults to None. |
| details | dict, optional | Additional details about the action. Defaults to None. |
str: The ID of the logged action.
action_id = chain_of_custody.log_action(
action="Analyzed messages",
artifact="/path/to/sms.db",
details={"analysis_depth": "comprehensive", "model": "claude-3-opus"}
)
iLEAPP AI is designed to be extensible. You can create custom analyzers, processors, and report templates to suit your specific needs.
For detailed information on extending iLEAPP AI, please refer to the Integration Guide.
Note: This API reference is for iLEAPP AI version 1.0.0. Future versions may include additional functionality and changes to the API.