Digital Forensics Artifact Generator

import random
from datetime import datetime, timedelta

def generate_artifacts(num_logs, num_history, num_files):
"""Generate log entries, browser history, and file metadata."""
logs, history, metadata = [], [], []

urls = [
"http://example.com",
"http://malicious-site.com",
"http://banking-site.com",
"http://socialmedia.com",
"http://shopping-site.com"
]

for i in range(num_logs):
timestamp = datetime.now() - timedelta(days=random.randint(1, 30), hours=random.randint(0, 23))
logs.append(f"{timestamp.strftime('%Y-%m-%d %H:%M:%S')} - INFO - User logged in")

for i in range(num_history):
timestamp = datetime.now() - timedelta(days=random.randint(1, 30), hours=random.randint(0, 23))
duration = random.randint(1, 300)
url = random.choice(urls)
history.append(f"{timestamp.strftime('%Y-%m-%d %H:%M:%S')} - {url} - {duration} seconds")

for i in range(num_files):
filename = f"file_{i+1}.txt"
created_time = datetime.now() - timedelta(days=random.randint(1, 30))
modified_time = created_time + timedelta(days=random.randint(0, 10))
size = random.randint(1000, 50000)
metadata.append(f"Filename: {filename}, Created: {created_time}, Modified: {modified_time}, Size: {size} bytes")

return logs, history, metadata

def save_artifacts(logs, history, metadata):
"""Save artifacts to files."""
with open("log_entries.txt", "w") as log_file:
log_file.write("\n".join(logs))
with open("browser_history.txt", "w") as history_file:
history_file.write("\n".join(history))
with open("file_metadata.txt", "w") as metadata_file:
metadata_file.write("\n".join(metadata))

def main():
print("Digital Forensics Artifact Generator")

num_logs = int(input("Enter the number of log entries to generate: "))
num_history = int(input("Enter the number of browser history entries to generate: "))
num_files = int(input("Enter the number of file metadata entries to generate: "))

logs, history, metadata = generate_artifacts(num_logs, num_history, num_files)
save_artifacts(logs, history, metadata)

print("\nArtifacts generated and saved to 'log_entries.txt', 'browser_history.txt', and 'file_metadata.txt'.")

if __name__ == "__main__":
main()