bcpkgfox 0.16.69__py3-none-any.whl → 0.16.71__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.
bcpkgfox/cli.py CHANGED
@@ -544,6 +544,7 @@ class cli:
544
544
  "PdfWriter": "pypdf",
545
545
  "import PyPDF2": "PyPDF2",
546
546
  "invoke_api_": "requests",
547
+ "login_2fac": "pyautogui",
547
548
  "wait_for": "pygetwindow",
548
549
  "from selenium_stealth import stealth": "selenium-stealth",
549
550
  "capmonstercloudclient": "bcpkgfox[capmonstercloudclient]",
bcpkgfox/invoke_api.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from typing import Optional
2
+ from threading import Thread
2
3
  import time
3
4
 
4
5
  def invoke_api_list(link: str, token: str, method: Optional[str] = "GET", headers: Optional[str] = None, print_response: Optional[bool] = False) -> dict:
@@ -179,6 +180,30 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
179
180
  self.code_timeout = code_timeout
180
181
  self.driver = driver
181
182
 
183
+ class Pop_up_protection(login_2fac):
184
+ def __init__(self):
185
+ super().__init__()
186
+ self.status = False
187
+
188
+ def __monitor(self):
189
+ while self.status:
190
+ for handle in self.driver.window_handles:
191
+ try:
192
+ self.driver.switch_to.window(handle)
193
+ alert = self.driver.switch_to.alert
194
+ alert.accept()
195
+ except:
196
+ pass
197
+ time.sleep(0.1)
198
+
199
+ def start(self):
200
+ self.status = True
201
+ protection = Thread(target=self.__monitor, daemon=True)
202
+ protection.start()
203
+
204
+ def stop(self):
205
+ self.status = False
206
+
182
207
  class tool(login_2fac):
183
208
  def find_element_with_wait(self, by, value, timeout=10):
184
209
  global driver
@@ -252,9 +277,57 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
252
277
  def __init__(self):
253
278
  super().__init__()
254
279
 
255
- def codes_2_fac(self):
280
+ def extension_check(self):
281
+
282
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
283
+ time.sleep(3)
284
+
285
+ for _ in range(10):
286
+
287
+ # Caso a extensão já esteja instalada
288
+ try:
289
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1)
290
+ return
291
+ except: pass
256
292
 
257
- self.extension_check()
293
+ try:
294
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
295
+ return
296
+ except: pass
297
+
298
+ # Caso a extensão não esteja instala
299
+ if 'This page has been blocked by Chrome' in driver.page_source:
300
+ break
301
+
302
+ if 'eliezer@bcfox.com.br' in self.driver.page_source:
303
+ tools.find_element_with_wait(By.XPATH, "//span[text()='alterar']").click()
304
+ return
305
+
306
+ # Abrir uma nova aba
307
+ self.driver.execute_script("window.open('');")
308
+
309
+ # Fechar a aba original
310
+ self.driver.close()
311
+
312
+ # Mudar para a nova aba
313
+ self.driver.switch_to.window(self.driver.window_handles[-1])
314
+
315
+ time.sleep(1)
316
+
317
+ self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
318
+
319
+ tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
320
+ time.sleep(5)
321
+
322
+ # Envia TAB e ENTER do teclado físico
323
+ pyautogui.press('tab')
324
+ time.sleep(0.5)
325
+ pyautogui.press('enter')
326
+ time.sleep(5)
327
+
328
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
329
+
330
+ def codes_2_fac(self):
258
331
 
259
332
  try:
260
333
  tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=2).send_keys(self.system)
@@ -404,62 +477,22 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
404
477
  else:
405
478
  break
406
479
 
407
- # self.driver.switch_to.window(self.driver.window_handles[0])
408
- # self.driver.close()
409
- # self.driver.switch_to.window(self.driver.window_handles[-1])
410
-
411
- def extension_check(self):
412
-
413
- self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
414
- time.sleep(3)
415
-
416
- for _ in range(10):
417
-
418
- # Caso a extensão já esteja instalada
419
- try:
420
- tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1)
421
- return
422
- except: pass
423
-
424
- try:
425
- tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
426
- return
427
- except: pass
428
-
429
- # Caso a extensão não esteja instala
430
- if 'This page has been blocked by Chrome' in driver.page_source:
431
- break
432
-
433
- if 'eliezer@bcfox.com.br' in self.driver.page_source:
434
- tools.find_element_with_wait(By.XPATH, "//span[text()='alterar']").click()
435
- return
436
-
437
- # Abrir uma nova aba
438
- self.driver.execute_script("window.open('');")
439
-
440
- # Fechar a aba original
441
- self.driver.close()
442
-
443
- # Mudar para a nova aba
444
- self.driver.switch_to.window(self.driver.window_handles[-1])
445
-
446
- time.sleep(1)
447
-
448
- self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
449
-
450
- tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
451
480
  time.sleep(5)
452
-
453
- # Envia TAB e ENTER do teclado físico
454
- pyautogui.press('tab')
455
- time.sleep(0.5)
456
- pyautogui.press('enter')
457
- time.sleep(5)
458
-
459
- self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
460
-
481
+ handles = self.driver.window_handles
482
+ self.driver.switch_to.window(handles[-1])
483
+ if len(handles) > 1:
484
+ self.driver.switch_to.window(handles[0])
485
+ self.driver.close()
486
+ self.driver.switch_to.window(handles[-1])
487
+
488
+ # Instances
461
489
  tools = tool()
462
490
  api = invokes_whoom()
491
+ protection = Pop_up_protection()
463
492
  bot = whoom_codes()
464
493
 
494
+ # Operacional
495
+ protection.start()
496
+ bot.extension_check()
465
497
  bot.codes_2_fac()
498
+ protection.stop()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.69
3
+ Version: 0.16.71
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -1,13 +1,13 @@
1
1
  bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
2
2
  bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
- bcpkgfox/cli.py,sha256=6k4GNZimGKKkntuzy54EDKuvc_N0XKWr2N_Ho7nINxw,33497
3
+ bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
4
4
  bcpkgfox/exec_file.py,sha256=fl_Do2SlF7JuXazpNTod-e_0WZUk355fbd7ustQvi40,3728
5
5
  bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
6
6
  bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
7
- bcpkgfox/invoke_api.py,sha256=AFKdB-XDoh6EwdGuuAuQeUdAYR4mjvBBTYyvZahie9Q,17597
7
+ bcpkgfox/invoke_api.py,sha256=3kiSebO1PycSfW8s9VsmuauaDQ93nZGHwDlBCvAfyMs,18634
8
8
  bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
9
- bcpkgfox-0.16.69.dist-info/METADATA,sha256=h5uEkL095gs9kqqWpBDf7dTD8F7NcT5vgJMO0udYYng,1912
10
- bcpkgfox-0.16.69.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
- bcpkgfox-0.16.69.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
- bcpkgfox-0.16.69.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
- bcpkgfox-0.16.69.dist-info/RECORD,,
9
+ bcpkgfox-0.16.71.dist-info/METADATA,sha256=xDHClGkbdxjtOGEVz610iloYWBXJl1QbKp_C59Akw0M,1912
10
+ bcpkgfox-0.16.71.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
+ bcpkgfox-0.16.71.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
+ bcpkgfox-0.16.71.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
+ bcpkgfox-0.16.71.dist-info/RECORD,,