Mise à jour de sécurité

This commit is contained in:
2025-04-03 12:45:32 +02:00
parent f692414698
commit dbe918cfcf
32 changed files with 302 additions and 437 deletions
-31
View File
@@ -1,31 +0,0 @@
import sys
import socket
import os
IPAddr=socket.gethostbyname(socket.gethostname())
if IPAddr[0:11] == "100.100.100": #4269
host = "100.100.100.11"
port = "5432"
dbname = "sig4269"
sigdb="sig4269"
refdb="ref_geo4269"
password = "McVities"
if IPAddr[0:9] == "192.168.0": #01
host = "192.168.0.201"
port = "5432"
dbname = "sig01"
sigdb="sig01"
refdb="ref_geo01"
password = "McVities"
if IPAddr[0:9] == "192.168.1": #0726
host = "192.168.1.201"
port = "5432"
dbname = "sig0726"
sigdb="sig0726"
refdb="ref_geo0726"
password = "McVities"
if sys.platform == 'linux':
os_user = os.environ['USER']
else:
os_user = os.environ['USERNAME']
if os_user == 'STAGE':
os_user='stage'
+15 -19
View File
@@ -3,6 +3,7 @@
import configparser
import shutil
import tempfile
import socket
import base64
import psycopg2
import psycopg2.extras
@@ -89,7 +90,7 @@ def resources_path(*args):
:return: Absolute path to the resources folder.
:rtype: str
"""
path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\tools")))
path = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools")))
for item in args:
path = abspath(join(path, item))
return path
@@ -106,26 +107,21 @@ def load_ui(*args):
ui_class, _ = uic.loadUiType(resources_path("ui", *args))
return ui_class
'''
def login_base(take=None):
from .tools.PythonSQL import host,port,dbname,password,os_user
first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
res_ident = first_cur.fetchone()
mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
user = res_ident[1]
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
def pyperclip():
IPAddr=socket.gethostbyname(socket.gethostname())
dst = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools\\")))
if IPAddr[0:11] == "100.100.100": #4269
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.0": #01
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
if IPAddr[0:9] == "192.168.1": #0726
src = '\\\\100.100.100.100\\nuage\\SI_Systeme d information\\Z_QGIS\\PLUGIN\\PythonSQL.py'
try:
shutil.copy(src, dst)
except:
print('404')
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_conn.close()
if take:
return cur,con
else:
return cur
'''
def send_issues(url,titre,body,labels):
import requests
import json