-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexcel_inventory_example_generator_script.py
68 lines (56 loc) · 3.19 KB
/
excel_inventory_example_generator_script.py
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
import pandas as pd
import random
# Numero de equipos generados
num_rows = 200
# Cantidades mínimas y máximas de software por cada equipo
cant_smpe = 1
cant_spe = 5
# Lista de fabricantes para cada categoría
motherboard_manufacturers = ["ASUS", "Gigabyte", "MSI", "ASRock", "Biostar"]
processor_manufacturers = ["Intel", "AMD"]
video_manufacturers = ["NVIDIA", "AMD", "Intel"]
scanner_manufacturers = ["Epson", "Canon", "HP"]
printer_manufacturers = ["HP", "Canon", "Brother"]
# Lista de nombres de software reales
software_names_list = ["Microsoft Office", "Adobe Photoshop", "AutoCAD", "Visual Studio", "Eclipse",
"Google Chrome", "Mozilla Firefox", "Slack", "Skype", "Zoom",
"Spotify", "VLC Media Player", "Dropbox", "OneDrive", "Notepad++",
"WinRAR", "7-Zip", "Git", "Node.js", "Python"]
# Function to generate random hardware data
def generate_hardware_data(num_rows):
hwid = [f"HW{str(i).zfill(4)}" for i in range(1, num_rows+1)]
motherboards = [f"{random.choice(motherboard_manufacturers)}_{random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}_{random.randint(1, 999)}" for _ in range(num_rows)]
processors = [f"{random.choice(processor_manufacturers)}_{random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}_{random.randint(1, 999)}" for _ in range(num_rows)]
ram = [f"{random.choice([4, 8, 16, 32, 64])}GB" for _ in range(num_rows)]
storage = [f"{random.choice([256, 512, 1024, 2048])}GB SSD" for _ in range(num_rows)]
video = [f"{random.choice(video_manufacturers)}_{random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}_{random.randint(1, 999)}" for _ in range(num_rows)]
scanners = [f"{random.choice(scanner_manufacturers)}_{random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}_{random.randint(1, 999)}" if random.random() > 0.25 else None for _ in range(num_rows)]
printers = [f"{random.choice(printer_manufacturers)}_{random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ')}_{random.randint(1, 999)}" if random.random() > 0.25 else None for _ in range(num_rows)]
hardware_data = {
"HWID": hwid,
"Motherboard": motherboards,
"Procesador": processors,
"RAM": ram,
"Almacenamiento": storage,
"Video": video,
"Scanner": scanners,
"Impresoras": printers
}
return pd.DataFrame(hardware_data)
# Function to generate random software data
def generate_software_data(num_rows, hwid_list):
software_data = {"HWID": [], "Nombre": [], "Version": []}
for hwid in hwid_list:
num_softwares = random.randint(cant_smpe,cant_spe)
for _ in range(num_softwares):
software_data["HWID"].append(hwid)
software_data["Nombre"].append(random.choice(software_names_list))
software_data["Version"].append(f"{random.randint(1, 10)}.{random.randint(0, 9)}")
return pd.DataFrame(software_data)
# Generate data
hardware_df = generate_hardware_data(num_rows)
software_df = generate_software_data(num_rows, hardware_df["HWID"].tolist())
# Save to Excel file
with pd.ExcelWriter('inventario_hardware_software.xlsx') as writer:
hardware_df.to_excel(writer, sheet_name='Hardware', index=False)
software_df.to_excel(writer, sheet_name='Software', index=False)