(con, proxy_li, proxy_ty, url=None)
| 1637 | |
| 1638 | |
| 1639 | def handleProxyList(con, proxy_li, proxy_ty, url=None): |
| 1640 | if proxy_ty not in {4, 5, 1, 0, 6}: |
| 1641 | exit("Socks Type Not Found [4, 5, 1, 0, 6]") |
| 1642 | if proxy_ty == 6: |
| 1643 | proxy_ty = randchoice([4, 5, 1]) |
| 1644 | if not proxy_li.exists(): |
| 1645 | logger.warning( |
| 1646 | f"{bcolors.WARNING}The file doesn't exist, creating files and downloading proxies.{bcolors.RESET}") |
| 1647 | proxy_li.parent.mkdir(parents=True, exist_ok=True) |
| 1648 | with proxy_li.open("w") as wr: |
| 1649 | Proxies: Set[Proxy] = ProxyManager.DownloadFromConfig(con, proxy_ty) |
| 1650 | logger.info( |
| 1651 | f"{bcolors.OKBLUE}{len(Proxies):,}{bcolors.WARNING} Proxies are getting checked, this may take awhile{bcolors.RESET}!" |
| 1652 | ) |
| 1653 | Proxies = ProxyChecker.checkAll( |
| 1654 | Proxies, timeout=5, threads=threads, |
| 1655 | url=url.human_repr() if url else "http://httpbin.org/get", |
| 1656 | ) |
| 1657 | |
| 1658 | if not Proxies: |
| 1659 | exit( |
| 1660 | "Proxy Check failed, Your network may be the problem" |
| 1661 | " | The target may not be available." |
| 1662 | ) |
| 1663 | stringBuilder = "" |
| 1664 | for proxy in Proxies: |
| 1665 | stringBuilder += (proxy.__str__() + "\n") |
| 1666 | wr.write(stringBuilder) |
| 1667 | |
| 1668 | proxies = ProxyUtiles.readFromFile(proxy_li) |
| 1669 | if proxies: |
| 1670 | logger.info(f"{bcolors.WARNING}Proxy Count: {bcolors.OKBLUE}{len(proxies):,}{bcolors.RESET}") |
| 1671 | else: |
| 1672 | logger.info( |
| 1673 | f"{bcolors.WARNING}Empty Proxy File, running flood without proxy{bcolors.RESET}") |
| 1674 | proxies = None |
| 1675 | |
| 1676 | return proxies |
| 1677 | |
| 1678 | |
| 1679 | if __name__ == '__main__': |
no test coverage detected