久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='STjGo'><tr id='STjGo'><dt id='STjGo'><q id='STjGo'><span id='STjGo'><b id='STjGo'><form id='STjGo'><ins id='STjGo'></ins><ul id='STjGo'></ul><sub id='STjGo'></sub></form><legend id='STjGo'></legend><bdo id='STjGo'><pre id='STjGo'><center id='STjGo'></center></pre></bdo></b><th id='STjGo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='STjGo'><tfoot id='STjGo'></tfoot><dl id='STjGo'><fieldset id='STjGo'></fieldset></dl></div>
  • <tfoot id='STjGo'></tfoot>
  • <legend id='STjGo'><style id='STjGo'><dir id='STjGo'><q id='STjGo'></q></dir></style></legend>

        <bdo id='STjGo'></bdo><ul id='STjGo'></ul>
    1. <small id='STjGo'></small><noframes id='STjGo'>

      1. proc_open 交互

        proc_open interaction(proc_open 交互)

        <small id='FcBxZ'></small><noframes id='FcBxZ'>

        <i id='FcBxZ'><tr id='FcBxZ'><dt id='FcBxZ'><q id='FcBxZ'><span id='FcBxZ'><b id='FcBxZ'><form id='FcBxZ'><ins id='FcBxZ'></ins><ul id='FcBxZ'></ul><sub id='FcBxZ'></sub></form><legend id='FcBxZ'></legend><bdo id='FcBxZ'><pre id='FcBxZ'><center id='FcBxZ'></center></pre></bdo></b><th id='FcBxZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FcBxZ'><tfoot id='FcBxZ'></tfoot><dl id='FcBxZ'><fieldset id='FcBxZ'></fieldset></dl></div>
          1. <legend id='FcBxZ'><style id='FcBxZ'><dir id='FcBxZ'><q id='FcBxZ'></q></dir></style></legend>

                <tfoot id='FcBxZ'></tfoot>

                  <tbody id='FcBxZ'></tbody>
                • <bdo id='FcBxZ'></bdo><ul id='FcBxZ'></ul>
                • 本文介紹了proc_open 交互的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  這是我想要實現的目標:打開一個 shell(korn 或 bash,無所謂),從那個 shell,我想打開一個 ssh 連接(ssh user@host).在某些時候可能會發生這種情況,我會被提示輸入密碼,或者我可能會被問到是否確定要連接(有問題的密鑰).

                  Here's what I'm trying to achieve: open a shell (korn or bash, doesn't matter), from that shell, I want to open a ssh connection (ssh user@host). At some point it is likely to happen I will be prompted for either a password or I might be asked whether or not I'm sure I want to connect (offending keys).

                  在有人問之前:是的,我知道有一個用于 ssh2 exec 調用的插件,但是我正在使用的服務器不支持它,并且不太可能這樣做.

                  Before anyone asks: yes, I am aware there is a plugin for ssh2 exec calls, but the servers I'm working on don't support it, and are unlikely to do so.

                  這是我迄今為止嘗試過的:

                  Here's what I've tried so far:

                  $desc = array(array('pipe','r'),array('pipe','w'));//used in all example code
                  $p = proc_open('ssh user@host',$desc,$pipes);
                  if(!is_resource($p)){ die('@!#$%');}//will omit this line from now on
                  sleep(1);//omitting this,too but it's there every time I need it
                  

                  然后我嘗試讀取控制臺輸出 (stream_get_contents($pipes[1])) 以查看我接下來必須傳遞的內容(密碼,是或返回 'connection failed: '.stream_get_contents($pipes[1]) 和 proc_close $p.

                  Then I tried to read console output (stream_get_contents($pipes[1])) to see what I have to pass next (either password, yes or return 'connection failed: '.stream_get_contents($pipes[1]) and proc_close $p.

                  這給了我以下錯誤:

                  偽終端不會被分配,因為 stdin 不是終端.

                  Pseudo-terminal will not be allocated because stdin is not a terminal.

                  所以,我雖然在 php:// io-stream 上下文中調用了 ssh,但似乎是上述錯誤的合理解釋.

                  So, I though ssh was called in the php:// io-stream context, seems a plausible explanation of the above error.

                  下一步:我雖然關于 我的第一個 SO 問題 并決定它可能是一個最好先打開 bash/ksh shell:

                  Next: I though about my first SO question and decided it might be a good idea to open a bash/ksh shell first:

                  $p = proc_open('bash',$desc,$pipes);
                  

                  從那里開始,但我收到了完全相同的錯誤消息,只是這一次,腳本停止運行,但 ssh 確實運行了.所以我充滿希望,然后覺得自己很愚蠢,最終絕望了:

                  And take it from there, but I got the exact same error message, only this time, the script stopped running but ssh did run. So I got hopeful, then felt stupid and, eventually, desperate:

                  $p=proc_open('bash && ssh user@host',$desc,$pipes);
                  

                  等待幾秒鐘后,我收到以下錯誤:

                  After a few seconds wait, I got the following error:

                  PHP 致命錯誤:允許的內存大小為 134217728 字節已用完(嘗試分配 133693440 字節)

                  PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 133693440 bytes)

                  即使在我最后一次絕望的嘗試中,調用堆棧也會不斷地調用 stream_get_contents 行:

                  The Call Stack keeps bringing up the stream_get_contents line, even in my last desperate attempt:

                  #!/path/to/bin/php -n
                  <?php
                      $p = proc_open('bash && ssh user@host',array(array('pipe','r'),array('pipe','w')),$ps);
                      if (!is_resource($p))
                      {
                          die('FFS');
                      }
                      usleep(10);
                      fwrite($ps[0],'yes'."
                  ");
                      fflush($ps[0]);
                      usleep(20);
                      fwrite($ps[0],'password'."
                  ");
                      fflush($ps[0]);
                      usleep(20);
                      fwrite($ps[0],'whoami'."
                  ");
                      fflush($ps[0]);
                      usleep(2);
                      $msg = stream_get_contents($ps[1]);
                      fwrite($ps[0],'exit'."
                  ");
                      fclose($ps[0]);
                      fclose($ps[1]);
                      proc_close($p);
                  ?>
                  

                  我知道,它很亂,有很多fflush 和冗余,但重點是:我知道這個連接會首先提示我輸入有問題的密鑰,然后詢問密碼.我的猜測是 $pipes[1] 中的流包含 ssh 連接,因此它的內容很大.那么我需要的是管道內的管道......這甚至可能嗎?我一定是遺漏了什么,如果這不可能的話,管子有什么用……我的猜測是 proc_open 命令開始是錯誤的,(錯誤:管道損壞).但我真的看不到第一個錯誤的任何其他方式......有什么想法嗎?或者,如果上述咆哮根本不清楚(可能不是),請跟進問題.

                  I know, its a mess, a lot of fflush and redundancy, but the point is: I know this connection will first prompt me for offending keys, and then ask a password. My guess is the stream in $pipes[1] holds the ssh connection, hence it's content is huge. what I need then, is a pipe inside a pipe... is this even possible? I must be missing something, what good is a pipe if this isn't possible... My guess is the proc_open command is wrong to begin with, (error: Broken pipe). But I really can't see any other way around the first error... any thoughts? Or follow up questions if the above rant isn't at all clear (which it probably isn't).

                  推薦答案

                  在有人問之前:是的,我知道有一個用于 ssh2 exec 的插件調用,但我正在使用的服務器不支持它,并且不太可能這樣做.

                  Before anyone asks: yes, I am aware there is a plugin for ssh2 exec calls, but the servers I'm working on don't support it, and are unlikely to do so.

                  實際上有兩個.PECL 模塊,這是大多數服務器都沒有安裝的 PITA 和 phpseclib,一個純 PHP SSH2 實現.其使用示例:

                  There are actually two. The PECL module, which is a PITA that most servers don't have installed anyway and phpseclib, a pure PHP SSH2 implementation. An example of its use:

                  <?php
                  include('Net/SSH2.php');
                  
                  $ssh = new Net_SSH2('www.domain.tld');
                  if (!$ssh->login('username', 'password')) {
                      exit('Login Failed');
                  }
                  
                  echo $ssh->exec('pwd');
                  echo $ssh->exec('ls -la');
                  ?>
                  

                  這篇關于proc_open 交互的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無法連接到主機)
                  Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實現)
                  Sending a byte array from PHP to WCF(將字節數組從 PHP 發送到 WCF)
                • <legend id='x2oVa'><style id='x2oVa'><dir id='x2oVa'><q id='x2oVa'></q></dir></style></legend>
                • <i id='x2oVa'><tr id='x2oVa'><dt id='x2oVa'><q id='x2oVa'><span id='x2oVa'><b id='x2oVa'><form id='x2oVa'><ins id='x2oVa'></ins><ul id='x2oVa'></ul><sub id='x2oVa'></sub></form><legend id='x2oVa'></legend><bdo id='x2oVa'><pre id='x2oVa'><center id='x2oVa'></center></pre></bdo></b><th id='x2oVa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='x2oVa'><tfoot id='x2oVa'></tfoot><dl id='x2oVa'><fieldset id='x2oVa'></fieldset></dl></div>

                    <small id='x2oVa'></small><noframes id='x2oVa'>

                        <tbody id='x2oVa'></tbody>
                          <bdo id='x2oVa'></bdo><ul id='x2oVa'></ul>
                          <tfoot id='x2oVa'></tfoot>
                            主站蜘蛛池模板: av在线黄 | 日韩二三区 | 亚洲一区国产 | 亚洲成人日韩 | 1204国产成人精品视频 | 久久99精品久久久久久秒播九色 | 台湾佬久久 | 午夜精品久久久久久久久久久久久 | 日韩三级视频 | 亚洲美女视频 | 欧美中文一区 | 国产日韩欧美二区 | 欧美韩一区二区 | 日本精品久久 | 国产精品久久久久久影视 | 国产精品美女久久久久久久久久久 | 夜夜爽夜夜操 | 久久久久久久国产 | 国产精品久久国产精品 | 久久精品免费观看 | 国产精品日韩欧美一区二区三区 | 亚洲成年在线 | 国产精品国产 | 欧美伊人久久久久久久久影院 | 日韩一级免费电影 | 在线免费观看毛片 | 三级视频在线观看 | 欧美videosex性极品hd | 久久久国产精品 | 欧美日韩不卡 | 这里只有精品99re | 91精品国产高清一区二区三区 | 久久中文字幕一区 | 涩涩视频在线看 | 成人a视频在线观看 | 黄色精品| 欧美激情视频一区二区三区在线播放 | 免费观看黄色一级片 | 正在播放一区二区 | 国产精品99久久久久久久久久久久 | 日本精品久久久久 |