-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_testing_dir.py
More file actions
79 lines (68 loc) · 2.75 KB
/
Copy pathsetup_testing_dir.py
File metadata and controls
79 lines (68 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""
Setup script to create a safe testing directory with sample files
Run this before testing the ransomware simulation
"""
import os
# Define the testing directory
TESTING_DIR = r'C:\Users\Vashu\testing'
def create_testing_directory():
"""Create the testing directory if it doesn't exist"""
if not os.path.exists(TESTING_DIR):
os.makedirs(TESTING_DIR)
print(f"✓ Created testing directory: {TESTING_DIR}")
else:
print(f"✓ Testing directory already exists: {TESTING_DIR}")
def create_sample_files():
"""Create sample files of different types for testing"""
sample_files = {
'document1.txt': 'This is a sample text file for testing encryption.',
'document2.txt': 'Another text document with some content.\nMultiple lines here.',
'notes.txt': 'Important notes:\n1. Test encryption\n2. Test decryption\n3. Verify backup',
'report.pdf': 'This is a mock PDF file content (not a real PDF)',
'image1.jpg': 'Mock JPEG image data',
'image2.png': 'Mock PNG image data',
'spreadsheet.xlsx': 'Mock Excel spreadsheet data',
'presentation.docx': 'Mock Word document data',
}
# Create a subdirectory for more complex testing
subdir = os.path.join(TESTING_DIR, 'subfolder')
if not os.path.exists(subdir):
os.makedirs(subdir)
print(f"✓ Created subdirectory: {subdir}")
# Create files in main directory
for filename, content in sample_files.items():
filepath = os.path.join(TESTING_DIR, filename)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"✓ Created: {filename}")
# Create some files in subdirectory
subdir_files = {
'sub_document.txt': 'This is a file in a subdirectory',
'sub_image.png': 'Mock PNG in subfolder',
}
for filename, content in subdir_files.items():
filepath = os.path.join(subdir, filename)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"✓ Created: subfolder/{filename}")
def main():
print("=" * 60)
print("RANSOMWARE SIMULATION - TESTING DIRECTORY SETUP")
print("=" * 60)
print()
create_testing_directory()
print()
create_sample_files()
print()
print("=" * 60)
print("✓ Setup complete!")
print(f"Testing directory: {TESTING_DIR}")
print()
print("IMPORTANT SAFETY NOTES:")
print("- Only files in C:\\Users\\Vashu\\testing will be affected")
print("- Make sure your backend server is running before testing")
print("- The encryption key will be saved in the testing directory")
print("- Keep the encryption key safe for decryption testing")
print("=" * 60)
if __name__ == "__main__":
main()