from http.server import HTTPServer, BaseHTTPRequestHandler import json import random import string import ssl from datetime import datetime import user_agents import geoip2.database # Configuration HOST = 'sub1.kalkikrivadna.com' PORT = 5000 # In-memory storage url_database = {} tracking_data = {} def generate_short_code(): chars = string.ascii_letters + string.digits return ''.join(random.choice(chars) for _ in range(6)) def get_location_info(ip): try: reader = geoip2.database.Reader('/usr/share/GeoIP/GeoLite2-City.mmdb') response = reader.city(ip) return { 'country': response.country.name, 'city': response.city.name, 'latitude': response.location.latitude, 'longitude': response.location.longitude, 'timezone': response.location.time_zone, 'continent': response.continent.name } except Exception as e: print(f"Error getting location info: {e}") return None def get_isp_info(ip): try: reader = geoip2.database.Reader('/usr/share/GeoIP/GeoLite2-ASN.mmdb') response = reader.asn(ip) return { 'isp': response.autonomous_system_organization, 'asn': response.autonomous_system_number } except Exception as e: print(f"Error getting ISP info: {e}") return None def detect_vpn(ip): vpn_indicators = { 'is_vpn': False, 'reasons': [] } vpn_keywords = ['vpn', 'proxy', 'hosting', 'cloud', 'datacenter'] isp_info = get_isp_info(ip) if isp_info and isp_info['isp']: isp_lower = isp_info['isp'].lower() for keyword in vpn_keywords: if keyword in isp_lower: vpn_indicators['is_vpn'] = True vpn_indicators['reasons'].append(f"ISP contains VPN indicator: {keyword}") return vpn_indicators def get_device_info(user_agent_string): try: user_agent = user_agents.parse(user_agent_string) return { 'browser': { 'family': user_agent.browser.family, 'version': user_agent.browser.version_string }, 'os': { 'family': user_agent.os.family, 'version': user_agent.os.version_string }, 'device': { 'family': user_agent.device.family, 'brand': user_agent.device.brand, 'model': user_agent.device.model }, 'is_mobile': user_agent.is_mobile, 'is_tablet': user_agent.is_tablet, 'is_pc': user_agent.is_pc, 'is_bot': user_agent.is_bot } except Exception as e: print(f"Error getting device info: {e}") return None class URLShortenerHandler(BaseHTTPRequestHandler): def send_html(self, title, content): """Helper method to send HTML with consistent styling""" html = f"""
WELCOME TO THE MOST SECURE AND ADVANCED URL SHORTENER IN THE MATRIX
Help keep our servers running in the cybernet
ETH: 0x6D16adD0B9576CfCc533371f7e9A92Fa0806Aa13
SOURCE URL: {original_url}
MATRIX HITS: {clicks}
HASH ID: {short_code}
TIMESTAMP: {entry['timestamp']}
NEURAL IP: {entry['ip']}
PRIVATE IP: {entry.get('private_ip', 'Unknown')}
BROWSER: {device_info.get('browser', {}).get('family', 'Unknown')} {device_info.get('browser', {}).get('version', '')}
OS: {device_info.get('os', {}).get('family', 'Unknown')} {device_info.get('os', {}).get('version', '')}
DEVICE: {device_info.get('device', {}).get('family', 'Unknown')} {device_info.get('device', {}).get('brand', '')} {device_info.get('device', {}).get('model', '')}
TYPE: {'Mobile' if device_info.get('is_mobile') else 'Tablet' if device_info.get('is_tablet') else 'PC' if device_info.get('is_pc') else 'Unknown'}
COUNTRY: {location.get('country', 'Unknown')}
CITY: {location.get('city', 'Unknown')}
CONTINENT: {location.get('continent', 'Unknown')}
TIMEZONE: {location.get('timezone', 'Unknown')}
COORDINATES: {location.get('latitude', 'Unknown')}, {location.get('longitude', 'Unknown')}
ISP: {isp_info.get('isp', 'Unknown')}
ASN: {isp_info.get('asn', 'Unknown')}
VPN STATUS: {'DETECTED' if vpn_info.get('is_vpn') else 'CLEAN'}
{f"VPN SIGNATURES: {', '.join(vpn_info.get('reasons', []))}
" if vpn_info.get('is_vpn') else ''}ORIGIN: {entry['referer']}
USER SIGNATURE: {entry['user_agent']}