Giter VIP home page Giter VIP logo

agent.py's Introduction

Get-WmiObject -Class Win32_DiskDrive

Ici on liste toutes nos informations disponible (beaucoup)

Pour avoir un résultat intéressant on renvoie seulement ce dont l'on a besoin

Get-WmiObject -Class Win32_DiskDrive | Select-Object -Property Model -Unique | Format-Table -HideTableHeaders

Nous avons de la pollution avec des sauts de lignes... Donc ->

(((output.decode("utf-8").split("\r"))[1]).split("\n"))[1]

On crée notre table SQL pour prendre les données :

CREATE TABLE IF NOT EXISTS `Hardware` (

  `Hostname` varchar(255) NOT NULL,
  `CPU` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `GPU` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `RAM` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `BaseBoard` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `DiskDrive_Model` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `DiskDrive_Size` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `DiskDrive_State` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`Hostname`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `Network` (
  `Hostname` VARCHAR(255) NOT NULL,
  `Domain` VARCHAR(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `SerialNumber` VARCHAR(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `Bios_Releasedate` VARCHAR(255) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`Hostname`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `disk` (
  `Hostname` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `Remaining` int DEFAULT NULL,
  `Total_Size` int DEFAULT NULL,
  `Buzy_Size` int DEFAULT NULL,
  PRIMARY KEY (`Hostname`)
) ENGINE=InnoDB;

Nous avons donc ça comme résultat

Deux noms de PC ne peuvent pas être identique :

Sur un parc informatique c'est normalement basique

Faire une table pour partie réseau, hardware, organisation

  • Réseau
    • IP, MAC
  • Hardware
    • CPU
    • CM
    • GPU
    • RAM
    • Etat des disques
  • Organisation
    • Numéro de série
    • Date du BIOS

Pour hardware :

dico = {
    "Win32_Processor" : "Name",
    "Win32_PhysicalMemory" : "__PROPERTY_COUNT",
    "Win32_BaseBoard" : "Product",
    "Win32_DiskDrive" : "Model",
	"Win32_DiskDrive" : "Size",
	"Win32_DiskDrive" : "Status",
	"Win32_VideoController" : "VideoProcessor",
	"Win32_OperatingSystem" : "Caption"
}

Pour organisation :

dico = {
	"Win32_computersystem" : "Domain",
	"Win32_BIOS" : "SerialNumber",
	"Win32_BIOS" : "releasedate"
}

Pour calcul de disque exact :

commande = ["(Get-Volume -DriveLetter C | Select-Object -ExpandProperty SizeRemaining) / 1GB", "(Get-Volume -DriveLetter C | Select-Object -ExpandProperty Size) / 1GB"]

#Puis 0-1 pour avoir l'espace utilisé (attention on remet en Go, donc les capacités change par rapport au byte)

Versions :

  • V1. Base du code
  • V1.2. Ajout de l'agent network
  • V1.5. Optimisation par dictionnaire
  • V1.6. Ajout de l'agent disk
  • V1.7.Interface WEB, recherche par Hostname
  • V1.8.Calcul d'espace dispo -> visulisation par graph WEB

🛑 Une partie du code (partie Web a été corriger par Copilot)

agent.py's People

Contributors

pitch2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.