bcpkgfox 0.16.70__tar.gz → 0.16.71__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.

Potentially problematic release.


This version of bcpkgfox might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.70
3
+ Version: 0.16.71
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -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]",
@@ -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)
@@ -412,58 +485,14 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
412
485
  self.driver.close()
413
486
  self.driver.switch_to.window(handles[-1])
414
487
 
415
- def extension_check(self):
416
-
417
- self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
418
- time.sleep(3)
419
-
420
- for _ in range(10):
421
-
422
- # Caso a extensão já esteja instalada
423
- try:
424
- tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1)
425
- return
426
- except: pass
427
-
428
- try:
429
- tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
430
- return
431
- except: pass
432
-
433
- # Caso a extensão não esteja instala
434
- if 'This page has been blocked by Chrome' in driver.page_source:
435
- break
436
-
437
- if 'eliezer@bcfox.com.br' in self.driver.page_source:
438
- tools.find_element_with_wait(By.XPATH, "//span[text()='alterar']").click()
439
- return
440
-
441
- # Abrir uma nova aba
442
- self.driver.execute_script("window.open('');")
443
-
444
- # Fechar a aba original
445
- self.driver.close()
446
-
447
- # Mudar para a nova aba
448
- self.driver.switch_to.window(self.driver.window_handles[-1])
449
-
450
- time.sleep(1)
451
-
452
- self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
453
-
454
- tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
455
- time.sleep(5)
456
-
457
- # Envia TAB e ENTER do teclado físico
458
- pyautogui.press('tab')
459
- time.sleep(0.5)
460
- pyautogui.press('enter')
461
- time.sleep(5)
462
-
463
- self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
464
-
488
+ # Instances
465
489
  tools = tool()
466
490
  api = invokes_whoom()
491
+ protection = Pop_up_protection()
467
492
  bot = whoom_codes()
468
493
 
494
+ # Operacional
495
+ protection.start()
496
+ bot.extension_check()
469
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.70
3
+ Version: 0.16.71
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="bcpkgfox",
5
- version="0.16.70",
5
+ version="0.16.71",
6
6
  author="Guilherme Neri",
7
7
  author_email="guilherme.neri@bcfox.com.br",
8
8
  description="Biblioteca BCFOX",
File without changes
File without changes
File without changes