csc-cia-stne 0.0.98__py3-none-any.whl → 0.1.0__py3-none-any.whl

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.
csc_cia_stne/ftp.py CHANGED
@@ -280,17 +280,26 @@ class FTP():
280
280
 
281
281
  connection_ftp.perform()
282
282
 
283
- conteudo = buffer.getvalue().decode('utf-8')
283
+ try:
284
+ files_to_organize = buffer.getvalue().decode('utf-8')
285
+ except UnicodeDecodeError:
286
+ files_to_organize = buffer.getvalue().decode('latin-1')
287
+
288
+ lines_of_file = files_to_organize.splitlines()
289
+
290
+ organized_list = []
284
291
 
285
- lista_arquivos = [linha.strip() for linha in conteudo.splitlines() if linha.strip()]
292
+ for line in lines_of_file:
293
+ parts = line.strip().split()
294
+ if parts:
295
+ nome = parts[-1]
296
+ organized_list.append(nome)
286
297
 
287
298
  connection_ftp.close()
288
299
 
289
300
  return {
290
301
  'status': True,
291
- 'status_code': connection_ftp.getinfo(connection_ftp.RESPONSE_CODE),
292
- 'message': f"Arquivos listados com sucesso de {self.host}:{self.port}/{filepathftp}.",
293
- 'files': lista_arquivos
302
+ 'files': organized_list
294
303
  }
295
304
 
296
305
  except Exception as e:
@@ -301,6 +310,5 @@ class FTP():
301
310
 
302
311
  return {
303
312
  'status': False,
304
- 'status_code': None,
305
313
  'message': f"Falha ao listar arquivos de {self.host}:{self.port}/{filepathftp}."
306
314
  }
@@ -1,4 +1,4 @@
1
- from .functions import titulo, recriar_pasta, b64encode, b64decode, convert_bquery_result_to_json,get_config, get_secret, conectar_rdp, obter_ip_conexao_rdp, now_sp
1
+ from .functions import titulo, recriar_pasta, b64encode, b64decode, convert_bquery_result_to_json,get_config, get_secret, now_sp
2
2
  __all__ = [
3
3
  "titulo",
4
4
  "recriar_pasta",
@@ -7,7 +7,5 @@ __all__ = [
7
7
  "convert_bquery_result_to_json",
8
8
  "get_config",
9
9
  "get_secret",
10
- "conectar_rdp",
11
10
  "now_sp",
12
- "obter_ip_conexao_rdp"
13
11
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csc_cia_stne
3
- Version: 0.0.98
3
+ Version: 0.1.0
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
@@ -2,7 +2,7 @@ csc_cia_stne/__init__.py,sha256=jwLhGpOwFCow_6cqzwLn31WcIrMzutMZtEQpLL4bQtM,2638
2
2
  csc_cia_stne/bc_correios.py,sha256=pQAnRrcXEMrx3N1MWydZVIhEQLerh3x8-0B045zZIzk,24174
3
3
  csc_cia_stne/bc_sta.py,sha256=sE-aU-ZVSAqryQrT1-nor9eAFM5npNAKF1QSm-ChhGU,28945
4
4
  csc_cia_stne/email.py,sha256=K0DcgxTPKa_Rz_SJekjbW8Nw_1L9s_iuDDxZ-69bZfM,8387
5
- csc_cia_stne/ftp.py,sha256=zoUQMRKTWdpUUmy0Ty2PT4mMaW84tPgs4d11O8HMNhQ,10833
5
+ csc_cia_stne/ftp.py,sha256=M9WCaq2hm56jGyszNaPinliFaZS0BNrT7VrVPMjkMg4,10988
6
6
  csc_cia_stne/gcp_bigquery.py,sha256=foq8azvvv_f7uikMDslX9RcUIrx7RAS-Sn0AGW0QFQc,7231
7
7
  csc_cia_stne/gcp_bucket.py,sha256=nP77BtagZ7jQq6lS88ZEa1qshzBza6e_LvhgS3_JJJk,10268
8
8
  csc_cia_stne/google_drive.py,sha256=k6GnM8bxQUPbXhaK6Sa4JpWrCcJ0vzYgXP8Uexy7YR0,16073
@@ -15,13 +15,12 @@ csc_cia_stne/slack.py,sha256=sPLeaQh_JewLcrBDjjwUgbjtC7d1Np03OTy06JimMV4,8117
15
15
  csc_cia_stne/stne_admin.py,sha256=4v_BVQAwZeWmxvjDOkwFAl9yIxJ3r54BY7pRgAgSXEM,24220
16
16
  csc_cia_stne/wacess.py,sha256=g-bWZNpm_tU7UsW1G_rqh_2fW2KShvxZHGOerX8DuQw,26768
17
17
  csc_cia_stne/web.py,sha256=_pc6BzPy2x0RvqtZsByjtKcSuUqlVTevfmmmKbVWLhA,15417
18
- csc_cia_stne/utilitarios/__init__.py,sha256=rBGAmW0WcZnwTfVNuikNuJ1RBs6o7aw4xrV2QSsF9Bs,389
18
+ csc_cia_stne/utilitarios/__init__.py,sha256=eUaRttjY-F_zHAHC3L22VZxWyQd_k9zso-Mjz01Rj9o,306
19
19
  csc_cia_stne/utilitarios/functions/__init__.py,sha256=tBN1a6ZlvS1kLXIGopaqecJvlkOhLvLeYjp3JCAspWs,471
20
20
  csc_cia_stne/utilitarios/functions/func_b64.py,sha256=XGU34BIQQXWXBS0yM2B4A2wDlcrMl1unIJXjq4lpLnk,1254
21
21
  csc_cia_stne/utilitarios/functions/func_converters.py,sha256=EY1zvlBaRX7G1MceVSiRXwwKDQDZwUO9iECBL0fe5iU,481
22
22
  csc_cia_stne/utilitarios/functions/func_datetime.py,sha256=UA7ch4sQWTiYcz8r6LtGujIdpTU-Sht8qmTYvm9vhh0,257
23
23
  csc_cia_stne/utilitarios/functions/func_get_secret.py,sha256=cJZe_qtFFbISfQAo0iSCHjqutIjMvRF-L3I_bKUpM8I,2869
24
- csc_cia_stne/utilitarios/functions/func_rdp.py,sha256=HdQ2vnrMPGqhS5gepqrAFBW_Lc7gpZjX0nWItmi2OAA,4933
25
24
  csc_cia_stne/utilitarios/functions/func_recriar_pastas.py,sha256=4whZpB3aJQaCPJ3osMAQpKrzEhqYtJbljGWlx_OvKIM,826
26
25
  csc_cia_stne/utilitarios/functions/func_settings.py,sha256=XwlfqdcfocXQ8kTsDKZ6GsAtpzr0_u44AOTIMtdem7U,2059
27
26
  csc_cia_stne/utilitarios/functions/func_titulo.py,sha256=bH4tYxovTARF-g2kWUK_GIzzXt8egbVdp6mWD6fc_3I,5345
@@ -33,8 +32,8 @@ csc_cia_stne/utilitarios/validations/ftp.py,sha256=LNYyS2c8eou3ML23bBtn87xJFIKSr
33
32
  csc_cia_stne/utilitarios/validations/gcp_bucket.py,sha256=vqj70jBAkazydUCPXIdE3zzgoz8Te2cCJNX_rICX1aM,6096
34
33
  csc_cia_stne/utilitarios/validations/waccess.py,sha256=8yfOrmIPUSLzbCt6P0F6vj3FkSgU_RgrJpJlRhlLyV0,7352
35
34
  csc_cia_stne/utilitarios/validations/web_validator.py,sha256=HYKYSpDv1RvRjZIuwTPt-AbEz-9392MxM_O329iYuSA,5722
36
- csc_cia_stne-0.0.98.dist-info/licenses/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
37
- csc_cia_stne-0.0.98.dist-info/METADATA,sha256=2jVlc-lxFvgLZwjxknjPs_cge_6FfgZ_1LVJDZbc4_U,1419
38
- csc_cia_stne-0.0.98.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
- csc_cia_stne-0.0.98.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
40
- csc_cia_stne-0.0.98.dist-info/RECORD,,
35
+ csc_cia_stne-0.1.0.dist-info/licenses/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
36
+ csc_cia_stne-0.1.0.dist-info/METADATA,sha256=5H9EJPLrYpZK8Vf1is7VXykm_FngzrV0zj_PhEamR8c,1418
37
+ csc_cia_stne-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ csc_cia_stne-0.1.0.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
39
+ csc_cia_stne-0.1.0.dist-info/RECORD,,
@@ -1,147 +0,0 @@
1
- # import platform
2
- # import subprocess
3
- # import time
4
- # import pyautogui
5
- # import psutil
6
- # import pygetwindow as gw
7
- # import logging
8
- # pyautogui.USE_MOUSEINFO = False
9
- # log = logging.getLogger('__main__')
10
-
11
- # def obter_ip_conexao_rdp():
12
- # """Retorna o ip da conexão RDP
13
-
14
- # Returns:
15
- # str: ip
16
- # """
17
-
18
- # for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
19
-
20
- # if proc.info['name'] == 'mstsc.exe' and proc.info['cmdline']:
21
-
22
- # for arg in proc.info['cmdline']:
23
-
24
- # if arg.startswith("/v:"): # O argumento '/v:' contém o IP
25
-
26
- # return arg.replace("/v:", "").strip()
27
-
28
- # return None
29
-
30
- # def verificar_sessao_rdp()->bool:
31
- # """Verifica se a sessão RDP está ativa"""
32
- # # Verifica se o processo mstsc.exe está rodando
33
- # for proc in psutil.process_iter(['name']):
34
- # if proc.info['name'] == 'mstsc.exe':
35
- # #return True
36
-
37
- # # Verifica se a janela da Área de Trabalho Remota está aberta
38
- # for window in gw.getAllTitles():
39
- # if "Área de Trabalho Remota" in window or "Remote Desktop" in window:
40
- # return True
41
-
42
- # return False
43
-
44
- # def conectar_rdp(host:str, usuario:str, senha:str)->bool:
45
- # """Conecta via RDP em uma máquina remota
46
-
47
- # Args:
48
-
49
- # host (str): ip/host destino
50
- # usuario (str): usuário
51
- # senha (str): senha
52
-
53
- # Returns:
54
- # bool: True/False
55
- # """
56
-
57
- # sistema = platform.system()
58
-
59
- # if sistema == "Windows":
60
-
61
- # try:
62
-
63
- # def criar_arquivo_rdp(host, usuario, caminho_rdp="conexao.rdp")->str:
64
- # """Cria um arquivo .rdp para conexão RDP
65
- # Args:
66
- # host (str): host do computador remoto
67
- # usuario (str): Usuário
68
- # caminho_rdp (str): Caminho do arquivo .rdp
69
- # Returns:
70
- # str: Caminho do arquivo .rdp
71
- # """
72
- # conteudo_rdp = f"""
73
- # screen mode id:i:2
74
- # desktopwidth:i:1920
75
- # desktopheight:i:1080
76
- # session bpp:i:32
77
- # winposstr:s:0,1,0,0,800,600
78
- # full address:s:{host}
79
- # username:s:{usuario}
80
- # """
81
- # with open(caminho_rdp, "w") as arquivo:
82
- # arquivo.write(conteudo_rdp.strip())
83
-
84
- # return caminho_rdp
85
-
86
- # caminho_rdp = criar_arquivo_rdp(host, usuario)
87
- # subprocess.run(f"start mstsc {caminho_rdp}", shell=True)
88
- # # Espera a conexão ser feita e confirma que realmente quer fazer a conexão com o computador remoto de forma insegura (certificado)
89
- # time.sleep(10)
90
- # pyautogui.press('left')
91
- # pyautogui.press('enter')
92
- # # Espera 3 segundos para digitar a senha e dar enter
93
- # time.sleep(3)
94
- # pyautogui.write(senha)
95
- # pyautogui.press('enter')
96
- # # Espera 5 segundos para aparecer a tela sobre o certificado e aceitar a conexão de forma insegura (certificado)
97
- # time.sleep(5)
98
- # pyautogui.press('left')
99
- # pyautogui.press('enter')
100
- # # Aguarda 5 segundos e verifica se a conexão foi feita com sucesso
101
- # time.sleep(5)
102
- # return verificar_sessao_rdp()
103
-
104
- # except Exception as e:
105
-
106
- # log.error(f"Erro ao conectar à área de trabalho remota:\n{e}")
107
- # return False
108
-
109
- # elif sistema == "Linux":
110
-
111
- # # Comando para executar a conexao com o xfreerdp
112
- # # Para instalar: sudo apt install freerdp2-x11
113
- # comando_rdp = f"""xfreerdp /u:{usuario} /p:{senha} /v:{host} /size:1920x1080"""
114
-
115
- # # Executar o comando e capturar saída
116
- # try:
117
-
118
- # processo_rdp = subprocess.Popen(
119
- # comando_rdp,
120
- # shell=True,
121
- # stdout=subprocess.PIPE,
122
- # stderr=subprocess.PIPE,
123
- # text=True
124
- # )
125
-
126
- # except Exception as e:
127
-
128
- # 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)}")
129
-
130
- # # Aguarda 10 segundos, para aparecer o banner azul
131
- # time.sleep(10)
132
-
133
- # # Se a conexão foi bem-sucedida, retornar True
134
- # if processo_rdp.poll() is None:
135
-
136
- # # Clica no 'enter', no banner azul
137
- # pyautogui.press('enter')
138
- # return True
139
-
140
- # else:
141
-
142
- # return False
143
-
144
- # else:
145
-
146
- # raise Exception("Sistema operacional não suportado (Somente 'Windows' ou 'Linux').")
147
-