csc-cia-stne 0.0.59__tar.gz → 0.0.60__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/PKG-INFO +2 -1
  2. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/pyproject.toml +3 -2
  3. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/__init__.py +4 -1
  4. csc_cia_stne-0.0.60/src/csc_cia_stne/utilitarios/functions/func_rdp.py +103 -0
  5. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne.egg-info/PKG-INFO +2 -1
  6. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne.egg-info/SOURCES.txt +1 -0
  7. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne.egg-info/requires.txt +1 -0
  8. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/LICENCE +0 -0
  9. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/README.md +0 -0
  10. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/README_PYPI.md +0 -0
  11. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/setup.cfg +0 -0
  12. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/__init__.py +0 -0
  13. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/bc_correios.py +0 -0
  14. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/bc_sta.py +0 -0
  15. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/email.py +0 -0
  16. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/gcp_bigquery.py +0 -0
  17. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/google_drive.py +0 -0
  18. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/karavela.py +0 -0
  19. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/logger_json.py +0 -0
  20. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/logger_rich.py +0 -0
  21. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/provio.py +0 -0
  22. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/servicenow.py +0 -0
  23. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/slack.py +0 -0
  24. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/stne_admin.py +0 -0
  25. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/__init__.py +0 -0
  26. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_b64.py +0 -0
  27. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_converters.py +0 -0
  28. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_get_secret.py +0 -0
  29. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_recriar_pastas.py +0 -0
  30. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_settings.py +0 -0
  31. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/functions/func_titulo.py +0 -0
  32. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py +0 -0
  33. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py +0 -0
  34. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/validations/ServiceNowValidator.py +0 -0
  35. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/validations/__init__.py +0 -0
  36. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/utilitarios/validations/web_validator.py +0 -0
  37. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne/web.py +0 -0
  38. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne.egg-info/dependency_links.txt +0 -0
  39. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.60}/src/csc_cia_stne.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: csc_cia_stne
3
- Version: 0.0.59
3
+ Version: 0.0.60
4
4
  Summary: Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs
5
5
  License: MIT
6
6
  Keywords: karavela,csc,cia,stone,rpa,botcity,stne
@@ -26,6 +26,7 @@ Requires-Dist: webdriver-manager
26
26
  Requires-Dist: botcity-framework-web
27
27
  Requires-Dist: email-validator
28
28
  Requires-Dist: botcity-maestro-sdk
29
+ Requires-Dist: psutil
29
30
 
30
31
  Essa biblioteca é desenvolvida e atualizada pelo time **CSC-CIA** da **Stone**
31
32
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "csc_cia_stne"
7
- version = "0.0.59"
7
+ version = "0.0.60"
8
8
  license = { text = "MIT" }
9
9
  description = "Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs"
10
10
  keywords = ["karavela", "csc", "cia", "stone", "rpa", "botcity", "stne"]
@@ -31,5 +31,6 @@ dependencies = [
31
31
  "webdriver-manager",
32
32
  "botcity-framework-web",
33
33
  "email-validator",
34
- "botcity-maestro-sdk"
34
+ "botcity-maestro-sdk",
35
+ "psutil"
35
36
  ]
@@ -4,6 +4,7 @@ from .func_b64 import b64decode, b64encode
4
4
  from .func_converters import convert_bquery_result_to_json
5
5
  from .func_settings import get_config
6
6
  from .func_get_secret import get_secret
7
+ from .func_rdp import obter_ip_conexao_rdp, conectar_rdp
7
8
 
8
9
  __all__ = [
9
10
  "titulo",
@@ -12,5 +13,7 @@ __all__ = [
12
13
  "b64decode",
13
14
  "convert_bquery_result_to_json",
14
15
  "get_config",
15
- "get_secret"
16
+ "get_secret",
17
+ "obter_ip_conexao_rdp",
18
+ "conectar_rdp"
16
19
  ]
@@ -0,0 +1,103 @@
1
+ import platform
2
+ import subprocess
3
+ import time
4
+ import pyautogui
5
+ import psutil
6
+ import logging
7
+
8
+ def obter_ip_conexao_rdp():
9
+ """Retorna o ip da conexão RDP
10
+
11
+ Returns:
12
+ str: ip
13
+ """
14
+
15
+ for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
16
+
17
+ if proc.info['name'] == 'mstsc.exe' and proc.info['cmdline']:
18
+
19
+ for arg in proc.info['cmdline']:
20
+
21
+ if arg.startswith("/v:"): # O argumento '/v:' contém o IP
22
+
23
+ return arg.replace("/v:", "").strip()
24
+
25
+ return None
26
+
27
+ def conectar_rdp(host, usuario, senha):
28
+ """Conecta via RDP em uma máquina remota
29
+
30
+ Args:
31
+
32
+ host (str): ip/host destino
33
+ usuario (str): usuário
34
+ senha (str): senha
35
+
36
+ Returns:
37
+ bool: True/False
38
+ """
39
+
40
+ sistema = platform.system()
41
+
42
+ if sistema == "Windows":
43
+
44
+ try:
45
+
46
+ # Inicia o mstsc
47
+ cmd_conexao = f"start mstsc /v:{host} /f"
48
+ subprocess.run(cmd_conexao, shell=True)
49
+
50
+ # Aguarda um tempo para verificar se a conexão foi feita
51
+ time.sleep(3) # Dá tempo para o usuário tentar logar
52
+ pyautogui.typewrite(senha)
53
+ pyautogui.press('enter')
54
+ time.sleep(2)
55
+ pyautogui.press('left')
56
+ pyautogui.press('enter')
57
+ time.sleep(5)
58
+ return True
59
+
60
+ except Exception as e:
61
+
62
+ logging.error(f"Falha ao tentar logar via RDP (Windows)\nErro: {str(e)}")
63
+ return False
64
+
65
+ elif sistema == "Linux":
66
+
67
+ # Comando para executar a conexao com o xfreerdp
68
+ # Para instalar: sudo apt install freerdp2-x11
69
+ comando_rdp = f"""xfreerdp /u:{usuario} /p:{senha} /v:{host} /size:1920x1080"""
70
+
71
+ # Executar o comando e capturar saída
72
+ try:
73
+
74
+ processo_rdp = subprocess.Popen(
75
+ comando_rdp,
76
+ shell=True,
77
+ stdout=subprocess.PIPE,
78
+ stderr=subprocess.PIPE,
79
+ text=True
80
+ )
81
+
82
+ except Exception as e:
83
+
84
+ raise Exception(f"Falha ao executar o comando de conexão RDP no Linux. Você possui o xfreerdp instalado? (sudo apt install freerdp2-x11)\nErro: {str(e)}")
85
+
86
+ # Aguarda 10 segundos, para aparecer o banner azul
87
+ time.sleep(10)
88
+
89
+ # Se a conexão foi bem-sucedida, retornar True
90
+ if processo_rdp.poll() is None:
91
+
92
+ # Clica no 'enter', no banner azul
93
+ pyautogui.press('enter')
94
+ return True
95
+
96
+ else:
97
+
98
+ return False
99
+
100
+ else:
101
+
102
+ raise Exception("Sistema operacional não suportado (Somente 'Windows' ou 'Linux').")
103
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: csc_cia_stne
3
- Version: 0.0.59
3
+ Version: 0.0.60
4
4
  Summary: Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs
5
5
  License: MIT
6
6
  Keywords: karavela,csc,cia,stone,rpa,botcity,stne
@@ -26,6 +26,7 @@ Requires-Dist: webdriver-manager
26
26
  Requires-Dist: botcity-framework-web
27
27
  Requires-Dist: email-validator
28
28
  Requires-Dist: botcity-maestro-sdk
29
+ Requires-Dist: psutil
29
30
 
30
31
  Essa biblioteca é desenvolvida e atualizada pelo time **CSC-CIA** da **Stone**
31
32
 
@@ -26,6 +26,7 @@ src/csc_cia_stne/utilitarios/functions/__init__.py
26
26
  src/csc_cia_stne/utilitarios/functions/func_b64.py
27
27
  src/csc_cia_stne/utilitarios/functions/func_converters.py
28
28
  src/csc_cia_stne/utilitarios/functions/func_get_secret.py
29
+ src/csc_cia_stne/utilitarios/functions/func_rdp.py
29
30
  src/csc_cia_stne/utilitarios/functions/func_recriar_pastas.py
30
31
  src/csc_cia_stne/utilitarios/functions/func_settings.py
31
32
  src/csc_cia_stne/utilitarios/functions/func_titulo.py
@@ -18,3 +18,4 @@ webdriver-manager
18
18
  botcity-framework-web
19
19
  email-validator
20
20
  botcity-maestro-sdk
21
+ psutil
File without changes
File without changes
File without changes