cfdomain_warrior.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. // 'cfdomains warrior' on PHP
  3. error_reporting(0);
  4. set_time_limit(0); // run until got killed - edit me
  5. define('HELPER_ID', hash('sha256', 'add your sexy comment here - EDIT ME'));
  6. //----
  7. function echol($e, $x = null)
  8. {
  9. echo $e . "\n";
  10. if ($x) {
  11. exit();
  12. }
  13. }
  14. function apiwar($posts)
  15. {
  16. $cu = curl_init();
  17. curl_setopt($cu, CURLOPT_URL, 'https://karma.crimeflare.eu.org/api/cfdomains/');
  18. curl_setopt($cu, CURLOPT_SSL_VERIFYPEER, false);
  19. curl_setopt($cu, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
  20. curl_setopt($cu, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
  21. curl_setopt($cu, CURLOPT_ENCODING, 'gzip, deflate');
  22. curl_setopt($cu, CURLOPT_RETURNTRANSFER, 1);
  23. curl_setopt($cu, CURLOPT_CONNECTTIMEOUT, 9);
  24. curl_setopt($cu, CURLOPT_TIMEOUT, 120);
  25. curl_setopt($cu, CURLOPT_HEADER, false);
  26. curl_setopt($cu, CURLOPT_USERAGENT, 'CfDomains');
  27. curl_setopt($cu, CURLOPT_POST, 1);
  28. curl_setopt($cu, CURLOPT_POSTFIELDS, rtrim($posts, '&'));
  29. return curl_exec($cu);
  30. }
  31. function dns_exists_NS($d)
  32. {
  33. $g = dns_get_record($d . '.', DNS_NS);
  34. if ($g === false) {
  35. return 0;
  36. }
  37. return count($g) < 1 ? -1 : 1;
  38. }
  39. function dns_exists_A($d)
  40. {
  41. $g = dns_get_record($d . '.', DNS_A);
  42. if ($g === false) {
  43. return 0;
  44. }
  45. return count($g) < 1 ? -1 : 1;
  46. }
  47. if (dns_exists_NS('microsoft.com') != 1 || dns_exists_NS('google.com') != 1) {
  48. echol('FATAL: NS not found!', true);
  49. }
  50. if (dns_exists_A('www.google.com') != 1 || dns_exists_A('www.youtube.com') != 1) {
  51. echol('FATAL: A not found!', true);
  52. }
  53. $got = @json_decode(apiwar('do=init&hv=' . HELPER_ID), true);
  54. if (!is_array($got)) {
  55. echol('FATAL: init failed!', true);
  56. }
  57. echol($got[1], !$got[0] ? true : null);
  58. //BEGIN_LOOP
  59. while (1) {
  60. sleep(2);
  61. echol(':: GET');
  62. $got = @json_decode(apiwar('do=get&hv=' . HELPER_ID), true);
  63. if (!is_array($got)) {
  64. echol('Unable to connect, will retry later');
  65. sleep(10);
  66. continue;
  67. }
  68. if (!$got[0]) {
  69. echol($got[1], true);
  70. }
  71. if (count($got[1]) < 5) {
  72. if ($got[1][0] == 'wait!') {
  73. echol('Busy. Waiting for my turn.');
  74. sleep(200);
  75. continue;
  76. }
  77. continue;
  78. }
  79. $totalC = count($got[1]);
  80. echol(':: Received ' . $totalC);
  81. echol(':: Scanning');
  82. $apples = [];
  83. foreach ($got[1] as $domain) {
  84. if (preg_match("/\.crimeflare$/", $domain)) {
  85. continue;
  86. }
  87. usleep(120000);
  88. if (dns_exists_NS($domain) >= 0) {
  89. continue;
  90. }
  91. usleep(120000);
  92. if (dns_exists_A($domain) >= 0) {
  93. continue;
  94. }
  95. $apples[$domain] = 1;
  96. }
  97. $apples = array_keys($apples);
  98. $totalA = count($apples);
  99. if ($totalA < 1 || $totalA == $totalC) {
  100. continue;
  101. }
  102. echol(':: Suspected ' . $totalA);
  103. echol(':: Reporting');
  104. $got = @json_decode(apiwar('do=rb&hv=' . HELPER_ID . '&ds=' . implode(',', $apples)), true);
  105. $apples = null;
  106. if (!is_array($got)) {
  107. echol('Unable to connect, skip');
  108. sleep(10);
  109. continue;
  110. }
  111. if (!$got[0]) {
  112. echol($got[1], true);
  113. }
  114. }
  115. //END_LOOP
  116. //