Skip to content

Instantly share code, notes, and snippets.

@tyhallcsu
Created September 4, 2024 07:06
Show Gist options
  • Save tyhallcsu/ed278b7ef56040153924285460636fa0 to your computer and use it in GitHub Desktop.
Save tyhallcsu/ed278b7ef56040153924285460636fa0 to your computer and use it in GitHub Desktop.
HTML page with embedded JavaScript that implements the core functionality of the CID converter tool.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CID Converter Tool</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: auto;
background: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
h1, h2 {
color: #333;
}
input[type="text"], button {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
button {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#results {
margin-top: 20px;
padding: 10px;
background-color: #e7e7e7;
border-radius: 5px;
}
</style>
</head>
<body>
<div class="container">
<h1>CID Converter Tool</h1>
<p>Enter a CID, FID, or Google Maps URL to convert and generate links.</p>
<input type="text" id="input" placeholder="Enter CID, FID, or Google Maps URL">
<button onclick="convertCID()">Convert and Generate Links</button>
<div id="results"></div>
</div>
<script>
function convertCID() {
const input = $('#input').val().trim();
let cid = extractCID(input);
if (!cid) {
$('#results').html('<p>Invalid input. Please enter a valid CID, FID, or Google Maps URL.</p>');
return;
}
const decimalCID = BigInt(cid).toString(10);
const hexCID = BigInt(cid).toString(16);
const results = `
<h2>Results:</h2>
<p><strong>Decimal CID:</strong> ${decimalCID}</p>
<p><strong>Hexadecimal CID:</strong> ${hexCID}</p>
<p><strong>Google Maps Link:</strong> <a href="https://maps.google.com/?cid=${decimalCID}" target="_blank">https://maps.google.com/?cid=${decimalCID}</a></p>
<p><strong>Google Search Link:</strong> <a href="https://www.google.com/search?q=&ludocid=${decimalCID}" target="_blank">https://www.google.com/search?q=&ludocid=${decimalCID}</a></p>
`;
$('#results').html(results);
}
function extractCID(input) {
// Extract CID from various input formats
const cidRegex = /(?:cid=|ludocid=|0x)([0-9a-fA-F]+)/;
const match = input.match(cidRegex);
return match ? match[1] : null;
}
</script>
</body>
</html>
@tyhallcsu
Copy link
Author

A basic version of the CID converter tool

CleanShot 2024-09-04 at 03 07 33@2x

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CID Converter Tool</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 800px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1, h2 {
            color: #333;
        }
        input[type="text"], button {
            width: 100%;
            padding: 10px;
            margin-bottom: 10px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background-color: #45a049;
        }
        #results {
            margin-top: 20px;
            padding: 10px;
            background-color: #e7e7e7;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>CID Converter Tool</h1>
        <p>Enter a CID, FID, or Google Maps URL to convert and generate links.</p>
        <input type="text" id="input" placeholder="Enter CID, FID, or Google Maps URL">
        <button onclick="convertCID()">Convert and Generate Links</button>
        <div id="results"></div>
    </div>

    <script>
        function convertCID() {
            const input = $('#input').val().trim();
            let cid = extractCID(input);
            
            if (!cid) {
                $('#results').html('<p>Invalid input. Please enter a valid CID, FID, or Google Maps URL.</p>');
                return;
            }

            const decimalCID = BigInt(cid).toString(10);
            const hexCID = BigInt(cid).toString(16);

            const results = `
                <h2>Results:</h2>
                <p><strong>Decimal CID:</strong> ${decimalCID}</p>
                <p><strong>Hexadecimal CID:</strong> ${hexCID}</p>
                <p><strong>Google Maps Link:</strong> <a href="https://maps.google.com/?cid=${decimalCID}" target="_blank">https://maps.google.com/?cid=${decimalCID}</a></p>
                <p><strong>Google Search Link:</strong> <a href="https://www.google.com/search?q=&ludocid=${decimalCID}" target="_blank">https://www.google.com/search?q=&ludocid=${decimalCID}</a></p>
            `;

            $('#results').html(results);
        }

        function extractCID(input) {
            // Extract CID from various input formats
            const cidRegex = /(?:cid=|ludocid=|0x)([0-9a-fA-F]+)/;
            const match = input.match(cidRegex);
            return match ? match[1] : null;
        }
    </script>
</body>
</html>

I've created a basic HTML page with embedded JavaScript that implements the core functionality of the CID converter tool.

Here's a breakdown of what this tool does:

  1. It provides an input field where users can enter a CID, FID, or Google Maps URL.
  2. When the user clicks the "Convert and Generate Links" button, it attempts to extract the CID from the input.
  3. If successful, it converts the CID to both decimal and hexadecimal formats.
  4. It then generates links to Google Maps and Google Search using the extracted CID.
  5. The results are displayed on the page.

To use this on your new domain:

  1. Save this HTML content to a file (e.g., cid-converter.html).
  2. Upload the file to your new web server.
  3. You can then access the tool by navigating to http://your-new-domain.com/cid-converter.html in a web browser.

This is a simplified version of the tool. It doesn't include all the features of the original (like the autocomplete field or OSINT mode), but it provides the core functionality. You can expand on this base to add more features as needed.

Some notes:

  • The tool uses jQuery for simplicity. Make sure the CDN link for jQuery remains accessible.
  • The design is basic. You might want to style it further to match your website's look and feel.
  • Error handling is minimal. You might want to add more robust input validation and error messages.
  • This version doesn't make any external API calls. If you need to integrate with a backend service, you'll need to modify the JavaScript accordingly.

@tyhallcsu
Copy link
Author

Update: CID Converter Tool with OSINT Mode

This is an update to the previous CID Converter Tool. The new version includes an OSINT (Open-Source Intelligence) Mode, providing additional information about the business associated with the CID.

CleanShot 2024-09-04 at 03 13 13@2x

New Features:

  1. OSINT Mode Checkbox: Users can now toggle OSINT Mode on/off.
  2. Extended Information Display: When OSINT Mode is enabled, the tool displays additional details about the business, including:
    • Place ID
    • Business Name
    • Address
    • Phone Number
    • Latitude and Longitude
    • Link to Google Reviews
    • Website
    • Social Media Profiles (Facebook, Twitter, Instagram)

Technical Updates:

  • Added JavaScript functionality to handle OSINT Mode toggle.
  • Implemented a simulated OSINT data object (to be replaced with actual API calls in production).
  • Enhanced CSS for better presentation of OSINT results.

Usage:

  1. Enter a CID, FID, or Google Maps URL in the input field.
  2. Check the "OSINT Mode" box if you want additional information.
  3. Click "Convert and Generate Links".
  4. View the results, including OSINT data if enabled.

Note for Implementation:

The current version uses simulated OSINT data. For a production environment, you should:

  • Implement server-side processing for security.
  • Use actual APIs or data sources to retrieve OSINT information.
  • Add proper error handling and data validation.
  • Consider rate limiting and caching for API management.

This update enhances the tool's functionality, making it more useful for those needing comprehensive information about a business based on its CID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment