Remove API key From Console

master
Sebastian Serfling 2023-10-25 11:02:50 +02:00
parent 6203846cf7
commit 7b3136a642
2 changed files with 4 additions and 2 deletions

View File

@ -122,6 +122,7 @@ class CL_SET_HOST(BaseModel):
hddfree: str
hddused: str
hddtotal: str
netvolumeuser: str
class CL_GET_CPU(BaseModel):
hostname: str
@ -148,6 +149,7 @@ class CL_UPDATE_HOST(BaseModel):
hddfree: str
hddused: str
hddtotal: str
netvolumeuser: str
class CL_SET_LASTLOGON_USER(BaseModel):
userID: int

View File

@ -115,7 +115,7 @@ async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get
@app.post("/host/set")
async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
database(f"INSERT INTO `{get.dbname}`.Clients (`Host-Name`,Username,`IP-Adresse`,`Windows-Version`,`CPU-Name`,`Prozessor-Anzahl`,RAM,Speichergesamt,Speicherfrei,Speicherbelegt) VALUES ('{get.hostname}','{get.user}','{get.ipadresse}','{get.winver}','{get.cpuname}','{get.cores}','{get.ram}','{get.hddtotal}','{get.hddfree}','{get.hddused}')","","")
database(f"INSERT INTO `{get.dbname}`.Clients (`Host-Name`,Username,`IP-Adresse`,`Windows-Version`,`CPU-Name`,`Prozessor-Anzahl`,RAM,Speichergesamt,Speicherfrei,Speicherbelegt, NetVolumeUser) VALUES ('{get.hostname}','{get.user}','{get.ipadresse}','{get.winver}','{get.cpuname}','{get.cores}','{get.ram}','{get.hddtotal}','{get.hddfree}','{get.hddused}',{get.netvolumeuser})","","")
result = database(
f"SELECT id FROM `{get.dbname}`.Clients WHERE `Host-Name` = '{get.hostname}'",
"", "")
@ -141,7 +141,7 @@ async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key
@app.post("/host/update")
async def updatehost(get: CL.CL_UPDATE_HOST,api_key: APIKey = Depends(auth.get_api_key)):
database(f"UPDATE `{get.dbname}`.Clients SET Username = '{get.user}',`IP-Adresse` = '{get.ipadresse}',`Windows-Version` = '{get.winver}',`CPU-Name` = '{get.cpuname}',`Prozessor-Anzahl` = {get.cores},RAM = {get.ram},Speichergesamt = '{get.hddtotal}',Speicherfrei = '{get.hddfree}',Speicherbelegt = '{get.hddused}', LastChange = '{datetime.now()}' WHERE `Host-Name` = '{get.hostname}'","","")
database(f"UPDATE `{get.dbname}`.Clients SET Username = '{get.user}',`IP-Adresse` = '{get.ipadresse}',`Windows-Version` = '{get.winver}',`CPU-Name` = '{get.cpuname}',`Prozessor-Anzahl` = {get.cores},RAM = {get.ram},Speichergesamt = '{get.hddtotal}',Speicherfrei = '{get.hddfree}',Speicherbelegt = '{get.hddused}',NetVolumeUser = '{get.netvolumeuser}', LastChange = '{datetime.now()}' WHERE `Host-Name` = '{get.hostname}'","","")
result = database(f"SELECT id FROM `{get.dbname}`.Clients WHERE `Host-Name` = '{get.hostname}'","", "")
if not result:
return False