/** * Execute the console command. * * @return mixed */ public function fire() { $proxies = Proxy::all(); $this->info("Checking existing proxies...\n"); Telegram::sendMessage(env("TELEGRAM_CHANNEL"), "A iniciar os teste de segurança para " . count($proxies) . " proxies."); foreach ($proxies as $proxy) { $this->info("\n # Checking security on " . $proxy->host . ":" . $proxy->port . "..."); //Check for proxy security $this->checkProxySecurity($proxy); } Telegram::sendMessage(env("TELEGRAM_CHANNEL"), "Testes de segurança finalizados! De " . count($proxies) . " proxies, ficaram " . count(Proxy::all()) . "."); $this->info("Done."); }
/** * Execute the console command. * * @return mixed */ public function fire() { $proxy_list_url = "http://proxy-list.org/english/index.php?p="; define('HTTP_GATE', 'http://grupoaweso.me/gate.php'); // Gate for check HTTP,SOCKS proxy define('HTTPS_GATE', 'https://grupoaweso.me/gate.php'); // Gate for check HTTPS proxy define('CHECK_TIMEOUT', 10); // Curl timeout request for ($page = 1; $page <= 10; $page++) { $curl = curl_init($proxy_list_url . $page); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($curl); curl_close($curl); if (!$output) { $this->error("Failed fetching page {$page}"); continue; } $this->info("\nFetched page {$page}... Parsing HTML"); $dom = new \DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($output); libxml_use_internal_errors(false); $xpath = new \DOMXPath($dom); $entries = $xpath->query('//*[@id="proxy-table"]//li[@class="proxy"]'); foreach ($entries as $entry) { if (strpos($entry->textContent, ":") === false) { continue; } list($host, $port) = explode(":", $entry->textContent); if (!Proxy::whereRaw('host = ? and port = ?', array($host, $port))->get()->isEmpty()) { $this->info(" Skipping " . $entry->textContent . "... Already on the database"); } $this->info("==== FOUND " . $entry->textContent . " ====\nStart testing..."); $resultQuery = PHPProxyChecker::checkProxy($entry->textContent); if (isset($resultQuery['NOT_WORKING']) && $resultQuery['NOT_WORKING'] == 'Y') { $this->error("Proxy not responding... "); continue; } $this->info("Proxy Responding! "); $this->table(["Type", "Type Name", "Query Time", "SSL"], [[$resultQuery['TYPE'], $resultQuery['TYPE_NAME'], $resultQuery['QUERY_TIME'], $resultQuery['SUPPORT_SSL']]]); $proxy = new Proxy(); $proxy->host = $host; $proxy->port = $port; $proxy->speed = $resultQuery['QUERY_TIME']; $proxy->working = true; $proxy->latest_report = json_encode($resultQuery); $proxy->save(); $this->info("Done!\n"); } $this->info(" All done!! "); } }
/** * Execute the console command. * * @return mixed */ public function fire() { define('HTTP_GATE', 'http://grupoaweso.me/gate.php'); // Gate for check HTTP,SOCKS proxy define('HTTPS_GATE', 'https://grupoaweso.me/gate.php'); // Gate for check HTTPS proxy define('CHECK_TIMEOUT', 10); // Curl timeout request $proxies = Proxy::all(); $this->info("Checking existing proxies...\n"); foreach ($proxies as $proxy) { $this->info(" * Checking " . $proxy->host . ":" . $proxy->port . "..."); $check = PHPProxyChecker::checkProxy($proxy->host . ":" . $proxy->port); if (isset($check['NOT_WORKING']) && $check['NOT_WORKING'] == 'Y') { $this->error("Proxy not responding... Removing."); $proxy->delete(); continue; } $this->table(["Type", "Type Name", "Query Time", "SSL"], [[$check['TYPE'], $check['TYPE_NAME'], $check['QUERY_TIME'], $check['SUPPORT_SSL']]]); // Save the old results $proxy->speed = $check['QUERY_TIME']; $proxy->working = true; $proxy->latest_report = json_encode($check); $proxy->save(); $this->info("Done. \n"); } }
/** * @inheritdoc */ public function handle($arguments) { // This will send a message using `sendMessage` method behind the scenes to // the user/chat id who triggered this command. // `replyWith<Message|Photo|Audio|Video|Voice|Document|Sticker|Location|ChatAction>()` all the available methods are dynamically // handled when you replace `send<Method>` with `replyWith` and use all their parameters except chat_id. $this->replyWithMessage('O Ahoy! está a funcionar sem problemas, meu capitão!'); $load = sys_getloadavg(); $this->replyWithMessage("Os sistemas estão operacionais, com um load imediato de " . $load[0] . "."); if ($load[0] > 1) { $this->replyWithMessage("Precisamos de ter algum cuidado com a sobrecarga, capitão!"); } $uptime = shell_exec("cut -d. -f1 /proc/uptime"); $days = floor($uptime / 60 / 60 / 24); $hours = $uptime / 60 / 60 % 24; $mins = $uptime / 60 % 60; $secs = $uptime % 60; $uptime_msg = "Estamos a navegar sem parar à "; if ($days > 0) { $uptime_msg .= $days . " dias e "; } $uptime_msg .= $hours . " horas."; $this->replyWithMessage($uptime_msg); $num_proxies = count(Proxy::all()); $num_sites = count(SitesController::getAllSites()); $this->replyWithMessage("Existem " . $num_proxies . " proxies e " . $num_sites . " sites bloqueados."); $num_ultima_hora = DB::table('stats_hosts')->where('created_at', '>', \Carbon\Carbon::now()->subHours(1))->count(); $num_ultimo_minuto = DB::table('stats_hosts')->where('created_at', '>', \Carbon\Carbon::now()->subMinutes(1))->count(); $this->replyWithMessage($num_ultima_hora . " páginas acedidas na última hora, e {$num_ultimo_minuto} no último minuto."); //URL of your extension $url = "https://chrome.google.com/webstore/detail/ahoy/ljighgeflmhnpljodhpcifcojkpancpm"; $file_string = file_get_contents($url); //Get the rating preg_match('/ratingValue" content="(\\d*\\d+\\.\\d+)/', $file_string, $ratings); $rating = $ratings[1]; //Get the nb of users preg_match('/class="e-f-ih" title="(\\d*\\,\\d+)/', $file_string, $users); $users = $users[1]; $this->replyWithMessage("Existem {$users} utilizadores com um rating médio de {$rating}"); // Trigger another command dynamically from within this command // When you want to chain multiple commands within one or process the request further. // The method supports second parameter arguments which you can optionally pass, By default // it'll pass the same arguments that are received for this command originally. //$this->triggerCommand('subscribe'); }
/** * Execute the console command. * * @return mixed */ public function fire() { define('HTTP_GATE', 'http://revolucaodosbytes.pt/gate.php'); // Gate for check HTTP,SOCKS proxy define('HTTPS_GATE', 'https://revolucaodosbytes.pt/gate.php'); // Gate for check HTTPS proxy define('CHECK_TIMEOUT', 10); // Curl timeout request // Store the proxies on this array $proxy_array = []; // First proxy site $proxy_list_url = "http://www.google-proxy.net"; $curl = curl_init($proxy_list_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($curl); curl_close($curl); if (!$output) { $this->error("Failed fetching {$proxy_list_url}"); return; } $this->info("\nFetched {$proxy_list_url}... Parsing HTML"); $dom = new \DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($output); libxml_use_internal_errors(false); $xpath = new \DOMXPath($dom); $entries = $xpath->query('//*[@id="proxylisttable"]/tbody/tr'); foreach ($entries as $entry) { $host = $entry->childNodes->item(0)->textContent; $port = $entry->childNodes->item(1)->textContent; $this->info(" * FOUND " . $host . ":" . $port); $proxy_array[] = [$host, $port]; } $this->info(" All done!! "); // Second proxy site $proxy_list_url = "http://proxy-list.org/english/index.php?p="; for ($page = 1; $page <= 10; $page++) { $curl = curl_init($proxy_list_url . $page); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($curl); curl_close($curl); if (!$output) { $this->error("Failed fetching page {$page}"); continue; } $this->info("\nFetched page {$page}... Parsing HTML"); $dom = new \DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($output); libxml_use_internal_errors(false); $xpath = new \DOMXPath($dom); $entries = $xpath->query('//*[@id="proxy-table"]//li[@class="proxy"]//script'); foreach ($entries as $entry) { preg_match('/\'(.*)\'/i', $entry->textContent, $proxy_address); $proxy_address = base64_decode($proxy_address[1]); if (strpos($proxy_address, ":") === false) { continue; } list($host, $port) = explode(":", $proxy_address); $this->info(" * FOUND " . $host . ":" . $port); $proxy_array[] = [$host, $port]; } } /** * NOW TEST THE PROXY AND ADD TO DATABASE */ $this->info("\n#############################################"); $this->info("#### STARTED TESTING PROXIES ####"); $this->info("#############################################"); $this->info("There are " . count($proxy_array) . " proxy entries to test.\n"); Telegram::sendMessage(env("TELEGRAM_CHANNEL"), "Procura de novos proxies iniciada. Vou iniciar o teste de " . count($proxy_array) . " proxies."); $counter = 0; foreach ($proxy_array as $proxy) { list($host, $port) = $proxy; if (!Proxy::whereRaw('host = ? and port = ?', array($host, $port))->get()->isEmpty()) { $this->info(" * Skipping " . $host . ":" . $port . "... Already on the database"); continue; } $this->info(" * Testing " . $host . ":" . $port . "..."); $resultQuery = PHPProxyChecker::checkProxy($host . ":" . $port); if (isset($resultQuery['NOT_WORKING']) && $resultQuery['NOT_WORKING'] == 'Y') { $this->error("\t * Proxy not responding... "); continue; } if (isset($resultQuery['SUPPORT_SSL']) && $resultQuery['SUPPORT_SSL'] != 'Y') { $this->error("\t * Proxy does not support SSL. Skipping."); continue; } $this->info("\t * Success! "); $this->table(["Type", "Type Name", "Query Time", "SSL"], [[$resultQuery['TYPE'], $resultQuery['TYPE_NAME'], $resultQuery['QUERY_TIME'], $resultQuery['SUPPORT_SSL']]]); $proxy = new Proxy(); $proxy->host = $host; $proxy->port = $port; $proxy->speed = $resultQuery['QUERY_TIME']; $proxy->working = true; $proxy->latest_report = json_encode($resultQuery); $proxy->save(); $counter++; } $this->info("\n * All done! Added {$counter} new proxies"); //Notify on telegram Telegram::sendMessage(env("TELEGRAM_CHANNEL"), "Terminei agora de ir buscar novos proxies. De um total de " . count($proxy_array) . " proxies, aproveitei apenas {$counter}."); }
public function getProxy(Request $req) { $proxy = Proxy::query()->orderBy('speed', 'asc')->take(40)->get()->shuffle()->first(); return $proxy; }
protected function health_core($from_secord, $to_secord) { $stepNum = Variables::getStepNum(); $period_secord = $from_secord - $to_secord; $step_secord = (int) ($period_secord / $stepNum); $now = time(); #_tp means time point. $beforebefore_tp = $now - $from_secord; $before_tp = $now - $to_secord; $source_kind = array(8 => 'freeproxylists', 9 => 'hidemyass', 10 => 'pachong'); $source_time = array(); $source_usage_rate = array('success' => array(), 'all' => array()); $source_usage_rate_exact = array('success' => array(), 'all' => array()); $aliving = array(); foreach ($source_kind as $sk => $st) { $source_usage_rate['success'][$sk] = 0; $source_usage_rate['all'][$sk] = 0; $source_usage_rate_exact['success'][$sk] = 0; $source_usage_rate_exact['all'][$sk] = 0; $source_time[$sk] = array(); $aliving[$st] = array(); } $codedist = array(300 => array(), 3600 => array(), 14400 => array(), 'MORE' => array()); $ipportset = array(); $codeset = array(); $slist = Proxy::period($beforebefore_tp, $before_tp); foreach ($slist as $proxy) { $ipport = $proxy['ipv4_port']; $time = $proxy['time']; $code = $proxy['code']; $source = $proxy['source']; if ($code == -1) { $source_usage_rate['all'][$source] += 1; } elseif ($code == 0) { $source_usage_rate['success'][$source] += 1; } if (isset($ipportset[$ipport])) { if ($code == -1) { unset($ipportset[$ipport]); unset($codeset[$ipport]); $source_usage_rate_exact['all'][$source] += 1; } elseif ($code == 0) { $keep = $ipportset[$ipport] - $time; $source_time[$source][] = $keep; $source_usage_rate_exact['success'][$source] += 1; if ($keep <= 300) { $keep = 300; } elseif ($keep <= 3600) { $keep = 3600; } elseif ($keep <= 14400) { $keep = 14400; } else { $keep = 'MORE'; } if (isset($codedist[$keep][$codeset[$ipport]])) { $codedist[$keep][$codeset[$ipport]] += 1; } else { $codedist[$keep][$codeset[$ipport]] = 1; } } else { return redirect('/'); } } else { if ($code == -1) { continue; } elseif ($code == 0) { $aliving[$source_kind[$source]][$ipport] = Variables::secordtoHMS($now - $time); } else { $ipportset[$ipport] = $time; $codeset[$ipport] = $code; } } } $res_a = array(); $avet = array(); foreach ($source_time as $source => $times) { $res = Variables::chartjs_line_one_inited_with_timedist($source_kind[$source]); $totalt = 0.0; foreach ($times as $time) { $id = Variables::timedist_getindex($time); $res['datasets'][0]['data'][$id] += 1; $totalt += $time; } if (count($times)) { $avet[$source] = Variables::secordtoHMS($totalt / count($times)); } else { $avet[$source] = 0; } $res_a[$source_kind[$source]] = json_encode($res); } $usage = array(); foreach ($source_kind as $sourceid => $sourcestring) { $sus = $source_usage_rate['success'][$sourceid]; $all = $source_usage_rate['all'][$sourceid]; $sus_e = $source_usage_rate_exact['success'][$sourceid]; $all_e = $source_usage_rate_exact['all'][$sourceid]; if ($all != 0) { $value = number_format(100 * $sus / $all, 2); } else { $value = 0; } $ave = $avet[$sourceid]; $usage[$sourcestring] = "{$sus}" . '/' . "{$all}" . ' (' . "{$sus_e}" . '/' . "{$all_e}" . ') ' . "{$value}" . '%. Average alive duration: ' . "{$ave}" . '.'; $cnt = count($aliving[$sourcestring]); $usage[$sourcestring] .= " Aliving connections: {$cnt}."; } $code_res_a = array(); $paes = Variables::paerror(); foreach ($codedist as $time => $codes) { $rest = Variables::chartjs_line_one('one'); arsort($codes); foreach ($codes as $code => $count) { $rest['labels'][] = $paes[$code]; $rest['datasets'][0]['data'][] = $count; } $code_res_a[$time] = json_encode($rest); } $url = action('ProxyController@hstep', ['']); return compact('res_a', 'code_res_a', 'from_secord', 'to_secord', 'usage', 'aliving', 'url'); }
protected function fix($ids) { Proxy::whereIn('id', $ids)->delete(); }
public function fstepS($from_to) { $args = explode("-", $from_to); $from_secord = (int) $args[0] * 3600; $to_secord = (int) $args[1] * 3600; $res = ToolsController::fixproxyrecord($from_secord, $to_secord); $proxy_ids = $res['ids']; $res = ToolsController::fixaccountrecord($from_secord, $to_secord); $account_ids = $res['ids']; Proxy::fix($proxy_ids); Account::fix($account_ids); return view('tools.fsjs'); }