pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<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="uoegsiw" 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="sssiqwi" 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="euckkqs" 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>
                            主站蜘蛛池模板: 生物除臭剂-除味剂-植物-污水除臭剂厂家-携葵环保有限公司 | 异噻唑啉酮-均三嗪-三丹油-1227-中北杀菌剂厂家| 超声骨密度仪-骨密度检测仪-经颅多普勒-tcd仪_南京科进实业有限公司 | 电梯乘运质量测试仪_电梯安全评估测试仪-武汉懿之刻 | 收录网| 保定市泰宏机械制造厂-河北铸件厂-铸造厂-铸件加工-河北大件加工 | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 硅胶布|电磁炉垫片|特氟龙胶带-江苏浩天复合材料有限公司 | 24位ADC|8位MCU-芯易德科技有限公司 | 3D全息投影_地面互动投影_360度立体投影_水幕灯光秀 | 广东银虎 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 精密钢管,冷拔精密无缝钢管,精密钢管厂,精密钢管制造厂家,精密钢管生产厂家,山东精密钢管厂家 | 带压开孔_带压堵漏_带压封堵-菏泽金升管道工程有限公司 | 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 渣油泵,KCB齿轮泵,不锈钢齿轮泵,重油泵,煤焦油泵,泊头市泰邦泵阀制造有限公司 | 钢化玻璃膜|手机钢化膜|钢化膜厂家|手机保护膜-【东莞市大象电子科技有限公司】 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 知名电动蝶阀,电动球阀,气动蝶阀,气动球阀生产厂家|价格透明-【固菲阀门官网】 | 楼梯定制_楼梯设计施工厂家_楼梯扶手安装制作-北京凌步楼梯 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | 小程序开发公司_APP开发多少钱_软件开发定制_微信小程序制作_客户销售管理软件-济南小溪畅流网络科技有限公司 | 航空障碍灯_高中低光强航空障碍灯_民航许可认证航空警示灯厂家-东莞市天翔航天科技有限公司 | 锻造液压机,粉末冶金,拉伸,坩埚成型液压机定制生产厂家-山东威力重工官方网站 | 进口消泡剂-道康宁消泡剂-陶氏消泡剂-大洋消泡剂 | 板材品牌-中国胶合板行业十大品牌-环保板材-上海声达板材 | 塑木弯曲试验机_铜带拉伸强度试验机_拉压力测试台-倾技百科 | 壹作文_中小学生优秀满分作文大全 | 裹包机|裹膜机|缠膜机|绕膜机-上海晏陵智能设备有限公司 | 原子吸收设备-国产分光光度计-光谱分光光度计-上海光谱仪器有限公司 | 最新电影-好看的电视剧大全-朝夕电影网 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | 线材成型机,线材折弯机,线材成型机厂家,贝朗自动化设备有限公司1 | 广西绿桂涂料--承接隔热涂料、隔音涂料、真石漆、多彩仿石漆等涂料工程双包施工 | 安驭邦官网-双向万能直角铣头,加工中心侧铣头,角度头[厂家直销] 闸阀_截止阀_止回阀「生产厂家」-上海卡比阀门有限公司 | 硬度计_影像测量仪_维氏硬度计_佛山市精测计量仪器设备有限公司厂家 | 智慧消防-消防物联网系统云平台 智能化的检漏仪_气密性测试仪_流量测试仪_流阻阻力测试仪_呼吸管快速检漏仪_连接器防水测试仪_车载镜头测试仪_奥图自动化科技 | 冷凝水循环试验箱-冷凝水试验箱-可编程高低温试验箱厂家-上海巨为(www.juweigroup.com) | 网络推广公司_网络营销方案策划_企业网络推广外包平台-上海澜推网络 | 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 高压直流电源_特种变压器_变压器铁芯-希恩变压器定制厂家 | 金属抛光机-磁悬浮抛光机-磁力研磨机-磁力清洗机 - 苏州冠古科技 |