Compare commits

..

5 Commits

Author SHA1 Message Date
sebastian.serfling 1bdbb38eb6 Change ssh-tunnel 2023-08-11 10:48:07 +02:00
sebastian.serfling 9d98e83f6e Change ssh-tunnel 2023-08-11 10:46:53 +02:00
sebastian.serfling deddbc92ca Change ssh-tunnel 2023-08-11 10:45:59 +02:00
sebastian.serfling 6041b5c804 Resync 2023-08-11 09:07:35 +02:00
sebastian.serfling 1a7e112df3 Resync 2023-08-11 09:06:14 +02:00
43 changed files with 381 additions and 18723 deletions
+2
View File
@@ -0,0 +1,2 @@
/build/
*.spec
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+6
View File
@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (server-info) (2)" project-jdk-type="Python SDK" />
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/server-info.iml" filepath="$PROJECT_DIR$/.idea/server-info.iml" />
</modules>
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
View File
@@ -1,15 +1,13 @@
import mysql.connector
import subprocess
import csv
from datetime import datetime
import mysql_connect
from Controller import mysql_connect
def adcontroller (ip,name):
command = ["powershell", "-Command",
"Get-ADUser -Filter * -Properties * | Export-Csv -NoTypeInformation -Encoding UTF8 -Path 'users.csv'"]
subprocess.run(command)
# CSV-Datei einlesen und Feldnamen auslesen
with open("users.csv", "r", encoding='utf-8-sig') as file:
reader = csv.DictReader(file)
@@ -21,7 +19,7 @@ def adcontroller (ip,name):
for field in fieldnames:
create_table_query += f"`{field}` TEXT, "
create_table_query = create_table_query.rstrip(", ") + ")"
mysql_connect.create_database(create_table_query,name)
mysql_connect.create_database(create_table_query, name)
# Daten aus der CSV-Datei in die Tabelle einfügen
with open("users.csv", "r", encoding='utf-8-sig') as file:
@@ -30,6 +28,7 @@ def adcontroller (ip,name):
for row in reader:
row = [cell if cell.strip() else "-" for cell in row]
unix_time = int(datetime.now().timestamp())
print(unix_time)
row = [unix_time] + row
insert_query = f"INSERT INTO `{table_name}` (importdate, `{'`, `'.join(fieldnames)}`) VALUES (%s, {', '.join(['%s'] * len(fieldnames))})"
mysql_connect.add_user(insert_query, name, row)
@@ -49,7 +48,7 @@ def adcontroller (ip,name):
for field in fieldnames:
create_table_query += f"`{field}` TEXT, "
create_table_query = create_table_query.rstrip(", ") + ")"
mysql_connect.create_database(create_table_query,name)
mysql_connect.create_database(create_table_query, name)
# Daten aus der CSV-Datei in die Tabelle aktualisieren oder einfügen
with open("group.csv", "r", encoding='utf-8-sig') as file:
@@ -59,11 +58,11 @@ def adcontroller (ip,name):
# Abfrage, um die ID für den Benutzernamen zu erhalten
query_id = f"SELECT id FROM `{table_name}` WHERE SamAccountName = %s"
result = mysql_connect.get_user(query_id,name, (sam_account_name,))
print(result)
result = mysql_connect.get_user(query_id, name, (sam_account_name,))
if result:
user_id = result[0]
print(user_id)
update_query = f"UPDATE `{table_name}` SET "
for field in fieldnames:
if field != "SamAccountName": # Spaltenname nicht in das UPDATE einbeziehen
@@ -71,11 +70,13 @@ def adcontroller (ip,name):
update_query = update_query.rstrip(", ")
update_query += ", `importdate` = %s" # Importdate als Unix-Timestamp aktualisieren
update_query += " WHERE id = %s"
row_data = [row[field] for field in fieldnames if field != "SamAccountName"]
row_data.append(int(datetime.now().timestamp())) # Aktuelle Zeit als Unix-Timestamp
unix_time = int(datetime.now().timestamp())
row_data = row_data + [unix_time]
row_data.append(user_id)
# cursor.execute(update_query, row_data)
# connection.commit()
print(row_data)
mysql_connect.add_user(update_query, name, row_data)
else:
insert_query = f"INSERT INTO `{table_name}` ("
insert_query += ", ".join(fieldnames) # Spaltennamen in die INSERT-Abfrage einbeziehen
@@ -83,6 +84,8 @@ def adcontroller (ip,name):
insert_query += ", ".join(["%s"] * (len(fieldnames) + 1)) # Zusätzliches %s für importdate
insert_query += ")"
row_data = [row[field] for field in fieldnames]
row_data.append(int(datetime.now().timestamp())) # Aktuelle Zeit als Unix-Timestamp
# cursor.execute(insert_query, row_data)
unix_time = int(datetime.now().timestamp())
row_data = row_data + [unix_time]
print(row_data)
mysql_connect.add_user(insert_query, name, row_data)
# connection.commit()
@@ -1,8 +1,7 @@
import mysql.connector
import subprocess
import csv
from datetime import datetime
import mysql_connect
from Controller import mysql_connect
def exchange (ip,name):
@@ -32,7 +31,7 @@ def exchange (ip,name):
row_length = len(create_table_query)
print(row_length)
print(create_table_query)
mysql_connect.create_database(create_table_query,name)
mysql_connect.create_database(create_table_query, name)
with open("exuser.csv", "r", encoding='utf-8-sig') as file:
reader = csv.reader(file)
+82
View File
@@ -0,0 +1,82 @@
import mysql.connector.locales.eng
import mysql.connector
import os
import Controller.ssh_tunnel as ssh_tunnel
filename = os.path.basename(__file__)
def ping(host):
# Führe den Ping-Befehl aus und erfasse die Ausgabe
result = os.system("ping -c 1 " + host)
if result == 0:
hostname = "172.17.1.21", 22
else:
hostname = "forward.stines.de", 2223
return hostname
def database(query,name,user):
# server.start()
print(f"{filename}-SSH Server start Port:{ssh_tunnel.server_port()}")
mydb = mysql.connector.connect(
host="127.0.0.1",
port=ssh_tunnel.server_port(),
user="root",
password="N53yBCswuawzBzS445VNAhWVMs3N59Gb9szEsrzXRBzarDqpdETpQeyt5v5CGe",
database="" + name,
auth_plugin='mysql_native_password',
)
mydb.connect()
print(f"{filename}-SQL Server Connect")
print(f"{filename}-{query}")
cursor = mydb.cursor()
if "SELECT" in query:
if user:
cursor.execute(query, user)
return cursor.fetchone()
else:
cursor.execute(query, user)
print(f"{filename}- Inside SELECT ALL")
return cursor.fetchall()
if "SHOW" in query:
cursor.execute(query)
return cursor.fetchall()
if "INSERT" in query:
cursor.execute(query)
mydb.commit()
if "UPDATE" in query:
cursor.execute(query)
mydb.commit()
mydb.close()
# server.stop()
def get_ip(query):
print(f"{filename}-GetIP")
user = ""
name = ""
return database(query, name, user)
def get_database():
name = ""
user = ""
query = 'SHOW DATABASES'
return database(query,name,user)
def create_database(query,name):
try:
user = ""
database(query,name,user)
except Exception as e:
print(f"{filename}-Ein Fehler ist aufgetreten:", str(e))
def add_user(query,name,user):
try:
database(query, name, user)
return print(f"{filename}-User Added")
except Exception as e:
print(f"{filename}-Ein Fehler ist aufgetreten:", str(e))
def get_user(query,name,user):
return database(query,name,user)
def get_cpu(query,name,cpu):
return database(query,name,cpu)
def update_cpu(query,name):
database(query,name)
+10 -4
View File
@@ -1,13 +1,16 @@
import subprocess
from datetime import datetime
import mysql_connect
from Controller import mysql_connect
import os
filename = os.path.basename(__file__)
def rds (ip,name):
print(f"INSIDE-{filename}")
powershell_command = "quser | Select-String -Pattern 'Aktiv'"
result = subprocess.run(["powershell", "-Command", powershell_command], capture_output=True, text=True)
fieldname = ["Benutzername","Anmeldezeit","Anmeldedatum"]
# Die Ausgabe des Befehls aufteilen und die Benutzernamen und Anmeldezeiten extrahieren
output_lines = result.stdout.strip().split('\n')[1:]
print(f"{filename}-{output_lines}")
logged_in_users = []
# Tabelle erstellen, falls sie noch nicht existiert
@@ -18,7 +21,8 @@ def rds (ip,name):
create_table_query = create_table_query.rstrip(", ") + ")"
create_table_query += " ROW_FORMAT=DYNAMIC"
user = ""
mysql_connect.create_database(create_table_query,name)
mysql_connect.create_database(create_table_query, name)
print(f"{filename}-{create_table_query}")
for line in output_lines:
parts = line.split()
@@ -26,10 +30,12 @@ def rds (ip,name):
login_time = parts[5]
login_date = parts[6]
logged_in_users.append((username,login_date, login_time))
print(f"{filename}-{logged_in_users}")
for user in logged_in_users:
user = [cell if cell.strip() else "-" for cell in user]
unix_time = int(datetime.now().timestamp())
user = [unix_time] + user
insert_query = f"INSERT INTO `{table_name}` (importdate, `{'`, `'.join(fieldname)}`) VALUES (%s, {', '.join(['%s'] * len(fieldname))})"
mysql_connect.add_user(insert_query,name, user)
mysql_connect.add_user(insert_query, name, user)
print(f"{filename}-{insert_query}")
+3 -3
View File
@@ -1,6 +1,6 @@
import requests
from datetime import datetime
import mysql_connect
from Controller import mysql_connect
def smtp(ip,name,mailcow_token):
@@ -47,7 +47,7 @@ def smtp(ip,name,mailcow_token):
field = 'User-ID'
create_table_query += f"`{field}` TEXT, "
create_table_query = create_table_query.rstrip(", ") + ")"
mysql_connect.create_database(create_table_query,name)
mysql_connect.create_database(create_table_query, name)
print(len(fields))
columns = ", ".join(json_data[0].keys())
@@ -62,4 +62,4 @@ def smtp(ip,name,mailcow_token):
for entry in json_data:
values = tuple(
cell if isinstance(cell, int) else cell.strip() if cell.strip() else "-" for cell in entry.values())
mysql_connect.add_user(insert_query,name, (unix_time,) + values)
mysql_connect.add_user(insert_query, name, (unix_time,) + values)
+22
View File
@@ -0,0 +1,22 @@
from sshtunnel import SSHTunnelForwarder
import os
filename = os.path.basename(__file__)
server = SSHTunnelForwarder(
("forward.stines.de", 2223),
ssh_username="root",
ssh_password="adm.3dfx12",
remote_bind_address=('127.0.0.1', 3306)
)
def server_start():
server.start()
return print(f"{filename}-Server started")
def server_stop():
server.stop()
return print(f"{filename}-Server stoped")
def server_port():
return server.local_bind_port
+32
View File
@@ -0,0 +1,32 @@
import psutil
import platform
import math
import cpuinfo
from Controller import mysql_connect
def get_cpu_info():
return cpuinfo.get_cpu_info()['brand_raw']
def get_cpu_sql():
query = f"SELECT `Prozessor-Anzahl` FROM `CPU-Liste` WHERE `CPU-Name`='{cpuinfo.get_cpu_info()['brand_raw']}'"
return mysql_connect.get_cpu(query,"Stines-GmbH",cpuinfo.get_cpu_info()['brand_raw'])
def get_ram_info():
ram_info = psutil.virtual_memory()
total_ram = ram_info.total / (1024 ** 3) # In Gigabytes
return math.ceil(total_ram)
def get_hdd_info():
total_disk_size = 0
disk_partitions = psutil.disk_partitions()
for partition in disk_partitions:
# Wenn du das Laufwerk C: ignorieren möchtest
if partition.device != 'C:\\':
partition_info = psutil.disk_usage(partition.mountpoint)
total_disk_size += partition_info.total / (1024 ** 3)
return math.ceil(total_disk_size)
# Informationen über die CPU
def set_system_info(ipadress):
query = f"UPDATE `Kunden-Server` SET RAM={get_ram_info()}, Prozessor={get_cpu_sql()[0]}, CPU='{get_cpu_info()}' WHERE `IP-Adresse`='{ipadress}'"
return mysql_connect.update_cpu(query,"Stines-GmbH","")
+69
View File
@@ -0,0 +1,69 @@
import psycopg2
from datetime import datetime, timedelta
from Controller import mysql_connect
def tickets(ip,name):
# Verbindungsinformationen zur PostgreSQL-Datenbank
db_host = "172.17.1.5"
db_name = "zammad_production"
db_user = "zammad"
db_password = "zammad"
table_name = "Tickets"
# Verbindung zur Datenbank herstellen
connection = psycopg2.connect(
host=db_host,
database=db_name,
user=db_user,
password=db_password
)
## Abfrage der Daten mit SL / ZL
cursor = connection.cursor()
query = "SELECT tickets.*, tag_items.name AS SLA FROM tickets LEFT JOIN tags ON tickets.id = tags.o_id LEFT JOIN tag_items ON tags.tag_item_id = tag_items.id;"
cursor.execute(query)
## Header auslesen
headers = [desc[0] for desc in cursor.description]
## Orga Auslesen
group = f"SELECT id FROM groups WHERE name = '{name.replace('ae','ä').replace('ue','ü').replace('oe','ö').replace('-',' ')}'"
cursor.execute(group)
query = f"SELECT tickets.*, tag_items.name AS SLA FROM tickets LEFT JOIN tags ON tickets.id = tags.o_id LEFT JOIN tag_items ON tags.tag_item_id = tag_items.id WHERE group_id = {cursor.fetchone()[0]}"
cursor.execute(query)
results = cursor.fetchall()
column_type = f"SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'tickets' order by column_name ASC;"
cursor.execute(column_type)
column_type = cursor.fetchall()
columns = ""
## Cretae Tabelle with column_type
create_table_query = f"CREATE TABLE IF NOT EXISTS `{table_name}` (importdate BIGINT(11), "
for i in column_type:
columns += f"{i[0]},"
if i[1] == "timestamp without time zone":
create_table_query += f"`{i[0]}` DATETIME, "
elif i[1] == "character varying":
create_table_query += f"`{i[0]}` TEXT, "
else:
create_table_query += f"`{i[0]}` {i[1]}, "
create_table_query = create_table_query.rstrip(",") + "sla TEXT)"
mysql_connect.create_database(create_table_query, name)
for row in results:
unix_time = int(datetime.now().timestamp())
id = mysql_connect.get_user(f"SELECT id FROM `{table_name}` where id = '%s'", name,(row[0],))
given_date = datetime.strptime(str(row[36]), "%Y-%m-%d %H:%M:%S.%f")
yesterday = datetime.now() - timedelta(days=1)
if id is None:
insert_query = f"INSERT INTO `{table_name}` (importdate, `{'`, `'.join(headers)}`) VALUES (%s, {', '.join(['%s'] * len(headers))})"
mysql_connect.add_user(insert_query, name, (unix_time,) + row)
else:
if given_date > yesterday:
update_query = f"UPDATE `{table_name}` SET "
for field in headers:
update_query += f" `{field}` = %s, "
update_query = update_query.rstrip(", ")
update_query += f" WHERE id = {row[0]}"
mysql_connect.add_user(update_query,name, row)
+2 -13
View File
@@ -2,14 +2,8 @@ import requests
import subprocess
import os
import shutil
import random
def create_windows_task(task_name, command, schedule):
try:
command_line = f'schtasks /F /create /tn "{task_name}" /tr "{command}" /sc {schedule}'
subprocess.run(command_line, shell=True, check=True)
print(f"Windows task '{task_name}' created successfully.")
except subprocess.CalledProcessError as e:
print(f"Failed to create Windows task. Error: {e}")
def download_and_run_file(url, filename):
response = requests.get(url)
@@ -41,7 +35,7 @@ if __name__ == "__main__":
try:
os.mkdir("C:\\Scripte")
except:
print("Exist")
print("Folder Exist")
path_to_exclude = "C:\\Scripte"
add_windows_defender_exception(path_to_exclude)
url_to_file = "https://gitlab.stines.de/sebastian.serfling/REPORTS/raw/branch/main/dist/main.exe"
@@ -51,10 +45,5 @@ if __name__ == "__main__":
shutil.move("Start.exe","C:\\Scripte\\Start.exe")
except:
print("File was moved!")
task_name = "Reports"
command_to_execute = "C:\\Scripte\\Start.exe"
schedule = "daily /st 23:30" # You can customize the schedule here
create_windows_task(task_name, command_to_execute, schedule)
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
-225
View File
@@ -1,225 +0,0 @@
('C:\\Users\\Sebastian Serfling\\PycharmProjects\\server-info\\dist\\main.exe',
True,
False,
False,
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico',
None,
False,
False,
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity type="win32" name="main" processorArchitecture="amd64" version="1.0.0.0"/><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"/></requestedPrivileges></security></trustInfo><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" language="*" processorArchitecture="*" version="6.0.0.0" publicKeyToken="6595b64144ccf1df"/></dependentAssembly></dependency><compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"><application><supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/><supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/><supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/><supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/><supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/></application></compatibility><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings><longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware></windowsSettings></application></assembly>',
True,
True,
False,
None,
None,
None,
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\main.pkg',
[('PYZ-00.pyz',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\PYZ-00.pyz',
'PYZ'),
('struct',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\struct.pyc',
'PYMODULE'),
('pyimod01_archive',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod01_archive.pyc',
'PYMODULE'),
('pyimod02_importers',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod02_importers.pyc',
'PYMODULE'),
('pyimod03_ctypes',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod03_ctypes.pyc',
'PYMODULE'),
('pyimod04_pywin32',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod04_pywin32.pyc',
'PYMODULE'),
('pyiboot01_bootstrap',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
'PYSOURCE'),
('pyi_rth_inspect',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
'PYSOURCE'),
('pyi_rth_pywintypes',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_pywintypes.py',
'PYSOURCE'),
('main',
'C:\\Users\\Sebastian Serfling\\PycharmProjects\\server-info\\main.py',
'PYSOURCE'),
('VCRUNTIME140.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\VCRUNTIME140.dll',
'BINARY'),
('python39.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll',
'BINARY'),
('pywin32_system32\\pywintypes39.dll',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\pywin32_system32\\pywintypes39.dll',
'BINARY'),
('_decimal.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_decimal.pyd',
'EXTENSION'),
('_hashlib.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_hashlib.pyd',
'EXTENSION'),
('_lzma.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_lzma.pyd',
'EXTENSION'),
('_bz2.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_bz2.pyd',
'EXTENSION'),
('_ssl.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_ssl.pyd',
'EXTENSION'),
('unicodedata.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\unicodedata.pyd',
'EXTENSION'),
('select.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\select.pyd',
'EXTENSION'),
('_queue.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_queue.pyd',
'EXTENSION'),
('cryptography\\hazmat\\bindings\\_rust.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\cryptography\\hazmat\\bindings\\_rust.pyd',
'EXTENSION'),
('_cffi_backend.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\_cffi_backend.cp39-win_amd64.pyd',
'EXTENSION'),
('bcrypt\\_bcrypt.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\bcrypt\\_bcrypt.pyd',
'EXTENSION'),
('nacl\\_sodium.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\nacl\\_sodium.pyd',
'EXTENSION'),
('win32\\win32security.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\win32\\win32security.pyd',
'EXTENSION'),
('win32\\_win32sysloader.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\win32\\_win32sysloader.pyd',
'EXTENSION'),
('_ctypes.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_ctypes.pyd',
'EXTENSION'),
('pyexpat.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\pyexpat.pyd',
'EXTENSION'),
('_uuid.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_uuid.pyd',
'EXTENSION'),
('charset_normalizer\\md__mypyc.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\charset_normalizer\\md__mypyc.cp39-win_amd64.pyd',
'EXTENSION'),
('charset_normalizer\\md.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\charset_normalizer\\md.cp39-win_amd64.pyd',
'EXTENSION'),
('_socket.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_socket.pyd',
'EXTENSION'),
('VCRUNTIME140_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\VCRUNTIME140_1.dll',
'BINARY'),
('libcrypto-1_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libcrypto-1_1.dll',
'BINARY'),
('libssl-1_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libssl-1_1.dll',
'BINARY'),
('python3.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\python3.dll',
'BINARY'),
('libffi-7.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libffi-7.dll',
'BINARY'),
('base_library.zip',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\base_library.zip',
'DATA'),
('nacl\\py.typed',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\nacl\\py.typed',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE.BSD',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE.BSD',
'DATA'),
('cryptography-41.0.2.dist-info\\INSTALLER',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\INSTALLER',
'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\certifi\\cacert.pem',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE.APACHE',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE.APACHE',
'DATA'),
('cryptography-41.0.2.dist-info\\WHEEL',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\WHEEL',
'DATA'),
('cryptography-41.0.2.dist-info\\RECORD',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\RECORD',
'DATA'),
('cryptography-41.0.2.dist-info\\METADATA',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\METADATA',
'DATA'),
('cryptography-41.0.2.dist-info\\top_level.txt',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\top_level.txt',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE',
'DATA'),
('certifi\\py.typed',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\certifi\\py.typed',
'DATA')],
[],
False,
False,
1690287166,
[('run.exe',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\run.exe',
'EXECUTABLE')])
-216
View File
@@ -1,216 +0,0 @@
('C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\main.pkg',
{'BINARY': True,
'DATA': True,
'EXECUTABLE': True,
'EXTENSION': True,
'PYMODULE': True,
'PYSOURCE': True,
'PYZ': False,
'SPLASH': True},
[('PYZ-00.pyz',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\PYZ-00.pyz',
'PYZ'),
('struct',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\struct.pyc',
'PYMODULE'),
('pyimod01_archive',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod01_archive.pyc',
'PYMODULE'),
('pyimod02_importers',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod02_importers.pyc',
'PYMODULE'),
('pyimod03_ctypes',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod03_ctypes.pyc',
'PYMODULE'),
('pyimod04_pywin32',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\localpycs\\pyimod04_pywin32.pyc',
'PYMODULE'),
('pyiboot01_bootstrap',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
'PYSOURCE'),
('pyi_rth_inspect',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
'PYSOURCE'),
('pyi_rth_pywintypes',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_pywintypes.py',
'PYSOURCE'),
('main',
'C:\\Users\\Sebastian Serfling\\PycharmProjects\\server-info\\main.py',
'PYSOURCE'),
('VCRUNTIME140.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\VCRUNTIME140.dll',
'BINARY'),
('python39.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll',
'BINARY'),
('pywin32_system32\\pywintypes39.dll',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\pywin32_system32\\pywintypes39.dll',
'BINARY'),
('_decimal.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_decimal.pyd',
'EXTENSION'),
('_hashlib.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_hashlib.pyd',
'EXTENSION'),
('_lzma.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_lzma.pyd',
'EXTENSION'),
('_bz2.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_bz2.pyd',
'EXTENSION'),
('_ssl.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_ssl.pyd',
'EXTENSION'),
('unicodedata.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\unicodedata.pyd',
'EXTENSION'),
('select.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\select.pyd',
'EXTENSION'),
('_queue.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_queue.pyd',
'EXTENSION'),
('cryptography\\hazmat\\bindings\\_rust.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\cryptography\\hazmat\\bindings\\_rust.pyd',
'EXTENSION'),
('_cffi_backend.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\_cffi_backend.cp39-win_amd64.pyd',
'EXTENSION'),
('bcrypt\\_bcrypt.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\bcrypt\\_bcrypt.pyd',
'EXTENSION'),
('nacl\\_sodium.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\nacl\\_sodium.pyd',
'EXTENSION'),
('win32\\win32security.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\win32\\win32security.pyd',
'EXTENSION'),
('win32\\_win32sysloader.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\win32\\_win32sysloader.pyd',
'EXTENSION'),
('_ctypes.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_ctypes.pyd',
'EXTENSION'),
('pyexpat.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\pyexpat.pyd',
'EXTENSION'),
('_uuid.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_uuid.pyd',
'EXTENSION'),
('charset_normalizer\\md__mypyc.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\charset_normalizer\\md__mypyc.cp39-win_amd64.pyd',
'EXTENSION'),
('charset_normalizer\\md.cp39-win_amd64.pyd',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\charset_normalizer\\md.cp39-win_amd64.pyd',
'EXTENSION'),
('_socket.pyd',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\_socket.pyd',
'EXTENSION'),
('VCRUNTIME140_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\VCRUNTIME140_1.dll',
'BINARY'),
('libcrypto-1_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libcrypto-1_1.dll',
'BINARY'),
('libssl-1_1.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libssl-1_1.dll',
'BINARY'),
('python3.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\python3.dll',
'BINARY'),
('libffi-7.dll',
'C:\\Users\\Sebastian '
'Serfling\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\libffi-7.dll',
'BINARY'),
('base_library.zip',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\build\\main\\base_library.zip',
'DATA'),
('nacl\\py.typed',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\nacl\\py.typed',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE.BSD',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE.BSD',
'DATA'),
('cryptography-41.0.2.dist-info\\INSTALLER',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\INSTALLER',
'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\certifi\\cacert.pem',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE.APACHE',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE.APACHE',
'DATA'),
('cryptography-41.0.2.dist-info\\WHEEL',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\WHEEL',
'DATA'),
('cryptography-41.0.2.dist-info\\RECORD',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\RECORD',
'DATA'),
('cryptography-41.0.2.dist-info\\METADATA',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\METADATA',
'DATA'),
('cryptography-41.0.2.dist-info\\top_level.txt',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\top_level.txt',
'DATA'),
('cryptography-41.0.2.dist-info\\LICENSE',
'c:\\users\\sebastian '
'serfling\\pycharmprojects\\server-info\\venv\\lib\\site-packages\\cryptography-41.0.2.dist-info\\LICENSE',
'DATA'),
('certifi\\py.typed',
'C:\\Users\\Sebastian '
'Serfling\\PycharmProjects\\server-info\\venv\\lib\\site-packages\\certifi\\py.typed',
'DATA')],
False,
False,
False,
[],
None,
None,
None)
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="main" processorArchitecture="amd64" version="1.0.0.0"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" language="*" processorArchitecture="*" version="6.0.0.0" publicKeyToken="6595b64144ccf1df"/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
</assembly>
-57
View File
@@ -1,57 +0,0 @@
This file lists modules PyInstaller was not able to find. This does not
necessarily mean this module is required for running your program. Python and
Python 3rd-party packages include a lot of conditional or optional modules. For
example the module 'ntpath' only exists on Windows, whereas the module
'posixpath' only exists on Posix systems.
Types if import:
* top-level: imported at the top-level - look at these first
* conditional: imported within an if-statement
* delayed: imported within a function
* optional: imported within a try-except-statement
IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
tracking down the missing module yourself. Thanks!
missing module named org - imported by pickle (optional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named posix - imported by os (conditional, optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named resource - imported by posix (top-level)
missing module named grp - imported by shutil (optional), tarfile (optional), pathlib (delayed, optional), subprocess (optional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), pathlib (delayed, conditional, optional), subprocess (optional), netrc (delayed, conditional), getpass (delayed)
missing module named pep517 - imported by importlib.metadata (delayed)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named termios - imported by getpass (optional)
missing module named _posixsubprocess - imported by subprocess (optional)
missing module named SocketServer - imported by sshtunnel (conditional)
missing module named Queue - imported by mysql.connector.pooling (optional), sshtunnel (conditional)
missing module named invoke - imported by paramiko.config (optional)
missing module named cryptography.x509.UnsupportedExtension - imported by cryptography.x509 (optional), urllib3.contrib.pyopenssl (optional)
missing module named fcntl - imported by paramiko.agent (delayed)
missing module named 'pyasn1.codec' - imported by paramiko.ssh_gss (delayed)
missing module named pyasn1 - imported by paramiko.ssh_gss (delayed)
missing module named gssapi - imported by paramiko.ssh_gss (optional)
missing module named vms_lib - imported by platform (delayed, optional)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named java - imported by platform (delayed)
missing module named _winreg - imported by platform (delayed, optional)
missing module named httplib - imported by mysql.connector.fabric.connection (conditional, optional)
missing module named urllib2 - imported by mysql.connector.fabric.connection (optional)
missing module named xmlrpclib - imported by mysql.connector.fabric.connection (optional)
missing module named ConfigParser - imported by mysql.connector.optionfiles (conditional)
missing module named _mysql_connector - imported by mysql.connector (optional), mysql.connector.connection_cext (optional), mysql.connector.cursor_cext (top-level)
missing module named simplejson - imported by requests.compat (conditional, optional)
missing module named dummy_threading - imported by requests.cookies (optional)
missing module named typing_extensions - imported by urllib3.connection (conditional), urllib3.util.timeout (conditional), urllib3._base_connection (conditional), urllib3.util.request (conditional), urllib3._collections (conditional), urllib3.util.ssl_ (conditional), urllib3.util.ssltransport (conditional), urllib3.connectionpool (conditional), urllib3.response (conditional), urllib3.poolmanager (conditional)
missing module named zstandard - imported by urllib3.response (optional), urllib3.util.request (optional)
missing module named brotli - imported by urllib3.response (optional), urllib3.util.request (optional)
missing module named brotlicffi - imported by urllib3.response (optional), urllib3.util.request (optional)
missing module named socks - imported by urllib3.contrib.socks (optional)
missing module named 'typing.io' - imported by importlib.resources (top-level)
missing module named 'OpenSSL.crypto' - imported by urllib3.contrib.pyopenssl (delayed, conditional)
missing module named OpenSSL - imported by urllib3.contrib.pyopenssl (top-level)
missing module named chardet - imported by requests.compat (optional), requests (optional), requests.packages (optional)
missing module named urllib3_secure_extra - imported by urllib3 (optional)
File diff suppressed because it is too large Load Diff
Binary file not shown.
BIN
View File
Binary file not shown.
+71 -39
View File
@@ -1,38 +1,39 @@
import Controller.ssh_tunnel as ssh_tunnel
ssh_tunnel.server_start()
import socket
import adcontroller_export
import exchange_export
import smtp_export
import rds_export
import mysql_connect
from Controller import adcontroller_export, exchange_export, rds_export, smtp_export, zammad, system_info
import Controller.mysql_connect as mysql_connect
import random
import subprocess
import socket
import os
## Gibt Name der Datei zum Debugen aus
filename = os.path.basename(__file__)
def get_local_ip():
try:
# Socket erstellen, um die lokale IP-Adresse zu ermitteln
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80)) # Eine temporäre Verbindung zu einem externen Server herstellen
# Die lokale IP-Adresse aus den Socketeigenschaften abrufen
s.connect(("8.8.8.8", 80))
local_ip = s.getsockname()[0]
# Den Socket schließen
s.close()
print(local_ip)
return local_ip
except Exception as e:
print(f"Fehler beim Abrufen der lokalen IP-Adresse: {e}")
return None
def adcontroller(ip,name):
adcontroller_export.adcontroller(ip,name)
adcontroller_export.adcontroller(ip, name)
def exchange(ip,name):
exchange_export.exchange(ip,name)
exchange_export.exchange(ip, name)
def smtp(ip,name,token):
smtp_export.smtp(ip,name,token)
smtp_export.smtp(ip, name, token)
def rds(ip, name):
rds_export.rds(ip,name)
rds_export.rds(ip, name)
def cms(ip, servername):
## Import User als RAW
@@ -54,9 +55,8 @@ def nginx(ip,servername):
## Import Letsencrypt Time als RAW
print("" + ip + servername)
def zammad(ip,servername):
## Import Tickets Time als RAW
print("" + ip + servername)
def tickets(ip,name):
zammad.tickets(ip,name)
def data(ip,servername):
## Import Space Used als RAW
@@ -74,21 +74,40 @@ def gucamole(ip,servername):
## Import User + Maschinen als RAW
print("" + ip + servername)
def create_windows_task(task_name, command, schedule):
try:
command_line = f'schtasks /F /create /ru "SYSTEM" /tn "{task_name}" /tr "{command}" /sc {schedule}'
subprocess.run(command_line, shell=True, check=True)
print(f"{filename}-Windows task '{task_name}' created successfully.")
except subprocess.CalledProcessError as e:
print(f"{filename}-Failed to create Windows task. Error: {e}")
query = "SELECT * FROM `Stines-GmbH`.`Kunden-Server` WHERE `IP-Adresse` = ""'{}'""".format(get_local_ip())
name = "Stines-GmbH"
list = mysql_connect.get_ip(query,name)
# query = "SELECT * FROM `Stines-GmbH`.`Kunden-Server` WHERE `IP-Adresse` = ""'{}'""".format(get_local_ip())
query = "SELECT * FROM `Stines-GmbH`.`Kunden-Server` WHERE `IP-Adresse` = ""'{}'""".format("172.19.1.5")
print(f"{filename}-Before Get List")
list = mysql_connect.get_ip(query)
print(f"{filename}-Atfer Get IP")
if list == []:
query_insert = f"INSERT INTO `Kunden-Server` (Name,`Server-Name`,`IP-Adresse`,Funktion,CPU,RAM,Speicher) VALUES ('unkown','{socket.gethostname()}','{get_local_ip()}','-','{system_info.get_cpu_info()}','{system_info.get_ram_info()}','{system_info.get_hdd_info()}')"
print(f"{filename}-List is Empty")
mysql_connect.add_user(query_insert,"Stines-GmbH","")
set_ipaddress = []
print(f"{filename}-Before Row")
# Ergebnisse durchlaufen und ausgeben
for row in list:
print(row)
name = row[1]
ipadress = row[3]
lastchange = row[5]
funktion = row[6]
token = row[7]
name = row[2]
ipadress = row[4]
set_ipaddress = row[4]
lastchange = row[6]
funktion = row[7]
token = row[8]
print(f"{filename}-Inside Row {name}-{funktion}")
cursor = mysql_connect.get_database()
@@ -96,22 +115,35 @@ for row in list:
database_exists = False
for (db_name,) in cursor:
if db_name == name:
if name in str(db_name):
database_exists = True
if "-" in str(db_name):
database_exists = True
break
# Datenbank erstellen, wenn sie noch nicht existiert
print(f"{filename}-{database_exists}")
if not database_exists:
create_database_query = f"CREATE DATABASE {name}"
mysql_connect.create_database(create_database_query)
print(f"Die Datenbank '{name}' wurde erfolgreich erstellt.")
create_database_query = f"CREATE DATABASE `{name}`"
mysql_connect.create_database(create_database_query,name)
print(f"{filename}-Die Datenbank '`{name}`' wurde erfolgreich erstellt.")
else:
print(f"Die Datenbank '{name}' existiert bereits.")
print(f"{filename}-Die Datenbank '`{name}`' existiert bereits.")
try:
if token is not None:
eval(funktion + '("' + ipadress + '","' + name + '","' + token + '")')
if token is not None:
eval(funktion + '("' + ipadress + '","' + name + '","' + token + '")')
else:
if funktion == "-":
break
else:
eval(funktion + '("' + ipadress + '","' + name + '")')
except NameError:
print("Die Funktion existiert nicht.")
print(f"{filename}-FOR system_info_get: {set_ipaddress}")
system_info.set_system_info(f"{set_ipaddress}")
task_name = "Reports"
command_to_execute = "C:\\Scripte\\Start.exe"
schedule = f"daily /st 23:{random.randint(0, 59)}" # You can customize the schedule here
create_windows_task(task_name, command_to_execute, schedule)
ssh_tunnel.server_stop()
-44
View File
@@ -1,44 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
-63
View File
@@ -1,63 +0,0 @@
import mysql.connector
import mysql.connector.locales.eng.client_error
from sshtunnel import SSHTunnelForwarder
server = SSHTunnelForwarder(
('forward.stines.de', 2223),
ssh_username="root",
ssh_password="adm.3dfx12",
remote_bind_address=('127.0.0.1', 3306)
)
def database(query,name,user):
server.start()
mydb = mysql.connector.connect(
host="127.0.0.1",
port=server.local_bind_port,
user="root",
password="N53yBCswuawzBzS445VNAhWVMs3N59Gb9szEsrzXRBzarDqpdETpQeyt5v5CGe",
database="" + name
)
mydb.connect()
cursor = mydb.cursor()
if user:
cursor.execute(query,user)
else:
cursor.execute(query)
if "INSERT" in query:
mydb.commit()
if "SELECT" in query:
return cursor.fetchall()
if "SHOW" in query:
return cursor.fetchall()
mydb.close()
server.stop()
def get_ip(query,name):
print("GetIP")
user = ""
return database(query, name,user)
def get_database():
name = ""
user = ""
query = 'SHOW DATABASES'
print(database(query,name,user))
return database(query,name,user)
def create_database(query,name):
try:
user = ""
database(query,name,user)
return ("Database Created")
except Exception as e:
print("Ein Fehler ist aufgetreten:", str(e))
def add_user(query,name,user):
try:
database(query,name,user)
return ("User addet")
except Exception as e:
print("Ein Fehler ist aufgetreten:", str(e))
def get_user(query,name,user):
try:
database(query,name,user)
return (user)
except Exception as e:
print("Ein Fehler ist aufgetreten:", str(e))
BIN
View File
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
## Ordner anlegen
mkdir /root/REPORTS
cd /root/REPORTS
## APT UPDATE
apt update
apt install python3-pip git -y
## Add Crontab
if [ -f ".crontab" ]; then
echo "Gibt es"
next
else
crontab -l | { cat; echo "30 0 * * * /root/REPORTS/setup-info.sh"; } | crontab -
echo "Gibt es nicht"
touch ".crontab"
fi
## Add GIT
git init
git remote add orgin https://gitlab.stines.de/sebastian.serfling/REPORTS.git
git fetch
git pull orgin main
## Install Python
python3 -m pip install virtualenv
python3 -m virtualenv venv
source venv/bin/activate
python3 -m pip install -r packages.txt
python3 -m pip uninstall mysql-connector -y ## Fix for Connection Issue
python3 -m pip install mysql-connector ## Fix for Connection Issue
python3 main.py
deactivate
-12
View File
@@ -1,12 +0,0 @@
from setuptools import setup
setup(
name='server-info',
version='',
packages=[''],
url='',
license='',
author='Sebastian Serfling',
author_email='',
description=''
)