| 12748 | return results |
| 12749 | |
| 12750 | def ignorant_scan(self, phone_input): |
| 12751 | phone_input = (phone_input or "").strip() |
| 12752 | if not phone_input: |
| 12753 | return [{"username": phone_input, "type": "Ignorant", "info": {"Status": " Numero mancante"}, "main_img": "https://cdn-icons-png.flaticon.com/512/733/733585.png", "status_code": 400, "url": ""}] |
| 12754 | |
| 12755 | try: |
| 12756 | import trio |
| 12757 | import httpx |
| 12758 | import pkgutil |
| 12759 | import importlib |
| 12760 | import inspect |
| 12761 | import ignorant.modules |
| 12762 | except Exception as e: |
| 12763 | return [{"username": phone_input, "type": "Ignorant", "info": {"Status": f" Ignorant non disponibile: {e}"}, "main_img": "https://cdn-icons-png.flaticon.com/512/733/733585.png", "status_code": 500, "url": ""}] |
| 12764 | |
| 12765 | # Parse numero per ottenere country_code e national number |
| 12766 | cc = None |
| 12767 | national = None |
| 12768 | try: |
| 12769 | p = phonenumbers.parse(phone_input, None) |
| 12770 | if phonenumbers.is_possible_number(p): |
| 12771 | cc = str(p.country_code) |
| 12772 | national = str(p.national_number) |
| 12773 | except Exception: |
| 12774 | pass |
| 12775 | |
| 12776 | # Fallback: prova a togliere '+' e separare |
| 12777 | if not cc or not national: |
| 12778 | digits = re.sub(r"\D+", "", phone_input) |
| 12779 | if digits.startswith("00"): |
| 12780 | digits = digits[2:] |
| 12781 | # default IT se non specificato (fallback best effort) |
| 12782 | if phone_input.startswith("+") and len(digits) >= 4: |
| 12783 | # prova 1..3 cifre per country code |
| 12784 | for n in (1, 2, 3): |
| 12785 | cc_try = digits[:n] |
| 12786 | nat_try = digits[n:] |
| 12787 | if nat_try and len(nat_try) >= 6: |
| 12788 | cc = cc_try |
| 12789 | national = nat_try |
| 12790 | break |
| 12791 | if not cc or not national: |
| 12792 | cc = "39" |
| 12793 | national = digits |
| 12794 | |
| 12795 | results = [] |
| 12796 | |
| 12797 | async def _run(): |
| 12798 | out = [] |
| 12799 | async with httpx.AsyncClient(timeout=10) as client: |
| 12800 | for m in pkgutil.walk_packages(ignorant.modules.__path__, ignorant.modules.__name__ + "."): |
| 12801 | modname = m.name |
| 12802 | basename = modname.split(".")[-1] |
| 12803 | try: |
| 12804 | mod = importlib.import_module(modname) |
| 12805 | except Exception: |
| 12806 | continue |
| 12807 | |