Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php // Define the base URL for the puzzles $baseUrl = "https://privatekeyfinder.io/bit..
Decoded Output download
<?php
// Define the base URL for the puzzles
$baseUrl = "https://privatekeyfinder.io/bitcoin-puzzle/random-keys/";
// Define the range of puzzles to fetch
$startRange = 66;
$endRange = 70;
// Define the output file
$outputFile = "hit.txt";
// Define refresh interval (in seconds)
$refreshInterval = 0; // Ensure this is set to a valid integer value
// Function to fetch and process the URL
function fetchAndProcess($url, $outputFile, $refreshInterval) {
while (true) {
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session
$html = curl_exec($ch);
// Close cURL session
curl_close($ch);
// Check for errors
if ($html === false) {
echo "Error fetching URL: $url
";
sleep($refreshInterval);
continue; // Try fetching again
}
// Use DOMDocument to parse the HTML
$dom = new DOMDocument;
@$dom->loadHTML($html);
// Use DOMXPath to navigate and extract data
$xpath = new DOMXPath($dom);
// Define the XPath query to find the relevant rows
$query = "//tr";
// Query the DOM for the rows
$rows = $xpath->query($query);
// Check if any rows were found
if ($rows->length > 0) {
// Read existing data from the output file
$existingData = [];
if (file_exists($outputFile)) {
$existingData = file($outputFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$existingData = array_map('trim', $existingData);
}
// Open the output file for appending
$fileHandle = fopen($outputFile, 'a');
if ($fileHandle) {
$foundBalance = false;
foreach ($rows as $row) {
// Extract data from each row
$hex = $xpath->query(".//span[contains(text(),'HEX')]/following-sibling::span/a", $row);
$wif = $xpath->query(".//span[contains(text(),'WIF(c)')]/following-sibling::span", $row);
// Extract balance data
$balances = $xpath->query(".//td[@class='text-nowrap']//span[@class='BalanceSuccess']", $row);
$balanceData = [];
foreach ($balances as $balance) {
$balanceData[] = trim($balance->textContent);
}
// Extract total balance data
$totalBalance = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1 mr-2']", $row);
$totalReceived = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1 mr-2'][2]", $row);
$totalTx = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1'][2]", $row);
$totalBalanceValue = $totalBalance->length > 0 ? trim($totalBalance->item(0)->textContent) : '0';
$totalReceivedValue = $totalReceived->length > 0 ? trim($totalReceived->item(0)->textContent) : '0';
$totalTxValue = $totalTx->length > 0 ? trim($totalTx->item(0)->textContent) : '0';
// Check if the relevant data exists
if ($hex->length > 0 && $wif->length > 0) {
$hexValue = trim($hex->item(0)->textContent);
$wifValue = trim($wif->item(0)->textContent);
// Check if balance is not zero
$balanceFound = false;
foreach ($balanceData as $balance) {
if ($balance > 0) {
$balanceFound = true;
break;
}
}
if ($balanceFound) {
$dataToWrite = "HEX: $hexValue
WIF: $wifValue
Balances: " . implode(', ', $balanceData) . "
";
$dataToWrite .= "Total Balance: $totalBalanceValue
Total Received: $totalReceivedValue
Total TX: $totalTxValue
";
// Check if the data is already in the file
if (!in_array(trim($dataToWrite), $existingData)) {
fwrite($fileHandle, $dataToWrite);
// Output to console for verification
echo "Found valid key with balance:
HEX: $hexValue
WIF: $wifValue
Balances: " . implode(', ', $balanceData) . "
";
echo "Total Balance: $totalBalanceValue
Total Received: $totalReceivedValue
Total TX: $totalTxValue
";
$foundBalance = true;
break 2; // Exit both foreach and while loops
} else {
echo "Duplicate entry found, skipping: HEX: $hexValue
";
}
} else {
echo "No balance for HEX: $hexValue, WIF: $wifValue
";
}
}
}
fclose($fileHandle);
if ($foundBalance) {
break; // Exit while loop if a valid key is found
}
} else {
echo "Error opening output file: $outputFile
";
break;
}
}
// Wait before refreshing
sleep($refreshInterval);
}
}
// Function to click the "Random" button and get new URL
function getNewUrlFromRandomButton($baseUrl) {
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $baseUrl . '66'); // Using a fixed page to click "Random"
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session
$html = curl_exec($ch);
// Check for errors
if ($html === false) {
echo "Error fetching URL: $baseUrl
";
curl_close($ch);
return null;
}
// Close cURL session
curl_close($ch);
// Use DOMDocument to parse the HTML
$dom = new DOMDocument;
@$dom->loadHTML($html);
// Use DOMXPath to find the "Random" button link
$xpath = new DOMXPath($dom);
$randomButtonLink = $xpath->query("//div[@class='btn-group mt-2 btn-group-sm']//a")->item(0);
if ($randomButtonLink) {
$newUrl = "https://privatekeyfinder.io" . $randomButtonLink->getAttribute('href');
return $newUrl;
}
return null;
}
// Loop through the range and process each URL
for ($i = $startRange; $i <= $endRange; $i++) {
// Get new URL from clicking the "Random" button
$newUrl = getNewUrlFromRandomButton($baseUrl);
if ($newUrl) {
echo "Processing URL: $newUrl
";
fetchAndProcess($newUrl, $outputFile, $refreshInterval);
} else {
echo "Failed to get new URL from random button.
";
}
}
echo "Processing completed.
";
?>
Did this file decode correctly?
Original Code
<?php
// Define the base URL for the puzzles
$baseUrl = "https://privatekeyfinder.io/bitcoin-puzzle/random-keys/";
// Define the range of puzzles to fetch
$startRange = 66;
$endRange = 70;
// Define the output file
$outputFile = "hit.txt";
// Define refresh interval (in seconds)
$refreshInterval = 0; // Ensure this is set to a valid integer value
// Function to fetch and process the URL
function fetchAndProcess($url, $outputFile, $refreshInterval) {
while (true) {
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session
$html = curl_exec($ch);
// Close cURL session
curl_close($ch);
// Check for errors
if ($html === false) {
echo "Error fetching URL: $url\n";
sleep($refreshInterval);
continue; // Try fetching again
}
// Use DOMDocument to parse the HTML
$dom = new DOMDocument;
@$dom->loadHTML($html);
// Use DOMXPath to navigate and extract data
$xpath = new DOMXPath($dom);
// Define the XPath query to find the relevant rows
$query = "//tr";
// Query the DOM for the rows
$rows = $xpath->query($query);
// Check if any rows were found
if ($rows->length > 0) {
// Read existing data from the output file
$existingData = [];
if (file_exists($outputFile)) {
$existingData = file($outputFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$existingData = array_map('trim', $existingData);
}
// Open the output file for appending
$fileHandle = fopen($outputFile, 'a');
if ($fileHandle) {
$foundBalance = false;
foreach ($rows as $row) {
// Extract data from each row
$hex = $xpath->query(".//span[contains(text(),'HEX')]/following-sibling::span/a", $row);
$wif = $xpath->query(".//span[contains(text(),'WIF(c)')]/following-sibling::span", $row);
// Extract balance data
$balances = $xpath->query(".//td[@class='text-nowrap']//span[@class='BalanceSuccess']", $row);
$balanceData = [];
foreach ($balances as $balance) {
$balanceData[] = trim($balance->textContent);
}
// Extract total balance data
$totalBalance = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1 mr-2']", $row);
$totalReceived = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1 mr-2'][2]", $row);
$totalTx = $xpath->query("//span[@id='total-balance']/span[@class='badge badge-light p-1'][2]", $row);
$totalBalanceValue = $totalBalance->length > 0 ? trim($totalBalance->item(0)->textContent) : '0';
$totalReceivedValue = $totalReceived->length > 0 ? trim($totalReceived->item(0)->textContent) : '0';
$totalTxValue = $totalTx->length > 0 ? trim($totalTx->item(0)->textContent) : '0';
// Check if the relevant data exists
if ($hex->length > 0 && $wif->length > 0) {
$hexValue = trim($hex->item(0)->textContent);
$wifValue = trim($wif->item(0)->textContent);
// Check if balance is not zero
$balanceFound = false;
foreach ($balanceData as $balance) {
if ($balance > 0) {
$balanceFound = true;
break;
}
}
if ($balanceFound) {
$dataToWrite = "HEX: $hexValue\nWIF: $wifValue\nBalances: " . implode(', ', $balanceData) . "\n";
$dataToWrite .= "Total Balance: $totalBalanceValue\nTotal Received: $totalReceivedValue\nTotal TX: $totalTxValue\n\n";
// Check if the data is already in the file
if (!in_array(trim($dataToWrite), $existingData)) {
fwrite($fileHandle, $dataToWrite);
// Output to console for verification
echo "Found valid key with balance:\nHEX: $hexValue\nWIF: $wifValue\nBalances: " . implode(', ', $balanceData) . "\n";
echo "Total Balance: $totalBalanceValue\nTotal Received: $totalReceivedValue\nTotal TX: $totalTxValue\n";
$foundBalance = true;
break 2; // Exit both foreach and while loops
} else {
echo "Duplicate entry found, skipping: HEX: $hexValue\n";
}
} else {
echo "No balance for HEX: $hexValue, WIF: $wifValue\n";
}
}
}
fclose($fileHandle);
if ($foundBalance) {
break; // Exit while loop if a valid key is found
}
} else {
echo "Error opening output file: $outputFile\n";
break;
}
}
// Wait before refreshing
sleep($refreshInterval);
}
}
// Function to click the "Random" button and get new URL
function getNewUrlFromRandomButton($baseUrl) {
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $baseUrl . '66'); // Using a fixed page to click "Random"
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session
$html = curl_exec($ch);
// Check for errors
if ($html === false) {
echo "Error fetching URL: $baseUrl\n";
curl_close($ch);
return null;
}
// Close cURL session
curl_close($ch);
// Use DOMDocument to parse the HTML
$dom = new DOMDocument;
@$dom->loadHTML($html);
// Use DOMXPath to find the "Random" button link
$xpath = new DOMXPath($dom);
$randomButtonLink = $xpath->query("//div[@class='btn-group mt-2 btn-group-sm']//a")->item(0);
if ($randomButtonLink) {
$newUrl = "https://privatekeyfinder.io" . $randomButtonLink->getAttribute('href');
return $newUrl;
}
return null;
}
// Loop through the range and process each URL
for ($i = $startRange; $i <= $endRange; $i++) {
// Get new URL from clicking the "Random" button
$newUrl = getNewUrlFromRandomButton($baseUrl);
if ($newUrl) {
echo "Processing URL: $newUrl\n";
fetchAndProcess($newUrl, $outputFile, $refreshInterval);
} else {
echo "Failed to get new URL from random button.\n";
}
}
echo "Processing completed.\n";
?>
Function Calls
None |
Stats
MD5 | eee14b6bd38573803d83a6bb8fb38c4d |
Eval Count | 0 |
Decode Time | 63 ms |