bcpkgfox 0.17.8__py3-none-any.whl → 0.17.10__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.
Potentially problematic release.
This version of bcpkgfox might be problematic. Click here for more details.
- bcpkgfox/invoke_api.py +22 -6
- bcpkgfox/login_2factor.py +98 -0
- {bcpkgfox-0.17.8.dist-info → bcpkgfox-0.17.10.dist-info}/METADATA +1 -1
- bcpkgfox-0.17.10.dist-info/RECORD +13 -0
- {bcpkgfox-0.17.8.dist-info → bcpkgfox-0.17.10.dist-info}/WHEEL +1 -1
- bcpkgfox-0.17.8.dist-info/RECORD +0 -12
- {bcpkgfox-0.17.8.dist-info → bcpkgfox-0.17.10.dist-info}/entry_points.txt +0 -0
- {bcpkgfox-0.17.8.dist-info → bcpkgfox-0.17.10.dist-info}/top_level.txt +0 -0
bcpkgfox/invoke_api.py
CHANGED
|
@@ -149,7 +149,8 @@ def invoke_api_proc(link: str, payload_vars: dict, token: str, method: str, prin
|
|
|
149
149
|
time.sleep(5)
|
|
150
150
|
continue
|
|
151
151
|
|
|
152
|
-
else:
|
|
152
|
+
else:
|
|
153
|
+
raise ValueError("Api proc final falhou")
|
|
153
154
|
|
|
154
155
|
def invoke_api_proc_log(link, id_robo, token):
|
|
155
156
|
import requests
|
|
@@ -200,7 +201,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
200
201
|
except:
|
|
201
202
|
pass
|
|
202
203
|
|
|
203
|
-
time.sleep(
|
|
204
|
+
time.sleep(1)
|
|
204
205
|
|
|
205
206
|
def start(self):
|
|
206
207
|
self.status = True
|
|
@@ -253,7 +254,8 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
253
254
|
time.sleep(5)
|
|
254
255
|
continue
|
|
255
256
|
else:
|
|
256
|
-
|
|
257
|
+
self.driver.quit()
|
|
258
|
+
raise('Todas as tentativas falharam!')
|
|
257
259
|
|
|
258
260
|
def invoke_update_status(self, id):
|
|
259
261
|
|
|
@@ -277,6 +279,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
277
279
|
time.sleep(5)
|
|
278
280
|
continue
|
|
279
281
|
else:
|
|
282
|
+
self.driver.quit()
|
|
280
283
|
raise('Todas as tentativas falharam!')
|
|
281
284
|
|
|
282
285
|
class whoom_codes(login_2fac):
|
|
@@ -322,8 +325,16 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
322
325
|
|
|
323
326
|
self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
|
|
324
327
|
|
|
328
|
+
try:
|
|
329
|
+
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
|
|
330
|
+
|
|
331
|
+
except:
|
|
332
|
+
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'do Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
|
|
333
|
+
pyautogui.press('enter')
|
|
334
|
+
time.sleep(1)
|
|
335
|
+
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
|
|
336
|
+
|
|
325
337
|
|
|
326
|
-
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
|
|
327
338
|
time.sleep(5)
|
|
328
339
|
import pygetwindow as gw
|
|
329
340
|
windows = gw.getAllTitles()
|
|
@@ -435,6 +446,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
435
446
|
break
|
|
436
447
|
|
|
437
448
|
if not(code_insertion):
|
|
449
|
+
self.driver.quit()
|
|
438
450
|
raise TimeoutError('Código WHOOM não chegou dentro do timeout estabelecido')
|
|
439
451
|
|
|
440
452
|
def select_system(self):
|
|
@@ -477,6 +489,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
477
489
|
|
|
478
490
|
if not div_list:
|
|
479
491
|
mostrar_mensagem('Não conseguiu achar o sistema no certificado')
|
|
492
|
+
self.driver.quit()
|
|
480
493
|
raise ValueError('Não conseguiu achar o sistema no certificado')
|
|
481
494
|
|
|
482
495
|
if len(div_list) == 1:
|
|
@@ -492,8 +505,11 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
492
505
|
|
|
493
506
|
if len(div_list) == 1:
|
|
494
507
|
div_list[0].click()
|
|
508
|
+
elif len(div_list) == 2:
|
|
509
|
+
div_list[0].click()
|
|
495
510
|
else:
|
|
496
511
|
mostrar_mensagem('Mais de um sistema encontrado, verifique o nome do sistema no WHOOM e coloque um nome único na função')
|
|
512
|
+
self.driver.quit()
|
|
497
513
|
raise ValueError('Mais de um sistema encontrado, verifique o nome')
|
|
498
514
|
|
|
499
515
|
try:
|
|
@@ -507,7 +523,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
507
523
|
pass
|
|
508
524
|
|
|
509
525
|
# Verifies if the system was opened
|
|
510
|
-
for _ in range(
|
|
526
|
+
for _ in range(40):
|
|
511
527
|
time.sleep(1)
|
|
512
528
|
if len(self.driver.window_handles) == 1:
|
|
513
529
|
try:
|
|
@@ -545,4 +561,4 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
545
561
|
bot.extension_check()
|
|
546
562
|
protection.start()
|
|
547
563
|
bot.codes_2_fac()
|
|
548
|
-
bot.select_system()
|
|
564
|
+
bot.select_system()
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import requests, time
|
|
2
|
+
|
|
3
|
+
class Login2facmycena:
|
|
4
|
+
def __init__(self, uf, sistema, advogado, token, maximo = 5):
|
|
5
|
+
self.codes = None
|
|
6
|
+
self.api = ApiControll(uf, sistema, advogado, token)
|
|
7
|
+
self.code_timeout = maximo
|
|
8
|
+
|
|
9
|
+
def processar_codes(self):
|
|
10
|
+
max_attempts = self.code_timeout
|
|
11
|
+
five_attempts = 0
|
|
12
|
+
ten_attempts = 0
|
|
13
|
+
|
|
14
|
+
while five_attempts <= max_attempts:
|
|
15
|
+
five_attempts += 1
|
|
16
|
+
self.codes = self.api.listar_codigos_otp()
|
|
17
|
+
if self.codes:
|
|
18
|
+
print("Códigos obtidos com sucesso:")
|
|
19
|
+
return self.codes
|
|
20
|
+
else:
|
|
21
|
+
print("Solicitando novo codigo.")
|
|
22
|
+
self.api.solicitar_codigos_otp()
|
|
23
|
+
while ten_attempts <=10:
|
|
24
|
+
ten_attempts += 1
|
|
25
|
+
self.codes = self.api.listar_codigos_otp()
|
|
26
|
+
if self.codes:
|
|
27
|
+
return self.codes
|
|
28
|
+
time.sleep(15)
|
|
29
|
+
return None
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ApiControll:
|
|
34
|
+
def __init__(self, uf, sistema, advogado, tk):
|
|
35
|
+
super().__init__()
|
|
36
|
+
self.uf = uf
|
|
37
|
+
self.sistema = sistema
|
|
38
|
+
self.advogado = advogado
|
|
39
|
+
self.token = tk
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def solicitar_codigos_otp(self):
|
|
43
|
+
url = "https://api-4.bcfox.com.br/bcjur/views/codigos-otp"
|
|
44
|
+
headers = {
|
|
45
|
+
"x-access-token": self.token,
|
|
46
|
+
"Content-Type": "application/json"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
payload = {
|
|
50
|
+
"uf": self.uf,
|
|
51
|
+
"advogado": self.advogado,
|
|
52
|
+
"sistema": self.sistema
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for tentativa in range(1, 6):
|
|
56
|
+
try:
|
|
57
|
+
response = requests.post(url, headers=headers, json=payload, timeout=30)
|
|
58
|
+
|
|
59
|
+
if response.status_code == 200:
|
|
60
|
+
print(
|
|
61
|
+
f"Tentativa {tentativa}: Requisição bem-sucedida. Código de status: {response.status_code}")
|
|
62
|
+
response_data = response.json()
|
|
63
|
+
print(response_data)
|
|
64
|
+
return response_data
|
|
65
|
+
else:
|
|
66
|
+
print(f"Tentativa {tentativa}: Erro na requisição. Código de status: {response.status_code}")
|
|
67
|
+
|
|
68
|
+
except requests.RequestException as e:
|
|
69
|
+
print(f"Tentativa {tentativa}: Ocorreu um erro na requisição: {e}")
|
|
70
|
+
|
|
71
|
+
time.sleep(1)
|
|
72
|
+
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
def listar_codigos_otp(self):
|
|
76
|
+
url = f"https://api-4.bcfox.com.br/bcjur/views/codigos-otp/robo/{self.uf}/{self.sistema}/{self.advogado}"
|
|
77
|
+
headers = {"x-access-token": self.token}
|
|
78
|
+
|
|
79
|
+
# Retries authenticated OTP code listing on failure
|
|
80
|
+
for tentativa in range(1, 6):
|
|
81
|
+
try:
|
|
82
|
+
response = requests.get(url, headers=headers, timeout=30)
|
|
83
|
+
|
|
84
|
+
if response.status_code == 200:
|
|
85
|
+
response_data = response.json()
|
|
86
|
+
if response_data:
|
|
87
|
+
return response_data[0].get("CODIGO_OTP")
|
|
88
|
+
|
|
89
|
+
else:
|
|
90
|
+
print(f"Tentativa {tentativa}: Status {response.status_code}")
|
|
91
|
+
|
|
92
|
+
except requests.RequestException as e:
|
|
93
|
+
print(f"Tentativa {tentativa}: Erro na requisição: {e}")
|
|
94
|
+
|
|
95
|
+
time.sleep(1)
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
|
|
2
|
+
bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
|
|
3
|
+
bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
|
|
4
|
+
bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
|
|
5
|
+
bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
|
|
6
|
+
bcpkgfox/invoke_api.py,sha256=DSaeHRGAvi0BV05anvZknzuiSBUvv1lmQ35xX_JFyC4,21296
|
|
7
|
+
bcpkgfox/login_2factor.py,sha256=O7zVpZhVxNS3VacB3gFit3Rlu8Dma9uKwOy3jaQGFf8,3560
|
|
8
|
+
bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
|
|
9
|
+
bcpkgfox-0.17.10.dist-info/METADATA,sha256=q4scE6oZEj85esmabkqXQv3gs7BmFIaXG5WqjG5bE5c,1894
|
|
10
|
+
bcpkgfox-0.17.10.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
11
|
+
bcpkgfox-0.17.10.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
|
|
12
|
+
bcpkgfox-0.17.10.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
|
|
13
|
+
bcpkgfox-0.17.10.dist-info/RECORD,,
|
bcpkgfox-0.17.8.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
|
|
2
|
-
bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
|
|
3
|
-
bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
|
|
4
|
-
bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
|
|
5
|
-
bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
|
|
6
|
-
bcpkgfox/invoke_api.py,sha256=qvxmNGkaHmse2P9PPdZUia6KrDu5ly-2m83mUh3ENGI,20540
|
|
7
|
-
bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
|
|
8
|
-
bcpkgfox-0.17.8.dist-info/METADATA,sha256=puzPjakadkhishgfZyxU-d0jQMwglnoIDfr4Q5tsdpU,1893
|
|
9
|
-
bcpkgfox-0.17.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
bcpkgfox-0.17.8.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
|
|
11
|
-
bcpkgfox-0.17.8.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
|
|
12
|
-
bcpkgfox-0.17.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|