csc-cia-stne 0.0.59__tar.gz → 0.0.61__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.61}/PKG-INFO +2 -1
  2. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/pyproject.toml +3 -2
  3. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/__init__.py +4 -1
  4. csc_cia_stne-0.0.61/src/csc_cia_stne/utilitarios/functions/func_rdp.py +104 -0
  5. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne.egg-info/PKG-INFO +2 -1
  6. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne.egg-info/SOURCES.txt +1 -0
  7. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne.egg-info/requires.txt +1 -0
  8. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/LICENCE +0 -0
  9. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/README.md +0 -0
  10. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/README_PYPI.md +0 -0
  11. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/setup.cfg +0 -0
  12. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/__init__.py +0 -0
  13. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/bc_correios.py +0 -0
  14. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/bc_sta.py +0 -0
  15. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/email.py +0 -0
  16. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/gcp_bigquery.py +0 -0
  17. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/google_drive.py +0 -0
  18. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/karavela.py +0 -0
  19. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/logger_json.py +0 -0
  20. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/logger_rich.py +0 -0
  21. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/provio.py +0 -0
  22. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/servicenow.py +0 -0
  23. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/slack.py +0 -0
  24. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/stne_admin.py +0 -0
  25. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/__init__.py +0 -0
  26. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_b64.py +0 -0
  27. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_converters.py +0 -0
  28. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_get_secret.py +0 -0
  29. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_recriar_pastas.py +0 -0
  30. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_settings.py +0 -0
  31. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/functions/func_titulo.py +0 -0
  32. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py +0 -0
  33. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py +0 -0
  34. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/validations/ServiceNowValidator.py +0 -0
  35. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/validations/__init__.py +0 -0
  36. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/utilitarios/validations/web_validator.py +0 -0
  37. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne/web.py +0 -0
  38. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/src/csc_cia_stne.egg-info/dependency_links.txt +0 -0
  39. {csc_cia_stne-0.0.59 → csc_cia_stne-0.0.61}/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.61
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.61"
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,104 @@
1
+ import platform
2
+ import subprocess
3
+ import time
4
+ import pyautogui
5
+ import psutil
6
+ import logging
7
+ log = logging.getLogger('__main__')
8
+
9
+ def obter_ip_conexao_rdp():
10
+ """Retorna o ip da conexão RDP
11
+
12
+ Returns:
13
+ str: ip
14
+ """
15
+
16
+ for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
17
+
18
+ if proc.info['name'] == 'mstsc.exe' and proc.info['cmdline']:
19
+
20
+ for arg in proc.info['cmdline']:
21
+
22
+ if arg.startswith("/v:"): # O argumento '/v:' contém o IP
23
+
24
+ return arg.replace("/v:", "").strip()
25
+
26
+ return None
27
+
28
+ def conectar_rdp(host, usuario, senha):
29
+ """Conecta via RDP em uma máquina remota
30
+
31
+ Args:
32
+
33
+ host (str): ip/host destino
34
+ usuario (str): usuário
35
+ senha (str): senha
36
+
37
+ Returns:
38
+ bool: True/False
39
+ """
40
+
41
+ sistema = platform.system()
42
+
43
+ if sistema == "Windows":
44
+
45
+ try:
46
+
47
+ # Inicia o mstsc
48
+ cmd_conexao = f"start mstsc /v:{host} /f"
49
+ subprocess.run(cmd_conexao, shell=True)
50
+
51
+ # Aguarda um tempo para verificar se a conexão foi feita
52
+ time.sleep(3) # Dá tempo para o usuário tentar logar
53
+ pyautogui.typewrite(senha)
54
+ pyautogui.press('enter')
55
+ time.sleep(2)
56
+ pyautogui.press('left')
57
+ pyautogui.press('enter')
58
+ time.sleep(5)
59
+ return True
60
+
61
+ except Exception as e:
62
+
63
+ log.error(f"Falha ao tentar logar via RDP (Windows)\nErro: {str(e)}")
64
+ return False
65
+
66
+ elif sistema == "Linux":
67
+
68
+ # Comando para executar a conexao com o xfreerdp
69
+ # Para instalar: sudo apt install freerdp2-x11
70
+ comando_rdp = f"""xfreerdp /u:{usuario} /p:{senha} /v:{host} /size:1920x1080"""
71
+
72
+ # Executar o comando e capturar saída
73
+ try:
74
+
75
+ processo_rdp = subprocess.Popen(
76
+ comando_rdp,
77
+ shell=True,
78
+ stdout=subprocess.PIPE,
79
+ stderr=subprocess.PIPE,
80
+ text=True
81
+ )
82
+
83
+ except Exception as e:
84
+
85
+ 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)}")
86
+
87
+ # Aguarda 10 segundos, para aparecer o banner azul
88
+ time.sleep(10)
89
+
90
+ # Se a conexão foi bem-sucedida, retornar True
91
+ if processo_rdp.poll() is None:
92
+
93
+ # Clica no 'enter', no banner azul
94
+ pyautogui.press('enter')
95
+ return True
96
+
97
+ else:
98
+
99
+ return False
100
+
101
+ else:
102
+
103
+ raise Exception("Sistema operacional não suportado (Somente 'Windows' ou 'Linux').")
104
+
@@ -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.61
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