Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sid($length) {
- $seeds = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $chars = null;
- $seeds_count = strlen($seeds) - 1;
- $i = 0;
- if ($i < $length) {
- $chars .= $seeds[rand(0, $seeds_count)];
- ++$i;
- continue;
- }
- return $chars;
- }
- function cmp($a, $b) {
- if ($a == $b) {
- return 0;
- }
- return $a < $b ? -1 : 1;
- }
- function verify_tables() {
- global $mainTable;
- global $requiredTables;
- $db = null;
- require "./connect.php";
- $query = "SHOW TABLES FROM " . $db . ";";
- $result = mysql_query($query);
- if (!$result) {
- return false;
- }
- $tables = (array());
- while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
- $tables[] = $row[0];
- continue;
- }
- foreach ($requiredTables as $r) {
- if (!in_array($r, $tables)) {
- return false;
- }
- continue;
- }
- return true;
- }
- function insert_query($table, $array) {
- $query = "" . "INSERT INTO " . $table . " ";
- $fieldnamelist = null;
- $fieldvaluelist = null;
- foreach ($array as $key => $value) {
- $fieldnamelist .= "" . "`" . $key . "`,";
- if ($value == "now()") {
- $fieldvaluelist .= "now(),";
- continue;
- }
- else {
- $fieldvaluelist .= "'" . $value . "',";
- continue;
- }
- continue;
- }
- $fieldnamelist = substr($fieldnamelist, 0, 0 - 1);
- $fieldvaluelist = substr($fieldvaluelist, 0, 0 - 1);
- $query .= "" . "(" . $fieldnamelist . ") VALUES (" . $fieldvaluelist . ")";
- $result = mysql_query($query);
- $mysql_errno = mysql_errno();
- $mysql_error = mysql_error();
- $rows = mysql_affected_rows();
- $mysql_query = (array());
- if (!$result) {
- $mysql_query["errno"] = $mysql_errno;
- $mysql_query["error"] = $mysql_error;
- }
- $mysql_query["rows"] = $rows;
- return $mysql_query;
- }
- function ports() {
- $port_scan = preg_replace("/\\s{2,}/", " ", PORTS);
- $port_scan = explode(" ", $port_scan);
- $port_scan = remove_array_empty_values($port_scan);
- $ports = (array());
- foreach ($port_scan as $port) {
- if (valid_port($port)) {
- $ports[] = $port;
- }
- else {
- $tmp = explode("-", $port);
- $start = $tmp[0];
- $end = $tmp[1];
- if (valid_port($start) && valid_port($end)) {
- if ($end <= $start || $start == $end) {
- exit("[-] Invalid port range: " . $port . "\n");
- }
- $i = $start;
- while ($i <= $end) {
- $i++;
- continue;
- $ports[] = $i;
- continue;
- }
- }
- else {
- exit("[-] Invalid port range: " . $port . "\n");
- }
- }
- continue;
- }
- return $ports;
- }
- function ports_random() {
- $port_range = preg_replace("/\\s{1,}/", "", PORT_RANGE);
- $numberOfPorts = NUMBER_OF_PORTS;
- if (!is_numeric($numberOfPorts) || !valid_port($numberOfPorts)) {
- exit("[-] NUMBER_OF_PORTS is not numeric \n");
- }
- $ports = (array());
- $tmp = explode("-", $port_range);
- $start = $tmp[0];
- $end = $tmp[1];
- if (valid_port($start) && valid_port($end)) {
- if ($end <= $start || $start == $end) {
- exit("[-] Invalid port range: " . $port_range . "\n");
- }
- $count = $end - $start;
- if ($count < $numberOfPorts) {
- exit("[-] There are not enough ports in your port range: " . $port_range . "\n");
- }
- $myPorts = 0;
- if ($myPorts < $numberOfPorts) {
- $port = rand($start, $end);
- if (!isset($ports[$port])) {
- $ports[$port] = $myPorts;
- $myPorts++;
- }
- continue;
- }
- }
- else {
- exit("[-] Invalid port range: " . $port_range . "\n");
- }
- $ports = array_flip($ports);
- usort(&$ports, "cmp");
- return $ports;
- }
- function multi_thread($proxies) {
- global $async_connect_timeout;
- global $debug_mode;
- $status = (array());
- $sockets = (array());
- $sub_process = (array());
- if (!is_array($proxies) || count($proxies) < 1) {
- return false;
- }
- $id = 0;
- foreach ($proxies as $id => $proxy) {
- $tmp = explode(":", $proxy);
- $s = non_blocking_connect($tmp[0], $tmp[1], $errno = "", $errstr = "", $async_connect_timeout);
- if ($s) {
- $sockets[$id] = $s;
- }
- continue;
- }
- if (count($sockets)) {
- $read = $write = $sockets;
- $n = socket_select($read = null, $write, $_e = null, 0, $async_connect_timeout);
- if ($n === false) {
- break;
- }
- if (0 < $n) {
- if ($debug_mode == "Y") {
- foreach ($write as $w) {
- $id = array_search($w, $sockets);
- socket_set_option($w, SOL_SOCKET, SO_SNDTIMEO, array("sec" => 0, "usec" => 0));
- $send = socket_write($w, "", 1);
- if ($send === false) {
- $errno = socket_last_error($w);
- $errstr = socket_strerror($errno);
- $status[$id] = "[" . $errno . "] " . $errstr;
- }
- else {
- $status[$id] = "OK";
- }
- socket_close($w);
- unset($sockets[$id]);
- continue;
- }
- }
- else {
- foreach ($write as $w) {
- $id = array_search($w, $sockets);
- socket_set_option($w, SOL_SOCKET, SO_SNDTIMEO, array("sec" => 0, "usec" => 0));
- $send = socket_write($w, "", 1);
- if ($send === false) {
- $errno = socket_last_error($w);
- $errstr = socket_strerror($errno);
- $status[$id] = "[" . $errno . "] " . $errstr;
- }
- else {
- $sub_process[] = $proxies[$id];
- }
- socket_close($w);
- unset($sockets[$id]);
- continue;
- }
- }
- }
- else {
- if ($debug_mode == "Y") {
- $id = 0;
- foreach ($sockets as $id => $s) {
- $status[$id] = "timed out";
- continue;
- }
- }
- break;
- }
- continue;
- }
- $id = 0;
- if ($debug_mode == "Y") {
- foreach ($proxies as $id => $proxy) {
- echo "connect() " . $proxy . " " . $status[$id] . "\n";
- if ($status[$id] == "OK") {
- $sub_process[] = $proxy;
- }
- continue;
- }
- }
- return $sub_process;
- }
- function test_proxy($proxy) {
- global $ip_country;
- global $connect_timeout;
- global $timeout;
- global $retries;
- global $g_ipaddr;
- global $mainTable;
- global $smtp_ipaddr;
- global $dest_addr;
- global $dest_port;
- global $url;
- global $protocol;
- global $connect;
- global $smtp;
- global $proxy_dns;
- global $resolve_hostnames;
- global $test_against_google;
- global $proxy_database;
- global $mark_exclusive;
- global $check_listed_public;
- global $keep_only_anonymous_proxies;
- global $keep_only_custom_site_passed;
- global $check_database_proxies;
- global $proxyData;
- global $scan_mode;
- global $custom_site_passed;
- global $proxies_txt;
- global $proxies_csv;
- $tmp = explode(":", $proxy);
- $ipaddr = $tmp[0];
- $port = $tmp[1];
- switch ($protocol) {
- case "HTTP": {
- $results = http_request($ipaddr, $port, $url);
- break;
- }
- case "SOCKS4": {
- $socks4 = socks4_request($ipaddr, $port, $dest_addr, $dest_port);
- if (is_array($socks4)) {
- $results = $socks4;
- if ($connect == "Y") {
- $res = socks4_request($ipaddr, $port, $g_ipaddr, 443);
- if (is_array($res)) {
- $results["connect"] = "Y";
- }
- }
- if ($smtp == "Y") {
- $res = socks4_request($ipaddr, $port, $smtp_ipaddr, 25);
- if (is_array($res)) {
- $results["smtp"] = "Y";
- }
- }
- }
- break;
- }
- case "SOCKS5": {
- $socks5 = socks5_request($ipaddr, $port, $dest_addr, $dest_port, "connect");
- if (is_array($socks5)) {
- $results = $socks5;
- if ($connect == "Y") {
- $res = socks5_request($ipaddr, $port, $g_ipaddr, 443, "connect");
- if (is_array($res)) {
- $results["connect"] = "Y";
- }
- }
- if ($smtp == "Y") {
- $res = socks5_request($ipaddr, $port, $smtp_ipaddr, 25, "connect");
- if (is_array($res)) {
- $results["smtp"] = "Y";
- }
- }
- if ($proxy_dns == "Y") {
- $res = socks5_request($ipaddr, $port, $dest_addr, $dest_port, "proxydns");
- if (is_array($res)) {
- $results["proxydns"] = "Y";
- }
- }
- }
- break;
- }
- case "SOCKS-AUTO": {
- $socks4 = socks4_request($ipaddr, $port, $dest_addr, $dest_port);
- if (is_array($socks4)) {
- $results = $socks4;
- $connect_time = $results["connect_time"];
- if ($connect == "Y") {
- $res = socks4_request($ipaddr, $port, $g_ipaddr, 443);
- if (is_array($res)) {
- $results["connect"] = "Y";
- }
- }
- if ($smtp == "Y") {
- $res = socks4_request($ipaddr, $port, $smtp_ipaddr, 25);
- if (is_array($res)) {
- $results["smtp"] = "Y";
- }
- }
- }
- $socks5 = socks5_request($ipaddr, $port, $dest_addr, $dest_port, "connect");
- if (is_array($socks5)) {
- $results = $socks5;
- if ($connect == "Y") {
- $res = socks5_request($ipaddr, $port, $g_ipaddr, 443, "connect");
- if (is_array($res)) {
- $results["connect"] = "Y";
- }
- }
- if ($smtp == "Y") {
- $res = socks5_request($ipaddr, $port, $smtp_ipaddr, 25, "connect");
- if (is_array($res)) {
- $results["smtp"] = "Y";
- }
- }
- if ($proxy_dns == "Y") {
- $res = socks5_request($ipaddr, $port, $dest_addr, $dest_port, "proxydns");
- if (is_array($res)) {
- $results["proxydns"] = "Y";
- }
- }
- }
- if (is_array($socks4) && is_array($socks5)) {
- $results["proxy_type"] = "SOCKS 4/5";
- }
- break;
- }
- default: {
- $results = http_request($ipaddr, $port, $url);
- if (is_array($results)) {
- else ;
- }
- $socks4 = socks4_request($ipaddr, $port, $dest_addr, $dest_port);
- if (is_array($socks4)) {
- $results = $socks4;
- if ($connect == "Y") {
- $res = socks4_request($ipaddr, $port, $g_ipaddr, 443);
- if (is_array($res)) {
- $results["connect"] = "Y";
- }
- }
- if ($smtp == "Y") {
- $res = socks4_request($ipaddr, $port, $smtp_ipaddr, 25);
- if (is_array($res)) {
- $results["smtp"] = "Y";
- }
- }
- }
- $socks5 = socks5_request($ipaddr, $port, $dest_addr, $dest_port, "connect");
- if (is_array($socks5)) {
- $results = $socks5;
- .................................................................
- .............................
- ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement