"; $dmoreform=''; $prego=''; if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) { $prego=" 
 
"; } else { $macw="
MAMP via macOS or Windows           
"; } function maybecet($cdm) { global $allowed; $outcdm=$cdm; if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) { if (strpos($outcdm, " '") !== false) { if (strpos($outcdm, explode(' ',$allowed[0])[3]) !== false) { $outcdm=str_replace(explode(' ',$allowed[0])[3],"'
" . str_replace("'",'',explode(' ',$allowed[0])[3]) . "
'",$outcdm); } } if (strpos($outcdm, " ") !== false) { if (strpos($outcdm, ' ' . explode(' ',$allowed[0])[1] . ' ') !== false) { $outcdm=str_replace(" " . explode(' ',$allowed[0])[1] . " ","
" . explode(' ',$allowed[0])[1] . "
",$outcdm); } } } return $outcdm; } function rework($incd) { //return $incd; global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps; $outcd=$incd; if ($ps != '') { if (strpos($incd, str_replace("'",'"',$ps)) !== false) { if ($cmdtitlesuffix != '' && strpos($incd, $cmdtitlesuffix) === false) { $extra=explode(str_replace("'",'"',$ps), $incd)[1]; $outcd=str_replace(str_replace("'",'"',$ps),$cmdtitlesuffix, $incd) . ' ' . str_replace("'",'"',$ps) . $extra; } else if ($cmdtitlefilesuffix != '' && strpos($incd, $cmdtitlefilesuffix) === false) { $extra=explode(str_replace("'",'"',$ps), $incd)[1]; $outcd=str_replace(str_replace("'",'"',$ps),$cmdtitlefilesuffix, $incd) . ' ' . str_replace("'",'"',$ps) . $extra; } } } return $outcd; } function reworkt($incd) { //return $incd; global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps; $aps=$ps; if ($ps != '' && strpos($incd, '-exec ') !== false && strpos($incd, str_replace("'",'`',str_replace('"','`',$ps))) === false && strpos($incd, ' ls -l') !== false) { $aps=str_replace("file","ls -l",$ps); } else if ($ps != '' && strpos($incd, '-exec ') !== false && strpos($incd, str_replace("'",'`',str_replace('"','`',$ps))) === false && strpos($incd, ' file') !== false) { $aps=str_replace("ls -l","file",$ps); } $outcd=$incd; if ($aps != '') { if (strpos($incd, str_replace("'",'`',str_replace('"','`',$aps))) !== false) { if ($cmdtitlesuffix != '' && strpos($incd, $cmdtitlesuffix) === false) { $extra=explode(str_replace("'",'`',str_replace('"','`',$aps)), $incd)[1]; $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ', str_replace(str_replace("'",'`',str_replace('"','`',$aps)),$cmdtitlesuffix, $incd) . ' ' . str_replace("'",'`',str_replace('"','`',$aps))); // . $extra; } else if ($cmdtitlefilesuffix != '' && strpos($incd, $cmdtitlefilesuffix) === false) { $extra=explode(str_replace("'",'`',str_replace('"','`',$aps)), $incd)[1]; $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ', str_replace(str_replace("'",'`',str_replace('"','`',$aps)),$cmdtitlefilesuffix, $incd) . ' ' . str_replace("'",'`',str_replace('"','`',$aps))); // . $extra; } } } return $outcd; } function yourexec($incd) { global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps; $outcd=$incd; if ($ps != '') { if (strpos($incd, str_replace('"',"'",$ps)) !== false) { if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } } } if (strpos($outcd, '|') !== false) { return str_replace("\\","\\\\",exec('(' . $outcd . ')')); } return str_replace("\\","\\\\",exec($outcd)); } function yourshell_exec($incd) { global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps; $outcd=$incd; if ($ps != '') { if (strpos($incd, str_replace('"',"'",$ps)) !== false) { if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } } } if (strpos($outcd, '|') !== false) { return str_replace("\\","\\\\",shell_exec('(' . $outcd . ')')); } return str_replace("\\","\\\\",shell_exec($outcd)); } function ourexec($incd) { global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps, $yourexec, $yourshell_exec, $winonly; $outcd=$incd; if ($ps != '') { if (strpos($incd, str_replace('"',"'",$ps)) !== false) { if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } } } if (strpos($outcd, '|') !== false) { if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $yourexec = str_replace("\\","`",exec('(' . $outcd . ')')); $winonly.="\n document.getElementById('prer').setAttribute('data-title', \"" . str_replace("\n","
",$yourexec) . "\"); \n"; //return $yourexec; } return exec('(' . $outcd . ')'); } if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $yourexec = str_replace("\\","`",exec($outcd)); $winonly.="\n document.getElementById('prer').setAttribute('data-title', \"" . str_replace("\n","
",$yourexec) . "\"); \n"; //return $yourexec; } return exec($outcd); } function ourshell_exec($incd) { global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps, $yourexec, $yourshell_exec, $winonly; $outcd=$incd; if ($ps != '') { if (strpos($incd, str_replace('"',"'",$ps)) !== false) { if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) { $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ', str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps)); } } } if (strpos($outcd, '|') !== false) { if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $yourshell_exec = str_replace("\\","`",shell_exec('(' . $outcd . ')')); $winonly.="\n document.getElementById('prel').setAttribute('data-title', \"" . str_replace("\n","
",$yourshell_exec) . "\"); \n"; //return $yourshell_exec; } return shell_exec('(' . $outcd . ')'); } if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $yourshell_exec = str_replace("\\","`",shell_exec($outcd)); $winonly.="\n document.getElementById('prel').setAttribute('data-title', \"" . str_replace("\n","
",$yourshell_exec) . "\"); \n"; //return $yourshell_exec; } return shell_exec($outcd); } if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $allowed=['dir .\* /B /S ', ' /O:-D ']; $tswitch='dir newest files first'; } else if (strpos($_SERVER['SERVER_NAME'], 'rjmprogramming.com.au') !== false) { $allowed=["find . -name '*' ", ' -atime ', ' -Btime ', ' -ctime ', ' -mtime ']; $cmdtitlesuffix=' -exec ls -l {} \;'; $cmdtitlefilesuffix=' -exec file {} \;'; } else { $cmdtitlesuffix=' -exec ls -l {} \;'; $cmdtitlefilesuffix=' -exec file {} \;'; } $cmnd=$allowed[0]; $switch=$allowed[1]; if (isset($_GET['cmnd'])) { $cmnd=str_replace('+',' ',urldecode($_GET['cmnd'])); if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false && explode(' ',$cmnd)[0] == explode(' ',$allowed[0])[0]) { $allowed[0]=$cmnd; } $ok=false; //for ($i=0; $i" . $np . "" . str_replace("","",""); } $switch.=$np; } else if (isset($_POST['nprefix'])) { $np=str_replace(' ','+',urldecode($_POST['nprefix'])); if (strlen($np) != '') { $nprefix="" . str_replace("","",""); } $switch.=$np; } if (isset($_GET['switch'])) { $switch=str_replace('+',' ',urldecode($_GET['switch'])); } else if (isset($_POST['switch'])) { $switch=str_replace('+',' ',urldecode($_POST['switch'])); } $origswitch=$switch; if (strpos($origswitch, '-mtime') !== false) { $tswitch='find via modified time switch'; } else if (strpos($origswitch, '-Btime') !== false) { $tswitch='find via file inode creation time switch'; } else if (strpos($origswitch, '-ctime') !== false) { $tswitch='find via created time switch'; } else if (strpos($origswitch, '-atime') !== false) { $tswitch='find via access time switch'; } if (isset($_GET['nprefix'])) { $switch.=str_replace('+',' ',urldecode($_GET['nprefix'])); } else if (isset($_POST['nprefix'])) { $switch.=str_replace('+',' ',urldecode($_POST['nprefix'])); } if (strpos($switch, '/') === false) { if (isset($_GET['number'])) { $u=str_replace('+',' ',urldecode($_GET['number'])); if ($u == '') { $u='1'; } $switch.=str_replace('+',' ',urldecode($_GET['number'])); } else if (isset($_POST['number'])) { $u=str_replace('+',' ',urldecode($_POST['number'])); if ($u == '') { $u='1'; } $switch.=str_replace('+',' ',urldecode($_POST['number'])); } else { $switch.='1'; } if (isset($_GET['unit'])) { $uv=str_replace('+',' ',urldecode($_GET['unit'])); if ($uv != '') { $ut=str_replace('m', 'Minute', str_replace('w', 'Week', str_replace('h', 'Hour', str_replace('s', 'Second', str_replace('d', 'Day', $uv))))) . '(s)'; } $switch.=str_replace('+',' ',urldecode($_GET['unit'])); } else if (isset($_POST['unit'])) { $uv=str_replace('+',' ',urldecode($_POST['unit'])); if ($uv != '') { $ut=str_replace('m', 'Minute', str_replace('w', 'Week', str_replace('h', 'Hour', str_replace('s', 'Second', str_replace('d', 'Day', $uv))))) . '(s)'; } $switch.=str_replace('+',' ',urldecode($_POST['unit'])); } } if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) { if (isset($_GET['postswitch'])) { $ps=str_replace(' ',' +',str_replace('+',' ',urldecode(str_replace('%C2%A0','',$_GET['postswitch'])))); if ($ps == 'undefined') { $ps=''; } $switch.=' ' . str_replace('"',"'",trim($ps)); $switch=trim($switch, ' '); if ($ps == '') { $ps=' '; } $prego=" 
" . $ps . "
"; } else if (isset($_POST['postswitch'])) { $ps=str_replace(' ',' +',str_replace('+',' ',urldecode(str_replace('%C2%A0','',$_POST['postswitch'])))); if ($ps == 'undefined') { $ps=''; } $switch.=' ' . str_replace('"',"'",trim($ps)); $switch=trim($switch, ' '); if ($ps == '') { $ps=' '; } $prego=" 
" . $ps . "
"; } } if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') { $pret='code'; $selbit=maybecet($cmnd) . "  "; } else { $selbit=maybecet($cmnd) . "   "; } for ($i=1; $i', '', $selbit); } } if ($cmdtitlesuffix != '' || 1 == 1) { $toutputte=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('

' + this.title + '

' + '" . str_replace("\n","
",yourexec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix)) . "' + '


' + '

'); xx.document.title=this.title;\" id=thl title=\"\$outputte = exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace(' ',' +',$switch)) . $cmdtitlesuffix) . "');" . "\" "; $toutputts=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('

' + this.title + '

' + ldebate('" . str_replace("\n","
",yourshell_exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix)) . "') + '

' + '

'); xx.document.title=this.title;\" id=thr title=\"\$outputts = shell_exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace(' ',' +',$switch)) . $cmdtitlesuffix) . "');" . "\" "; //$outputte=' id=thld title="' . exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix) . '" '; //$outputts=' id=thrd title="' . shell_exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix) . '" '; $outputte=" id=prer onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('

' + this.title + '

' + '" . str_replace("\n","
",yourexec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlefilesuffix)) . "' + '


' + '

'); xx.document.title=this.title;\" id=thld title=\"\$outputfilete = exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace(' ',' +',$switch)) . $cmdtitlefilesuffix) . "');" . "\" "; $outputts=" id=prel onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('

' + this.title + '

' + ldebate('" . str_replace("\n","
",yourshell_exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlefilesuffix)) . "') + '

' + '

'); xx.document.title=this.title;\" id=thld title=\"\$outputfilets = shell_exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace(' ',' +',$switch)) . $cmdtitlefilesuffix) . "');" . "\" "; } $outpute = str_replace("\n", "
", ourexec($cmnd . str_replace(' ',' +',$switch))); $output = str_replace("\n", "
", ourshell_exec($cmnd . str_replace(' ',' +',$switch))); // Display the list of all file // and directory, if chosen echo "find_minus.php - PHP Supervise find or dir var xx=null; var ishover=false; var lrect=null; var rrect=null; var pointerX=-1; var pointerY=-1; var origcmnd=''; var waso=null; var wasih=''; function ldebate(inh) { var outh=inh; if (outh.indexOf(String.fromCharCode(92)) != -1) { while (outh.indexOf(String.fromCharCode(92)) != -1) { outh=outh.replace(String.fromCharCode(92), '`'); } outh=outh.replace(/\`/g, String.fromCharCode(92) + String.fromCharCode(92)); } var outlines=outh.replace(/\$/g,'').split('
'); var eachlineh=-1; var vsi=-1; if (lrect && eval('' + pointerY) >= 0) { if (eval('' + pointerY) >= eval('' + lrect.top) && eval('' + pointerY) <= eval('' + lrect.bottom)) { eachlineh=eval(eval('' + lrect.height) / eval('' + outlines.length)); vsi=Math.floor(eval(eval('' + pointerY) - eval('' + lrect.top)) / eachlineh); console.log('vsi=' + vsi + ' eachlineh=' + eachlineh + ' outlines.length=' + outlines.length + ' inh=' + inh); outh=inh.replace(outlines[vsi], '' + outlines[vsi] + ''); } } return outh; } function onmout(one) { if (xx && ishover) { ishover=false; xx.close(); xx=null; } } function onmo(event) { if (document && ('' + event.target.outerHTML).indexOf('') != -1) { ishover=true; if (event.touches) { if (event.touches[0].pageX) { pointerX = event.touches[0].pageX; pointerY = event.touches[0].pageY; } else { pointerX = event.touches[0].clientX; pointerY = event.touches[0].clientY; } } else if (event.clientX || event.clientY) { pointerX = event.clientX; pointerY = event.clientY; } else { pointerX = event.pageX; pointerY = event.pageY; } //if (('' + event.target.getAttribute('data-title')).replace('undefined','').replace('null','') != '') { // waso=event.target; // wasih=event.target.innerHTML; // event.target.innerHTML=event.target.getAttribute('data-title'); // setTimeout(backwas, 2000); //} event.target.click(); } } function backwas() { waso.innerHTML=wasih; } function windowopen(pone,ptwo,pthree) { if (xx) { xx.close(); xx=null; } if (ishover) { ishover=false; return null; } if (event.touches) { if (event.touches[0].pageX) { pointerX = event.touches[0].pageX; pointerY = event.touches[0].pageY; } else { pointerX = event.touches[0].clientX; pointerY = event.touches[0].clientY; } } else if (event.clientX || event.clientY) { pointerX = event.clientX; pointerY = event.clientY; } else { pointerX = event.pageX; pointerY = event.pageY; } return window.open(pone,ptwo,pthree); } function xxdocumentwrite(thehtml) { //alert(thehtml); while (thehtml.indexOf(String.fromCharCode(92) + String.fromCharCode(92)) != -1) { thehtml=thehtml.replace(String.fromCharCode(92) + String.fromCharCode(92), String.fromCharCode(92)); } document.getElementById('dinfo').innerHTML=thehtml; //alert(document.getElementById('dinfo').innerHTML); if (xx) { //alert(thehtml); //alert(thehtml.replace(/\\\\/g,'\\\\\\\\')); xx.document.write(thehtml); } } function thtitleit() { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { if (document.getElementById('ic')) { document.getElementById('ic').style.display='none'; } } origcmnd=document.getElementById('cmnd').value; var ths=document.getElementsByTagName('th'); for (var ij=0; ij
" . $dmoreform . "
$" . "output = shell_exec('" . rework(str_replace("'",'"',$cmnd) . str_replace("'",'"',str_replace(' ',' +',$switch))) . "'); $" . "output = exec('" . rework(str_replace("'",'"',$cmnd) . str_replace("'",'"',str_replace(' ',' +',$switch))) . "');
" . $selbit . $prego . "    " . $macw . "RJM Programming - March, 2022
Thanks to https://www.geeksforgeeks.org/php-shell_exec-vs-exec-function/
<" . $pret . $outputts . " value=\"" . $output . "\">$output <" . $pret . $outputte . " value=\"" . $outpute . "\">$outpute


";
?>