master
Suvodip 2024-10-21 16:23:40 +05:30
parent 083494bd4d
commit f7306b70c8
7 changed files with 312 additions and 80 deletions

View File

@ -3,7 +3,7 @@ require_once('.hta_config/db_config.php');
require_once('.htac_header.php');
?>
<section class="diZContainer diZmxAuto">
<section class="diZContainer diZmxAuto diZmb20">
<h1 class="diZBorderBottom">SiliconPin - Tools</h1>
<div class="diZFlexRow diZmy8 diZFlexRow">
<a href="/tools" class="diZButtonDefault diZmr2"><span>All</span></a>

View File

@ -3,7 +3,7 @@ require_once('.hta_config/db_config.php');
require_once('.htac_header.php');
?>
<section class="diZContainer diZmxAuto">
<section class="diZContainer diZmxAuto diZmb20">
<h1 class="diZBorderBottom">SiliconPin - Tools</h1>
<div class="diZFlexRow diZmy8 diZFlexRow diZOverflowAuto diZWhiteSpaceNowrap">
<a href="/tools" class="diZButtonDefault diZmr2"><span>All</span></a>

113
color-code-from-image.php Normal file
View File

@ -0,0 +1,113 @@
<section class="diZContainer diZmxAuto diZmy8">
<h1 class="diZBorderBottom">Color Hex/RGB Code From Image</h1>
<p>The Color Code Extractor from Image is a simple and efficient web-based tool that allows users to upload an image and click on any part of it to get the RGB and HEX color codes of the pixel they clicked on. This tool is particularly useful for designers, developers, and anyone who needs to identify and use specific colors from images.</p>
<div class="diZMaxW600 diZmxAuto toolsSection">
<label class="diZFlexColumn " for="imageInput">Choose Image</label><br>
<input class="diZPadding10px" type="file" id="imageInput" accept="image/*" /><br><br>
<canvas class="diZDisplayNone diZw100" id="canvas"></canvas><br>
<div class="diZFlexBetween">
<div id="result">Click on the image to get the color code.</div>
<button class="diZDisplayNone" id="copyButton" ><span>Copy</span></button>
</div>
</div>
<div>
<h2>Usage:</h2>
<ul>
<li><strong>Upload an Image:</strong> Click on the file input field and select an image file from your device.</li>
<li><strong>Display the Image:</strong> Once the image is uploaded, it will be displayed on a hidden canvas element.</li>
<li><strong>Extract Color Code:</strong> Click on any part of the displayed image. The tool will capture the color of the clicked pixel and display both the RGB and HEX color codes.</li>
<li><strong>Copy Color Code:</strong> Click the "Copy Color Code" button to copy the displayed color code to your clipboard for easy use in your projects.</li>
</ul>
<h2>Features:</h2>
<ul>
<li><strong>Easy Image Upload:</strong> Supports uploading images directly from your device.</li>
<li><strong>Accurate Color Extraction:</strong> Retrieves the exact RGB and HEX color codes from any pixel of the image.</li>
<li><strong>Clipboard Copy Functionality:</strong> Allows you to easily copy the extracted color codes to your clipboard.</li>
<li><strong>Fallback for Compatibility:</strong> Provides a fallback method for copying color codes on browsers that do not support the Clipboard API.</li>
<li><strong>User-Friendly Interface:</strong> Simple and intuitive design for ease of use.</li>
</ul>
<h2>Use Case:</h2>
<ul>
<li><strong>Web Designers and Developers:</strong> Quickly extract color codes from images for use in web design and development projects.</li>
<li><strong>Graphic Designers:</strong> Identify and use specific colors from images in design software.</li>
<li><strong>Digital Artists:</strong> Match colors from reference images to create cohesive artworks.</li>
<li><strong>Marketing Professionals:</strong> Ensure brand consistency by extracting and using exact colors from marketing materials and logos.</li>
<li><strong>DIY Enthusiasts:</strong> Use color codes to match paint colors, fabrics, or other materials in home decoration projects.</li>
</ul>
</div>
</section>
<script>
document.addEventListener('DOMContentLoaded', function() {
const imageInput = document.getElementById('imageInput');
const copyButton = document.getElementById('copyButton');
imageInput.addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const img = new Image();
img.onload = function() {
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
canvas.style.display = 'block';
canvas.addEventListener('click', function(event) {
const rect = canvas.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
console.log(`Clicked at (x, y): (${x}, ${y})`);
try {
const imageData = ctx.getImageData(x, y, 1, 1).data;
const rgb = `rgb(${imageData[0]}, ${imageData[1]}, ${imageData[2]})`;
const hex = `#${((1 << 24) + (imageData[0] << 16) + (imageData[1] << 8) + imageData[2]).toString(16).slice(1).toUpperCase()}`;
const colorCode = `RGB: ${rgb}, HEX: ${hex}`;
console.log('Color code:', colorCode);
document.getElementById('result').innerText = colorCode;
copyButton.style.display = 'block';
copyButton.setAttribute('data-color-code', colorCode);
} catch (err) {
console.error('Error getting image data:', err);
}
});
};
img.src = e.target.result;
};
reader.readAsDataURL(file);
}
});
copyButton.addEventListener('click', function() {
const colorCode = copyButton.getAttribute('data-color-code');
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(colorCode).then(() => {
console.log('Color code copied to clipboard');
}).catch(err => {
console.error('Could not copy text: ', err);
});
} else {
const textarea = document.createElement('textarea');
textarea.value = colorCode;
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
console.log('Color code copied to clipboard');
copyButton.innerHTML = '<span>Copied!</span>';
setTimeout(() => {
copyButton.innerHTML = '<span>Copy</span>';
}, 2000);
} catch (err) {
console.error('Could not copy text: ', err);
}
document.body.removeChild(textarea);
}
});
});
</script>

6
geoip_domain.php Normal file
View File

@ -0,0 +1,6 @@
<?php
$isp = geoip_isp_by_name('www.example.com');
if ($isp) {
echo 'This host IP is from ISP: ' . $isp;
}
?>

View File

@ -1,21 +1,118 @@
<?php
require '.hta_lib/vendors/maxmind-db-reader/vendor/autoload.php';
use GeoIp2\Database\Reader;
if (isset($_GET['ip'])) {
try {
$reader = new Reader('.hta_lib/data/GeoLite2-City.mmdb');
$records = $reader->city($_GET['ip']);
$city = $records->city->name;
echo json_encode(['city' => $city]);
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
}
} else {
echo json_encode(['error' => 'Invalid parameters']);
}
require '.hta_lib/vendors/maxmind-db-reader/vendor/autoload.php';
?>
<section class="diZContainer diZmxAuto diZmy8">
<h1 class="diZBorderBottom">IP Information</h1>
<p>This tool provides detailed geographical and ISP information for a given IP address using the GeoIP2.</p>
<?php
use GeoIp2\Database\Reader;
if (isset($_GET['ip'])) {
try {
$reader = new Reader('.hta_lib/data/GeoLite2-City.mmdb');
$reader2 = new Reader('.hta_lib/data/GeoLite2-ASN.mmdb');
$records = $reader->city($_GET['ip']);
$records2 = $reader2->asn($_GET['ip']);
// var_dump($records2);
$country = $records->country->name ?? null;
$state = $records->mostSpecificSubdivision->name ?? null;
$city = $records->city->name ?? null;
$region = $records->subdivisions[0]->name ?? null;
$timezone = $records->location->timeZone ?? null;
$data = [
'ip' => $_GET['ip'],
'country' => $records->country->name ?? null,
'country_iso_code' => $records->country->iso_code ?? null,
'state' => $records->mostSpecificSubdivision->name ?? null,
'state_iso_code' => $records->mostSpecificSubdivision->iso_code ?? null,
'city' => $records->city->name ?? null,
'region' => $records->subdivisions[0]->name ?? null,
'timezone' => $records->location->timeZone ?? null,
'latitude' => $records->location->latitude ?? null,
'longitude' => $records->location->longitude ?? null,
'postal_code' => $records->postal->code ?? null,
'continent' => $records->continent->name ?? null,
'asn' => $records2->autonomousSystemNumber ?? null,
'isp' => $records2->autonomousSystemOrganization ?? null,
];
$dataArray = [$data]; // Wrap in an array if it's a single record.
?>
<div class="diZGridCols1-3">
<?php
foreach ($dataArray as $record) { // Ensure you loop through an array
if (is_array($record)) { // Check if record is an array
?>
<h3 style="border-bottom: 1px solid #808080;"><strong>IP:</strong> <?php echo $record['ip']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Continent:</strong> <?php echo $record['continent']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Country:</strong> <?php echo $record['country']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>State:</strong> <?php echo $record['state']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>City:</strong> <?php echo $record['city']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Region:</strong> <?php echo $record['region']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Timezone:</strong> <?php echo $record['timezone']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Latitude:</strong> <?php echo $record['latitude']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Longitude:</strong> <?php echo $record['longitude']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>Postal Code:</strong> <?php echo $record['postal_code']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>ASN:</strong> <?php echo $record['asn']; ?></h3>
<h3 style="border-bottom: 1px solid #808080;"><strong>ISP:</strong> <?php echo $record['isp']; ?></h3>
<?php
} else {
echo '<p>Invalid data format</p><br>';
echo '<div class="diZFlexColumn diZmxAuto diZJustifyCenter diZItemsCenter">
<a class="diZButtonDenger " href="/tools/location-ip-to-location">Back</a>
</div>';
}
}
?>
</div>
<div class="diZFlexColumn diZmxAuto diZJustifyCenter diZItemsCenter">
<a class="diZButtonDenger " href="/tools/location-ip-to-location">Back</a>
</div>
<?php
// Echoing the data as JSON
// echo json_encode($data);
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
echo '<div class="diZFlexColumn diZmxAuto diZJustifyCenter diZItemsCenter">
<a class="diZButtonDenger " href="/tools/location-ip-to-location">Back</a>
</div>';
}
} else {
?>
<div class="diZMaxW600 diZw100 diZmxAuto toolsSection diZFlexColumn diZmy20"><br>
<form method="get" class="diZFlexColumn">
<label for="ip">IP Address:</label>
<div class="diZFlexColumn">
<input class="diZPadding5px" type="text" name="ip" id="ip" placeholder="Enter IP Address" />
<button class="diZmxAuto diZmt4" type="submit"><span>Check IP Details</span></button>
</div>
</form><br>
</div>
<!-- echo json_encode(['error' => 'Invalid parameters']); diZw100 -->
<?php
}
?>
<div>
<h3>Usage:</h3>
<ul>
<li><strong>Enter IP Address:</strong> Input the IP address you wish to check in the provided query parameter.</li>
<li><strong>Check Location:</strong> Send a request with the IP address to retrieve and display the geographical and ISP information.</li>
<li><strong>View Results:</strong> The location and ISP details will be displayed in a structured format, showing country, city, region, ASN, ISP, and other relevant information.</li>
</ul>
<h3>Features:</h3>
<ul>
<li>Uses MaxMind GeoLite2 databases for accurate geo-location and ISP information.</li>
<li>Displays detailed geographical information including continent, country, state, city, and region.</li>
<li>Provides additional information such as timezone, latitude, longitude, and postal code.</li>
<li>Displays Autonomous System Number (ASN) and Internet Service Provider (ISP) details.</li>
</ul>
<h3>Example Use Cases:</h3>
<ul>
<li>Network administrators tracking the location of IP addresses accessing their networks.</li>
<li>Security professionals analyzing IP addresses for potential threats.</li>
<li>Developers building applications that require IP-based location services.</li>
<li>Marketers tailoring content based on the geographic location of their audience.</li>
</ul>
</div>
</section>

View File

@ -1,19 +1,17 @@
<?php
// Get the IPv4 address of the client
// echo $_SERVER['REMOTE_ADDR'];
$ipv4 = $_SERVER['REMOTE_ADDR'];
$ipv4 = $_SERVER['REMOTE_ADDR'];
// Get the IPv6 address of the client if available
$ipv6 = $_SERVER['REMOTE_ADDR'];
if (strpos($ipv6, ":") !== false) {
// IPv6 address detected
$ipv6 = explode("%", $ipv6)[0]; // Remove interface suffix, if any
} else {
// No IPv6 address detected
$ipv6 = "IPv6 not available";
}
// Get the IPv6 address of the client if available
$ipv6 = $_SERVER['REMOTE_ADDR'];
if (strpos($ipv6, ":") !== false) {
// IPv6 address detected
$ipv6 = explode("%", $ipv6)[0]; // Remove interface suffix, if any
} else {
// No IPv6 address detected
$ipv6 = "IPv6 not available";
}
// Display IPv4 and IPv6 addresses
echo "IPv4 Address: " . $ipv4 . "<br>";
echo "IPv6 Address: " . $ipv6 . "<br>";
// Display IPv4 and IPv6 addresses
echo "IPv4 Address: " . $ipv4 . "<br>";
echo "IPv6 Address: " . $ipv6 . "<br>";
?>

View File

@ -1,56 +1,74 @@
<section class="diZContainer diZmxAuto">
<h2 class="diZBorderBottom">Ultimate Domain & IP Lookup Tool</h2>
</section>
<!-- <p class="diZTextJustify">Discover detailed information about any domain and IP address with ease using Who-Is. Our tool provides instant access to essential data, including ownership, registration details, and more, all in a user-friendly interface designed for efficiency and accuracy.</p> -->
<form method="post" class="diZToolsSection diZmt4 diZmb4 diZBorderRadius diZPadding5px">
<div class="diZFlexRowCol diZJustifyCenter diZItemsCenter">
<p class="diZmb20">This tool allows you to perform a comprehensive lookup of domain names or IP addresses, providing detailed WHOIS information.</p>
<form method="post" class="diZToolsSection diZmt4 diZmb4 diZBorderRadius diZPadding5px ">
<div class="diZFlexRowCol diZJustifyCenter diZItemsCenter ">
<input class="diZmr2 diZw70" placeholder="Domain" name="domain" type="text" />
<p class="diZmr2">OR</p>
<input class="diZmr2 diZw70" placeholder="IP Address" name="ip" type="text" />
<input class="diZmr2" type="submit" value="Check" />
<button type="submit"><span>Check</span></button>
</div>
</form>
<?php
if(isset($_POST['domain']) && $_POST['domain']){
function validateDomain($domain) {
$regex = "/^(?!\-)(?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.)+[a-zA-Z]{2,}$/";
if (preg_match($regex, $domain)) {
return true;
} else {
return false;
}
}
$domain = isset($_POST['domain']) ? $_POST['domain'] : '';
if ($domain && validateDomain($domain)) {
$command = 'whois '.$_POST['domain'];
$escaped_command = escapeshellcmd($command);
$output = shell_exec($escaped_command);
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre class="diZTextJustify" style="width: fit-content;"> ',$output, '</pre> <br><br></div>';
} else {
echo "Invalid domain.";
}
}
if(isset($_POST['ip']) && $_POST['ip']){
function validatePublicIp($ip) {
if (filter_var($ip, FILTER_VALIDATE_IP)) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
if(isset($_POST['domain']) && $_POST['domain']){
function validateDomain($domain) {
$regex = "/^(?!\-)(?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.)+[a-zA-Z]{2,}$/";
if (preg_match($regex, $domain)) {
return true;
} else {
return false;
}
}
return false;
}
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
if ($ip && validatePublicIp($ip)) {
$command = 'whois '.$_POST['ip'];
$escaped_command = escapeshellcmd($command);
$output = shell_exec($escaped_command);
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre> ',$output, '</pre> <br><br></div>';
} else {
echo "Invalid IP address.";
}
}
?>
$domain = isset($_POST['domain']) ? $_POST['domain'] : '';
if ($domain && validateDomain($domain)) {
$command = 'whois '.$_POST['domain'];
$escaped_command = escapeshellcmd($command);
$output = shell_exec($escaped_command);
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre class="diZTextJustify" style="width: fit-content;"> ',$output, '</pre> <br><br></div>';
} else {
echo "Invalid domain.";
}
}
if(isset($_POST['ip']) && $_POST['ip']){
function validatePublicIp($ip) {
if (filter_var($ip, FILTER_VALIDATE_IP)) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
return true;
}
}
return false;
}
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
if ($ip && validatePublicIp($ip)) {
$command = 'whois '.$_POST['ip'];
$escaped_command = escapeshellcmd($command);
$output = shell_exec($escaped_command);
echo '<div class="diZContainer diZmxAuto diZPadding5px"><pre> ',$output, '</pre> <br><br></div>';
} else {
echo "Invalid IP address.";
}
}
?>
<div>
<h3>Usage:</h3>
<ul>
<li>Enter a domain name or an IP address into the respective input field.</li>
<li>Click the "Check" button to retrieve WHOIS information.</li>
</ul>
<h3>Features:</h3>
<ul>
<li>Supports lookup for both domain names and IP addresses.</li>
<li>Displays WHOIS data including registration details and administrative contacts.</li>
<li>Secure input validation to ensure accurate results.</li>
</ul>
<h3>Example Use Cases:</h3>
<ul>
<li>Investigate ownership and registration details of a domain.</li>
<li>Check the WHOIS information of an IP address for network troubleshooting.</li>
<li>Verify domain availability and registration status.</li>
</ul>
</div>
</section>