import time
import random
def simulate_keylogger():
"""Simulate a simple keylogging behavior."""
print("Simulating keylogging... (Press Ctrl+C to stop)")
try:
while True:
# Simulate capturing random key presses
keys = ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l']
key = random.choice(keys)
print(f"Key captured: {key}")
time.sleep(1) # Simulate delay between captures
except KeyboardInterrupt:
print("\nKeylogging simulation stopped.")
def simulate_file_manipulation():
"""Simulate file manipulation behavior."""
file_actions = ['create', 'modify', 'delete']
for _ in range(5): # Simulate 5 actions
action = random.choice(file_actions)
filename = f"malware_file_{random.randint(1, 100)}.txt"
if action == 'create':
print(f"Creating file: {filename}")
elif action == 'modify':
print(f"Modifying file: {filename}")
elif action == 'delete':
print(f"Deleting file: {filename}")
time.sleep(1) # Simulate delay between actions
def simulate_network_scanning():
"""Simulate network scanning behavior."""
print("Simulating network scanning...")
for i in range(1, 4): # Simulate scanning 3 'hosts'
ip_address = f"192.168.1.{i}"
print(f"Scanning {ip_address}...")
time.sleep(2) # Simulate time taken to scan
print(f"Host {ip_address} is active.")
if __name__ == "__main__":
print("Malware Behavior Simulator")
print("1. Simulate Keylogger")
print("2. Simulate File Manipulation")
print("3. Simulate Network Scanning")
choice = input("Select a simulation (1, 2, or 3): ")
if choice == '1':
simulate_keylogger()
elif choice == '2':
simulate_file_manipulation()
elif choice == '3':
simulate_network_scanning()
else:
print("Invalid choice.")