create-case 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
create_case/__init__.py
ADDED
|
File without changes
|
create_case/main.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import string
|
|
3
|
+
import argparse
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
import getpass
|
|
6
|
+
import ctypes
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
CONFIG = {"local": ["Pictures", "Readers", "Exports"], "external": ["Extractions", "Readers"], "nas": ["Extractions", "Pictures", "Readers", "Exports"], "onedrive": ["Pictures", "Exports"]}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def list_drives():
|
|
13
|
+
drives = []
|
|
14
|
+
for letter in string.ascii_uppercase:
|
|
15
|
+
drive = f"{letter}:\\"
|
|
16
|
+
if os.path.exists(drive):
|
|
17
|
+
drives.append(drive)
|
|
18
|
+
return drives
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_external_drive(drive_path):
|
|
22
|
+
DRIVE_REMOVABLE = 2
|
|
23
|
+
drive_type = ctypes.windll.kernel32.GetDriveTypeW(drive_path)
|
|
24
|
+
return drive_type == DRIVE_REMOVABLE
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def ask_for_drive():
|
|
28
|
+
drives = list_drives()
|
|
29
|
+
for idx, drv in enumerate(drives, 1):
|
|
30
|
+
print(f"{idx}. {drv}")
|
|
31
|
+
|
|
32
|
+
choice = input("Select drive: ")
|
|
33
|
+
try:
|
|
34
|
+
return drives[int(choice) - 1]
|
|
35
|
+
except:
|
|
36
|
+
print("Invalid choice")
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def create_folders(base_path, folder_list):
|
|
41
|
+
for folder in folder_list:
|
|
42
|
+
path = os.path.join(base_path, folder)
|
|
43
|
+
try:
|
|
44
|
+
os.makedirs(path, exist_ok=True)
|
|
45
|
+
except Exception as e:
|
|
46
|
+
print(f"Failed to create {path}: {e}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def create_drive_case(case_folder):
|
|
50
|
+
drive = ask_for_drive()
|
|
51
|
+
if not drive:
|
|
52
|
+
return
|
|
53
|
+
|
|
54
|
+
if is_external_drive(drive):
|
|
55
|
+
folder_list = CONFIG["external"]
|
|
56
|
+
else:
|
|
57
|
+
folder_list = CONFIG["local"]
|
|
58
|
+
|
|
59
|
+
base_path = os.path.join(drive, case_folder)
|
|
60
|
+
create_folders(base_path, folder_list)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def create_nas(year, case):
|
|
64
|
+
base = rf"\\192.168.9.10\Case Archive\Case-Forensic\{year}\F-{year}-{case}"
|
|
65
|
+
create_folders(base, CONFIG["nas"])
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def create_onedrive(year, case):
|
|
69
|
+
user = getpass.getuser()
|
|
70
|
+
base = rf"C:\Users\{user}\OneDrive\Documents\Forensic Reports\{year}\F-{year}-{case}"
|
|
71
|
+
create_folders(base, CONFIG["onedrive"])
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def main():
|
|
75
|
+
parser = argparse.ArgumentParser()
|
|
76
|
+
parser.add_argument("case", nargs="?", type=int, default=1)
|
|
77
|
+
parser.add_argument("-y", "--year", type=int, default=datetime.now().year)
|
|
78
|
+
args = parser.parse_args()
|
|
79
|
+
|
|
80
|
+
year = args.year
|
|
81
|
+
case = str(args.case).zfill(3)
|
|
82
|
+
case_folder_local = f"F-{year}-{case}"
|
|
83
|
+
|
|
84
|
+
print("1. OneDrive")
|
|
85
|
+
print("2. NAS")
|
|
86
|
+
print("3. External Drive Scan")
|
|
87
|
+
choice = input("Choose the location to create the case folder: ").strip()
|
|
88
|
+
|
|
89
|
+
if choice == "1":
|
|
90
|
+
create_onedrive(year, case)
|
|
91
|
+
elif choice == "2":
|
|
92
|
+
create_nas(year, case)
|
|
93
|
+
elif choice == "3":
|
|
94
|
+
create_drive_case(case_folder_local)
|
|
95
|
+
|
|
96
|
+
print("Goodbye!")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
main()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: create-case
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary:
|
|
5
|
+
Author: 6vi7ms
|
|
6
|
+
Author-email: 6vi7ms@gmail.com
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
create_case/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
create_case/main.py,sha256=pJ0nSKE5Rp_rDv5AqAv5tOMIo3Sk9h6vOAjp3XXwzBE,2692
|
|
3
|
+
create_case-0.1.1.dist-info/entry_points.txt,sha256=1lZOql3d9uL6dLob0UfSOxdmLferZqswlNTXM7EWplc,53
|
|
4
|
+
create_case-0.1.1.dist-info/METADATA,sha256=ab70MrURPAfEykl-RfA5ot-iI2C1HWBaa5HwczKJ3q0,327
|
|
5
|
+
create_case-0.1.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
6
|
+
create_case-0.1.1.dist-info/RECORD,,
|