예제 #1
0
파일: locallib.php 프로젝트: verbazend/AWFA
/**
 * Combine a base URL and a relative URL to produce a new
 * absolute URL.  The base URL is often the URL of a page,
 * and the relative URL is a URL embedded on that page.
 *
 * This function implements the "absolutize" algorithm from
 * the RFC3986 specification for URLs.
 *
 * This function supports multi-byte characters with the UTF-8 encoding,
 * per the URL specification.
 *
 * Parameters:
 * 	baseUrl		the absolute base URL.
 *
 * 	url		the relative URL to convert.
 *
 * Return values:
 * 	An absolute URL that combines parts of the base and relative
 * 	URLs, or FALSE if the base URL is not absolute or if either
 * 	URL cannot be parsed.
 */
function url_to_absolute( $baseUrl, $relativeUrl )
{
	// If relative URL has a scheme, clean path and return.
	$r = split_url( $relativeUrl );
	if ( $r === FALSE )
		return FALSE;
	if ( !empty( $r['scheme'] ) )
	{
		if ( !empty( $r['path'] ) && $r['path'][0] == '/' )
			$r['path'] = url_remove_dot_segments( $r['path'] );
		return join_url( $r );
	}

	// Make sure the base URL is absolute.
	$b = split_url( $baseUrl );
	if ( $b === FALSE || empty( $b['scheme'] ) || empty( $b['host'] ) )
		return FALSE;
	$r['scheme'] = $b['scheme'];
    if (empty($b['path'])) {
        $b['path'] = '';
    }

	// If relative URL has an authority, clean path and return.
	if ( isset( $r['host'] ) )
	{
		if ( !empty( $r['path'] ) )
			$r['path'] = url_remove_dot_segments( $r['path'] );
		return join_url( $r );
	}
	unset( $r['port'] );
	unset( $r['user'] );
	unset( $r['pass'] );

	// Copy base authority.
	$r['host'] = $b['host'];
	if ( isset( $b['port'] ) ) $r['port'] = $b['port'];
	if ( isset( $b['user'] ) ) $r['user'] = $b['user'];
	if ( isset( $b['pass'] ) ) $r['pass'] = $b['pass'];

	// If relative URL has no path, use base path
	if ( empty( $r['path'] ) )
	{
		if ( !empty( $b['path'] ) )
			$r['path'] = $b['path'];
		if ( !isset( $r['query'] ) && isset( $b['query'] ) )
			$r['query'] = $b['query'];
		return join_url( $r );
	}

	// If relative URL path doesn't start with /, merge with base path.
	if ($r['path'][0] != '/') {
		$base = textlib::strrchr($b['path'], '/', TRUE);
		if ($base === FALSE) {
			$base = '';
		}
		$r['path'] = $base . '/' . $r['path'];
	}
	$r['path'] = url_remove_dot_segments($r['path']);
	return join_url($r);
}
function url_add_dots_for_relative($base, $url)
{
    if (empty($url) || empty($base)) {
        return $url;
    }
    $parts = split_url($base);
    $base_path = $parts['path'];
    $parts = split_url($url);
    $url_path = empty($parts['path']) ? '' : $parts['path'];
    if (startsWith($base_path, "/") && startsWith($url, "/")) {
        // Remove the slash and create the ../../.. going to the root
        $url_segments = explode("/", $url_path);
        $path_segments = explode("/", $base_path);
        //print_r ($url_segments);
        //print_r ($path_segments);
        while (count($url_segments) && $url_segments[0] == $path_segments[0]) {
            array_shift($url_segments);
            array_shift($path_segments);
        }
        //print_r ($url_segments);
        //print_r ($path_segments);
        $depth = count($path_segments) - 1;
        //$url = substr($url, 1);
        $url = implode("/", $url_segments);
        while ($depth > 0) {
            $url = '../' . $url;
            $depth--;
        }
    }
    if (empty($url)) {
        return ".";
    }
    return $url;
}
예제 #3
0
파일: proxy.php 프로젝트: hysterix/nraep
function grabproxy($header, $agentstr)
{
    // hidemyass.com got hax'd by hysterix!
    // these are the 'ghetto tables'; md5's
    // of an image we compare to when grabing proxies
    // so we can grab the port number with ease.
    // shit loads faster than scanning each pixel
    // in each image, and easier to implement.
    // pretty hax if you ask me, obviously they
    // don't want people doing this! The first rule of fight club....
    // Also, if you do the md5 locally to just the file it is different from these.
    // I believe this is the md5 of the header as well as the image together,
    // don't think they are wrong when they don't compare on your system
    $ghetto_tables = array('2741898dc5492442a60c48fd8af5f914' => '80', '27760f111201b87996e9d5f1f55e1e2b' => '81', '8c4d39d1386fdb4dc6312a00387ae8be' => '444', '38925677a3ab9071d81b50d0e4d14ce0' => '1080', '5969ad3f3cb42fc2cfc32e667b64db4d' => '1260', '37357c1363a6edac318a513c8a16733a' => '2301', '380ac73e41c1c9f4b460b6aa74fbaea5' => '3124', '70846fe60a6915b3979033fe53f46402' => '3128', '9407ba7a72999731d6cefdc41a7522b4' => '33655', '53fc62ce0db7912b5be729849ef11dff' => '34387', '9229f0e355a3311d1f6b196ffce7cb74' => '6588', 'c1865c575ac4645f47b603deaf98ca60' => '6654', 'a580f19646451c4d832303b596fe6248' => '6666', '2980cfed592e0e31f9b0f30e24e23bf2' => '8000', '9739217797951fd6525313a762007561' => '8080', '0b269894b8fc6b74adb92840528b4e33' => '8118', '14509909876456e7539e95a9a104fcdc' => '8888', '3afb17a502f997278ec096e3347edace' => '9090', '7109cafc0782511575f4dc40e932d2e7' => '9188', '963b608d579bd4a2110e41b11eb6a12a' => '51898', '703a56c126717b1e6791915eee0ed3d8' => '65208');
    // Gather an array of proxy lists (About 400 proxies in this list)
    $ass_hiders[0] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/1/";
    $ass_hiders[1] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/2/";
    $ass_hiders[2] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/3/";
    $ass_hiders[3] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/4/";
    $ass_hiders[4] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/5/";
    $ass_hiders[5] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/6/";
    $ass_hiders[6] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/7/";
    $ass_hiders[7] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/8/";
    $ass_hiders[8] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/9/";
    $ass_hiders[9] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/10/";
    $ass_hiders[10] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/11/";
    $ass_hiders[11] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/12/";
    $ass_hiders[12] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/13/";
    $ass_hiders[13] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/14/";
    $ass_hiders[14] = "http://hidemyass.com/proxy-list/All-Countries/fast/hide-planetlab/15/";
    $randkey = array_rand($ass_hiders);
    // Select a random $ass_hiders page
    $failed = false;
    //$random_hole = rand(1, count($ass_hiders));
    //foreach ($ass_hiders as $ass_hider) {  // UR DOIN IT WRONG
    $curl = new CURL();
    // create the curl instance
    $opts = setBrowser(0, 0, $header, $agentstr);
    // do not set first variable to 1; we don't need infinite looping
    $curl->retry = MAX_RETRYS;
    $curl->addSession($ass_hiders[$randkey], $opts[0]);
    ob_start();
    // this is a hack if i've ever seen one
    $result = $curl->exec();
    // this is the site returned
    ob_end_clean();
    // without this, php likes to output a 1 to the screen (something to do with the header info probably)
    // unset curl
    $curl->clear();
    // remove the curl instance
    unset($curl);
    if (is_array($result)) {
        $result = $result[0] . $result[1];
    }
    $matches = array();
    $yanoob = array();
    $html = str_get_html($result);
    $arrInput = array();
    foreach ($html->find('table') as $t) {
        $x = 0;
        $matches = array();
        foreach ($t->find('tr') as $rows) {
            foreach ($rows->find('td') as $columns) {
                $str = $columns->outertext;
                // Strip out IP's and load into array $matches
                /* keep the wall of shame up */
                //$pattern = '|(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)|U';
                //$pattern = '/^(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?)
                //	   \.(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?)$/';
                //$pattern = '/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/';
                $pattern = '|(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)|U';
                if (preg_match($pattern, $str, $yatmparr)) {
                    // we found an ip
                    $yanoob[0] = $yatmparr[0];
                    // prepare the ip for the array
                    unset($yatmparr);
                }
                foreach ($columns->find('img') as $yaimg) {
                    $tehport = $yaimg->alt;
                    if (strcmp($tehport, "port") == 0) {
                        // grab the port url
                        $portsrc = $yaimg->src;
                        $assUrl = split_url($ass_hiders[$randkey]);
                        $portUrl = split_url($portsrc);
                        if (isset($portUrl['scheme'])) {
                            // path absolute, use as-is
                            $theport = $arrPost['url'];
                        } else {
                            // no host, path relative, slap this on the back of the original url; great success!
                            $newpath = str_replace_once("/", "", $portUrl['path']);
                            // remove the leading slash if it xists
                            $theport = $assUrl['scheme'] . "://" . $assUrl['host'] . "/" . $newpath . '?' . $portUrl['query'];
                        }
                        $curl = new CURL();
                        // create the curl instance
                        $opts = setBrowser(0, 0, $header, $agentstr);
                        // do not set first variable to 1
                        $curl->retry = MAX_RETRYS;
                        $curl->addSession($theport, $opts[0]);
                        ob_start();
                        // this is a hack if i've ever seen one
                        $result = $curl->exec();
                        // this is the png returned
                        ob_end_clean();
                        // without this, php likes to output a 1 to the screen (something to do with the header info probably)
                        // unset curl
                        $curl->clear();
                        // remove the curl instance
                        unset($curl);
                        if (is_array($result)) {
                            $result = $result[0] . $result[1];
                        }
                        //print_r($result);
                        // ingenuity wins out again; hysterix -1 ; hidemyass - 0
                        // they can slow us down but they cant stop us
                        $portnum = retPortNum($result, $ghetto_tables);
                        if (isset($portnum)) {
                            // everything worked; we only want ip's with ports
                            $yanoob[1] = $portnum;
                            array_push($matches, $yanoob);
                        }
                    }
                }
            }
        }
    }
    $html->clear();
    // if you dont include these two statements, the damn
    unset($html);
    // simple html dom becomes simple memory leaker 2.0 because
    unset($result);
    // of a f*****g "php5 circular references memory leak" - nigger t**s
    unset($agentstr);
    //Grab a random IP from array $matches
    $randkey = array_rand($matches, 1);
    $newprox = $matches[$randkey];
    return $newprox;
}
예제 #4
0
         echo "                      </tr>\n";
     } else {
         echo "                      <tr>\n";
         echo "                        <td align=\"left\" width=\"150\">", gettext("Sign-up Referer:"), "</td>\n";
         echo "                        <td align=\"left\"><a href=\"admin_banned.php?webtag={$webtag}&amp;ban_referer=", rawurlencode($user['REFERER_FULL']), "&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" title=\"{$user['REFERER_FULL']}\">{$user['REFERER']}</a>&nbsp;<a href=\"{$user['REFERER_FULL']}\" target=\"_blank\"><img src=\"", html_style_image('link.png'), "\" border=\"0\" align=\"top\" alt=\"", gettext("External Link"), "\" title=\"", gettext("External Link"), "\" /></a></td>\n";
         echo "                      </tr>\n";
     }
 } else {
     echo "                      <tr>\n";
     echo "                        <td align=\"left\" width=\"150\">", gettext("Sign-up Referer:"), "</td>\n";
     echo "                        <td align=\"left\">", gettext("Unknown"), "</td>\n";
     echo "                      </tr>\n";
 }
 if (isset($user['SESSION_REFERER']) && strlen(trim($user['SESSION_REFERER'])) > 0) {
     $user['SESSION_REFERER_FULL'] = $user['SESSION_REFERER'];
     if (!($user['SESSION_REFERER'] = split_url($user['SESSION_REFERER']))) {
         if (mb_strlen($user['SESSION_REFERER_FULL']) > 25) {
             $user['SESSION_REFERER'] = mb_substr($user['SESSION_REFERER_FULL'], 0, 25);
             $user['SESSION_REFERER'] .= "&hellip;";
         }
     }
     if (referer_is_banned($user['SESSION_REFERER'])) {
         echo "                      <tr>\n";
         echo "                        <td align=\"left\" width=\"150\">", gettext("Session Referer"), "</td>\n";
         echo "                        <td align=\"left\"><a href=\"admin_banned.php?webtag={$webtag}&amp;unban_referer=", rawurlencode($user['SESSION_REFERER_FULL']), "&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" title=\"{$user['SESSION_REFERER_FULL']}\">{$user['SESSION_REFERER']}</a>&nbsp;<a href=\"{$user['SESSION_REFERER_FULL']}\" target=\"_blank\"><img src=\"", html_style_image('link.png'), "\" border=\"0\" align=\"top\" alt=\"", gettext("External Link"), "\" title=\"", gettext("External Link"), "\" /></a> (", gettext("Banned"), ")</td>\n";
         echo "                      </tr>\n";
     } else {
         echo "                      <tr>\n";
         echo "                        <td align=\"left\" width=\"150\">", gettext("Session Referer"), "</td>\n";
         echo "                        <td align=\"left\"><a href=\"admin_banned.php?webtag={$webtag}&amp;ban_referer=", rawurlencode($user['SESSION_REFERER_FULL']), "&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" title=\"{$user['SESSION_REFERER_FULL']}\">{$user['SESSION_REFERER']}</a>&nbsp;<a href=\"{$user['SESSION_REFERER_FULL']}\" target=\"_blank\"><img src=\"", html_style_image('link.png'), "\" border=\"0\" align=\"top\" alt=\"", gettext("External Link"), "\" title=\"", gettext("External Link"), "\" /></a></td>\n";
         echo "                      </tr>\n";
예제 #5
0
<?php

define('ROOT', $_SERVER['DOCUMENT_ROOT']);
define('HOST', $_SERVER['HTTP_HOST']);
define('APP', ROOT . '/application');
require APP . '/config/settings.php';
// ========================================
// Router
// ========================================
require APP . '/controller/controller.php';
switch (split_url()) {
    case '':
        require APP . '/controller/home.php';
        $page = new Home();
        $page->index();
        break;
    case 'about':
        require APP . '/controller/about.php';
        $page = new About();
        $page->index();
        break;
    case '404':
    default:
        require APP . '/controller/error.php';
        $page = new Error();
        $page->index();
        break;
}
예제 #6
0
/**
 * Is a given URL absolute?
 * Note: "//foo/bar" is absolute - leaving the protocol out.
 *
 * @param string URL
 * @return boolean
 */
function is_absolute_url($url)
{
    load_funcs('_ext/_url_rel2abs.php');
    if (($parsed_url = split_url($url)) !== false) {
        if (!empty($parsed_url['scheme']) || !empty($parsed_url['host'])) {
            return true;
        }
    }
    return false;
}
function pugpig_intercept_remote_image_urls($prefix)
{
    $uri = $_SERVER['REQUEST_URI'];
    if (empty($uri)) {
        return;
    }
    $parts = split_url($uri);
    $matches = array();
    $pattern = "/\\" . strrchr(content_url(), '/') . "\\/{$prefix}\\/(.*)\\.([^\\.]+)\$/i";
    $results = preg_match($pattern, $uri, $matches);
    if ($results > 0) {
        $id = $matches[1];
        $new_id = str_replace("_", "=", $id);
        $image_url = base64_decode($new_id);
        //echo("DEBUG. I SHOULD REDIRECT TO\nLocation: ". $image_url); exit();
        header('Location: ' . $image_url);
        exit;
    }
}
예제 #8
0
파일: index.php 프로젝트: hysterix/nraep
     ob_end_clean();
     $time2 = date("Y.m.d");
     $ourFileName = LOG_PATH . $time2 . ".log";
     if (fopen($ourFileName, 'a+')) {
         $ourFileHandle = fopen($ourFileName, 'a+');
         fwrite($ourFileHandle, $yavar);
         fclose($ourFileHandle);
     } else {
         echo "Failed to open log!";
     }
 }
 unset($arrUrl);
 unset($arrInput);
 unset($html);
 $ogUrl = split_url($connectlist[$b][0]);
 $postingUrl = split_url($arrPost['url']);
 if (isset($postingUrl['scheme'])) {
     // path absolute, use as-is
     $urlToPost = $arrPost['url'];
 } else {
     // no host, path relative, slap this on the back of the original url; great success!
     $newpath = str_replace_once("/", "", $postingUrl['path']);
     // remove the leading slash if it exists
     $urlToPost = $ogUrl['scheme'] . "://" . $ogUrl['host'] . "/" . $newpath;
 }
 if ($arrPost == 1) {
     // error
     $cntError++;
 } else {
     if (isset($connectlist[$b][1])) {
         // use previously used user agent
예제 #9
0
         echo "                   <td class=\"postbody\" align=\"left\" width=\"100\">", format_time($visitor['LAST_LOGON']), "</td>\n";
     } else {
         echo "                   <td class=\"postbody\" align=\"left\" width=\"100\">", gettext("Unknown"), "</td>\n";
     }
     if (isset($visitor['IPADDRESS']) && strlen($visitor['IPADDRESS']) > 0) {
         if (ip_is_banned($visitor['IPADDRESS'])) {
             echo "                   <td class=\"postbody\" align=\"left\" width=\"200\"><a href=\"admin_banned.php?webtag={$webtag}&amp;unban_ipaddress={$visitor['IPADDRESS']}&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" target=\"_self\">{$visitor['IPADDRESS']}</a>&nbsp;(", gettext("Banned"), ")&nbsp;</td>\n";
         } else {
             echo "                   <td class=\"postbody\" align=\"left\" width=\"200\"><a href=\"admin_banned.php?webtag={$webtag}&amp;ban_ipaddress={$visitor['IPADDRESS']}&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" target=\"_self\">{$visitor['IPADDRESS']}</a>&nbsp;</td>\n";
         }
     } else {
         echo "                   <td class=\"postbody\" align=\"left\" width=\"200\">", gettext("Unknown"), "</td>\n";
     }
     if (isset($visitor['REFERER']) && strlen(trim($visitor['REFERER'])) > 0) {
         $visitor['REFERER_FULL'] = $visitor['REFERER'];
         if (!($visitor['REFERER'] = split_url($visitor['REFERER']))) {
             if (mb_strlen($visitor['REFERER_FULL']) > 25) {
                 $visitor['REFERER'] = mb_substr($visitor['REFERER_FULL'], 0, 25);
                 $visitor['REFERER'] .= "&hellip;";
             }
         }
         if (referer_is_banned($visitor['REFERER'])) {
             echo "                   <td class=\"posthead\" align=\"left\" style=\"white-space: nowrap\">&nbsp;<a href=\"admin_banned.php?webtag={$webtag}&amp;unban_referer=", rawurlencode($visitor['REFERER_FULL']), "&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" title=\"{$visitor['REFERER_FULL']}\">{$visitor['REFERER']}</a>&nbsp;<a href=\"{$visitor['REFERER_FULL']}\" target=\"_blank\"><img src=\"", html_style_image('link.png'), "\" border=\"0\" align=\"top\" alt=\"", gettext("External Link"), "\" title=\"", gettext("External Link"), "\" /></a>&nbsp;(", gettext("Banned"), ")</td>\n";
         } else {
             echo "                   <td class=\"posthead\" align=\"left\" style=\"white-space: nowrap\">&nbsp;<a href=\"admin_banned.php?webtag={$webtag}&amp;ban_referer=", rawurlencode($visitor['REFERER_FULL']), "&amp;ret=", rawurlencode(get_request_uri(true, false)), "\" title=\"{$visitor['REFERER_FULL']}\">{$visitor['REFERER']}</a>&nbsp;<a href=\"{$visitor['REFERER_FULL']}\" target=\"_blank\"><img src=\"", html_style_image('link.png'), "\" border=\"0\" align=\"top\" alt=\"", gettext("External Link"), "\" title=\"", gettext("External Link"), "\" /></a></td>\n";
         }
     } else {
         echo "                   <td class=\"posthead\" align=\"left\" style=\"white-space: nowrap\">&nbsp;", gettext("Unknown"), "</td>\n";
     }
     echo "                 </tr>\n";
 }
예제 #10
0
 public function index()
 {
     /*if($this->input->is_cli_request()) {
         return FALSE;
       }*/
     if ($this->input->is_cli_request() && !isset($_SERVER['REMOTE_ADDR'])) {
         ignore_user_abort(true);
         set_time_limit(0);
         $this->load->helper('virus');
         define('LOCK_FILE', $this->config->item('lockdir') . 'worker.lock');
         if (!_trylock()) {
             die;
         }
         register_shutdown_function('unlink', LOCK_FILE);
         $this->load->model('home_model');
         /*$virustotal_requests = 0;*/
         $get_queue = $this->home_model->_get_queue();
         if ($get_queue) {
             $this->load->helper('simple_html_dom');
             $this->load->library(array('punycode', 'email'));
             /*$this->load->library('virustotal',array(
                 'key' => $this->config->item('virustotal_key'),
               ));*/
             foreach ($get_queue->result() as $queue) {
                 if (isset($save_result)) {
                     unset($save_result);
                 }
                 if (!$queue->scanned) {
                     if (!_is_url_exist($queue->url)) {
                         $get_domain = split_url($queue->url);
                         if (isset($get_domain['host'])) {
                             $this->home_model->_delete_from_queue(array('id' => $queue->id, 'host' => $get_domain['host']));
                         } else {
                             $this->home_model->_delete_from_queue(array('id' => $queue->id));
                         }
                         unset($get_domain);
                         continue;
                     }
                     $get_domain = split_url($queue->url);
                     if (isset($get_domain['host'])) {
                         $get_domain_host = $get_domain['host'];
                         $get_domain = $this->home_model->_get_result_domain(array('domain' => $get_domain_host));
                         if ($get_domain) {
                             $get_domain_row = $get_domain->row();
                             if (date_diff(date_create($get_domain_row->date), date_create(date('Y-m-d H:i:s', time())))->days > 0) {
                                 $get_domain_data = _avdetect($get_domain_host, 'domain');
                                 usleep(500000);
                                 if ($get_domain_data === FALSE) {
                                     $this->home_model->_delete_from_queue(array('id' => $queue->id, 'host' => $get_domain_host));
                                     /*unset($get_domain,$get_domain_row,$get_domain_data,$get_domain_host);*/
                                     $get_domain = NULL;
                                     $get_domain_row = NULL;
                                     unset($get_domain_data, $get_domain_host);
                                     time_nanosleep(0, 10000000);
                                     continue;
                                 }
                                 $this->home_model->_save_result_domain(array('domain' => $get_domain_host, 'result' => $get_domain_data));
                                 /*unset($get_domain_data);*/
                                 $get_domain_data = NULL;
                             }
                         } else {
                             $get_domain_data = _avdetect($get_domain_host, 'domain');
                             usleep(500000);
                             if ($get_domain_data === FALSE) {
                                 $this->home_model->_delete_from_queue(array('id' => $queue->id, 'host' => $get_domain_host));
                                 /*unset($get_domain,$get_domain_data,$get_domain_host);*/
                                 $get_domain = NULL;
                                 unset($get_domain_data, $get_domain_host);
                                 time_nanosleep(0, 10000000);
                                 continue;
                             }
                             $this->home_model->_save_result_domain(array('domain' => $get_domain_host, 'result' => $get_domain_data));
                             unset($get_domain_data);
                             $get_domain = $this->home_model->_get_result_domain(array('domain' => $get_domain_host));
                             $get_domain_row = $get_domain->row();
                         }
                         $get_domain = NULL;
                     } else {
                         unset($get_domain);
                         $this->home_model->_delete_from_queue(array('id' => $queue->id));
                         time_nanosleep(0, 10000000);
                         continue;
                     }
                     /*if($virustotal_requests < (int)$this->config->item('virustotal_limit')) {*/
                     _request_timeout(10);
                     /*$report = $this->virustotal->getURLReport($queue->url);
                       $virustotal_requests++;
                       if($report && is_object($report)) {
                         if((int)$report->response_code === 0) {
                           $this->virustotal->scanURL($queue->url);
                           $virustotal_requests++;
                         }
                         elseif((int)$report->response_code === 1) {
                           if(date_diff(date_create($this->virustotal->getSubmissionDate($report)),date_create(date('Y-m-d H:i:s',time())))->days === 0) {
                             $save_result = $this->home_model->_save_result($queue->id,$report);
                           }
                           else {
                             $this->virustotal->scanURL($queue->url);
                             $virustotal_requests++;
                           }
                         }
                         else {
                           continue;
                         }
                       }*/
                     $report = _avdetect($queue->url);
                     usleep(500000);
                     if ($report) {
                         $save_result = $this->home_model->_save_result(array('id' => $queue->id, 'result' => $report, 'domain' => $get_domain_row->id));
                     } else {
                         if (isset($get_domain_host)) {
                             $this->home_model->_delete_from_queue(array('id' => $queue->id, 'host' => $get_domain_host));
                             unset($get_domain_host);
                         } else {
                             $this->home_model->_delete_from_queue(array('id' => $queue->id));
                         }
                         /*unset($get_domain_row,$save_result,$report);*/
                         $get_domain_row = NULL;
                         unset($save_result, $report);
                         time_nanosleep(0, 10000000);
                         continue;
                     }
                     /*unset($report);*/
                     $report = NULL;
                     /*if($virustotal_requests >= (int)$this->config->item('virustotal_limit')) {
                           die();
                         }
                       }*/
                 }
                 $get_queue_js = $this->home_model->_get_queue_js(array('id' => $queue->id));
                 if (!$get_queue_js) {
                     $external_js = _parse_external_js($queue->url);
                     if ($external_js) {
                         /*foreach($external_js as $url) {
                             $this->home_model->_add_queue_js(array(
                               'parent' => $queue->id,
                               'url' => $url,
                             ));
                           }*/
                         $this->home_model->_add_queue_js(array('urls' => $external_js, 'parent' => $queue->id));
                         $get_queue_js = $this->home_model->_get_queue_js(array('id' => $queue->id));
                     }
                     unset($external_js);
                 }
                 if ($get_queue_js) {
                     foreach ($get_queue_js->result() as $queue_js) {
                         if ((int) $queue_js->status === 0) {
                             if (!_is_url_exist($queue_js->url)) {
                                 $this->home_model->_delete_from_queue_js(array('id' => $queue_js->id));
                                 continue;
                             }
                             /*if($virustotal_requests < (int)$this->config->item('virustotal_limit')) {*/
                             /*$report_js = $this->virustotal->getURLReport($queue_js->url);
                               $virustotal_requests++;
                               if($report_js && is_object($report_js)) {
                                 if((int)$report_js->response_code === 0) {
                                   $this->virustotal->scanURL($queue_js->url);
                                   $virustotal_requests++;
                                 }
                                 elseif((int)$report_js->response_code === 1) {
                                   if(date_diff(date_create($this->virustotal->getSubmissionDate($report_js)),date_create(date('Y-m-d H:i:s',time())))->days === 0) {
                                     $this->home_model->_save_result_js($queue_js->id,$report_js);
                                   }
                                   else {
                                     $this->virustotal->scanURL($queue_js->url);
                                     $virustotal_requests++;
                                   }
                                 }
                                 else {
                                   continue;
                                 }
                               }*/
                             $report_js = _avdetect($queue_js->url);
                             usleep(500000);
                             if ($report_js) {
                                 $this->home_model->_save_result_js(array('id' => $queue_js->id, 'result' => $report_js));
                             } else {
                                 $this->home_model->_delete_from_queue_js(array('id' => $queue_js->id));
                                 unset($report_js);
                                 continue;
                             }
                             unset($report_js);
                             /*if($virustotal_requests >= (int)$this->config->item('virustotal_limit')) {
                                   die();
                                 }
                               }*/
                         }
                     }
                     /*unset($get_queue_js);*/
                     $get_queue_js = NULL;
                 }
                 if ($queue->scanned || isset($save_result) && $save_result === TRUE) {
                     $this->home_model->_queue_completed(array('id' => $queue->id));
                     _send_mail_url($queue->email, $queue->hash, $queue->url);
                 }
                 time_nanosleep(0, 10000000);
             }
         }
         /*unset($get_queue);*/
         $get_queue = NULL;
         time_nanosleep(0, 10000000);
         $get_old_queue = $this->home_model->_get_old_queue();
         if ($get_old_queue) {
             foreach ($get_old_queue->result() as $old_queue) {
                 $this->home_model->_delete_from_queue(array('id' => $old_queue->id, 'host' => $old_queue->domain));
             }
         }
         $get_old_queue = NULL;
         exit(0);
     }
 }