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
+16 -21
View File
@@ -6,10 +6,10 @@ import tempfile
import base64
import psycopg2
import psycopg2.extras
import socket
from os.path import abspath, join, pardir, dirname
from qgis.core import QgsDataSourceUri
from .PythonSQL import *
from .SQLRequet import *
from qgis.PyQt import uic
__copyright__ = "Copyright 2019, 3Liz"
@@ -108,26 +108,21 @@ def load_ui(*args):
ui_class, _ = uic.loadUiType(resources_path("ui", *args))
return ui_class
'''
def login_base(take=None):
from .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_POSTGIS\\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
@@ -234,7 +229,7 @@ def create_contour(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
uri.setDataSource(schema, tablename, geom)
layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
def create_travaux(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
def create_travaux(self,schema,cur,con,host,port,dbname,user,mdp):
### Creation de la table travaux prevus
if self.couche_travaux_prevus.isChecked():
#**********Poly