function shellclean($array, $index, $maxlength)
{
    if (isset($array["{$index}"])) {
        $input = substr($array["{$index}"], 0, $maxlength);
        $input = EscapeShellArg($input);
        return $input;
    }
    return NULL;
}
function parse_palmdesktop($file, $exc_private = 1)
{
    $file = EscapeShellArg($file);
    $exc_private = EscapeShellArg($exc_private);
    exec("perl tools/palm_datebook.pl {$file} {$exc_private}", $Entries);
    $data = array();
    while (list($line_num, $line) = each($Entries)) {
        $data[] = ParseLine($line);
    }
    return $data;
}
 private function CheckCDN()
 {
     $this->Log('{lightblue}Checking CDN subdomains');
     $Questions = ['cdn.level3.cs.steampowered.com', 'cdn.akamai.cs.steampowered.com', 'cdn.highwinds.cs.steampowered.com'];
     $Response = [];
     for ($i = 1; $i < 11; $i++) {
         $Questions[] = 'content' . $i . '.steampowered.com';
     }
     foreach ($Questions as $Question) {
         Exec('dig +short ' . EscapeShellArg($Question), $Answer);
         $Answer = Array_Shift($Answer);
         $Answer = RTrim($Answer, '.');
         $Response[$Question] = $Answer;
     }
     File_Put_Contents(__DIR__ . '/Random/CDNs.json', JSON_Encode($Response, JSON_PRETTY_PRINT));
 }
Exemple #4
0
#-------------------------------------------------------------------------------
Header('Content-type: text/plain; charset=utf-8');
#-------------------------------------------------------------------------------
$Lines = Max(10, $Lines);
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Logs = SPrintF('%s/logs', $Tmp);
#-------------------------------------------------------------------------------
$Command = SPrintF('tail -n %u %s/%s', $Lines, $Logs, $Log);
#-------------------------------------------------------------------------------
if ($Search) {
    $Command .= SPrintF(' | grep %s', EscapeShellArg($Search));
}
#-------------------------------------------------------------------------------
$Command .= ' 2>&1';
#-------------------------------------------------------------------------------
Exec($Command, $Result);
#-------------------------------------------------------------------------------
Array_UnShift($Result, SPrintF("%s\n", $Command));
#-------------------------------------------------------------------------------
if ($IsWrap) {
    #-----------------------------------------------------------------------------
    for ($i = 0; $i < Count($Result); $i++) {
        $Result[$i] = WordWrap($Result[$i], 100, "\n", TRUE);
    }
}
#-------------------------------------------------------------------------------