Download chk.py from TuroLele/awk: direct link, hf CLI and curl.
- Browser
- Download file 3.71 kB
-
https://huggingface.co/spaces/TuroLele/awk/resolve/main/chk.py
- Command line
-
hf download hf://spaces/TuroLele/awk/chk.py
-
curl -L -o chk.py https://huggingface.co/spaces/TuroLele/awk/resolve/main/chk.py
3.71 kB
| #!/usr/bin/env python3 | |
| import re | |
| import requests | |
| import argparse | |
| import json | |
| def sys_url(url): | |
| if not re.match(r'^https?://', url): | |
| url = 'https://' + url | |
| return url | |
| def exturlz(text): | |
| urls = re.findall(r'https?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', text) | |
| if not urls: | |
| urls = re.findall(r'www\.(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', text) | |
| urls = [sys_url(url) for url in urls] | |
| return urls | |
| def check_website(url): | |
| try: | |
| response = requests.get(url, timeout=10) | |
| html_content = response.text.lower() | |
| httpstat = response.status_code | |
| cloudflare = 'server' in response.headers and 'cloudflare' in response.headers['server'].lower() | |
| captcha = 'recaptcha' in html_content or 'captcha' in html_content | |
| pymnt_gwayz = { | |
| 'Stripe': ['stripe'], | |
| 'PayPal': ['paypal'], | |
| 'Shopify Payments': ['shopify'], | |
| 'Braintree': ['braintree'], | |
| 'Authorize.Net': ['authorize.net'], | |
| 'Afterpay': ['afterpay'], | |
| 'Worldpay': ['worldpay'], | |
| 'Square': ['squareup', 'square.com'], | |
| 'Adyen': ['adyen'], | |
| 'ProcessOut': ['processout'], | |
| 'Recurly': ['recurly'], | |
| 'Airwallex': ['airwallex'], | |
| 'Xendit': ['xendit'] | |
| } | |
| gateways = [] | |
| for gateway, keywords in pymnt_gwayz.items(): | |
| if any(keyword in html_content for keyword in keywords): | |
| gateways.append(gateway) | |
| platform = 'WooCommerce' if 'woocommerce' in html_content else 'Unknown' | |
| # Get IP info from check-host.cc API | |
| api_url = 'https://check-host.cc/rest/V2/info' | |
| headers = {'accept': 'application/json', 'Content-Type': 'application/json'} | |
| data = {'target': url, 'apikey': 'NOKEY', 'ClientIP': None} | |
| # Replace 'NOKEY' with your actual check-host.cc API key | |
| response_ip = requests.post(api_url, headers=headers, data=json.dumps(data)) | |
| ip_info = response_ip.json() | |
| # Extract relevant information from IP info | |
| ip_details = f"""IP: {ip_info.get('ip', 'N/A')} | |
| Hostname: {ip_info.get('hostname', 'N/A')} | |
| ISP: {ip_info.get('isp', 'N/A')} | |
| ASN: {ip_info.get('asn', 'N/A')} | |
| ORG: {ip_info.get('org', 'N/A')} | |
| Country: {ip_info.get('country', 'N/A')} | |
| Region: {ip_info.get('region', 'N/A')} | |
| City: {ip_info.get('city', 'N/A')} | |
| Timezone: {ip_info.get('timezone', 'N/A')} | |
| """ | |
| chk_msg = f"""```TELEGRAM @VANO_GANZZZ | |
| π Site Check Report π | |
| β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’ | |
| {ip_details} | |
| Site : {url} | |
| Gateways : {', '.join(gateways) if gateways else 'Unknown'} | |
| Cloudflare : {'β ' if cloudflare else 'β'} | |
| Captcha : {'β ' if captcha else 'β'} | |
| Platform : {platform} | |
| HTTPS Status : {httpstat}``` | |
| Check-Host: https://check-host.cc/?m=INFO&target={url}""" | |
| return chk_msg | |
| except Exception as e: | |
| error_msg = f""" | |
| π **Site Check Report** π | |
| β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’ | |
| κ **Site** : {url} | |
| κ **Error** : {str(e)} | |
| β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’β’ββ’""" | |
| return error_msg | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser(description="Website checker script") | |
| parser.add_argument("url", help="The URL of the website to check") | |
| args = parser.parse_args() | |
| result = check_website(args.url) | |
| print(result) |