我在捕獲到遠程機器後產生捲曲輸出。期望函數不斷得到超時,我嘗試了不同的模式仍然沒有運氣。捲曲的要求是形式的,python pexpect無法捲曲輸出
hdl2.sendline("curl -v http://{0}/index.html -o /dev/null".format(host1))
接收的輸出是
" > GET /index.html HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 13.126.208.1
> Accept: */*
< HTTP/1.1 200 OK
< Date: Sun, 20 Aug 2017 12:32:54 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
< Server: Apache/2.4.7 (Ubuntu)
< Last-Modified: Sun, 20 Aug 2017 09:56:44 GMT
< ETag: "2cf6-5572c61363668"
< Accept-Ranges: bytes
< Content-Length: 11510
< Vary: Accept-Encoding
< Content-Type: text/html
<
{ [data not shown]
100 11510 100 11510 0 0 3055k 0 --:--:-- --:--:-- --:--:-- 3746k
* Connection #0 to host 13.126.208.1 left intact
[email protected]:~$ "
這是最終的輸出,我已經期待給出
hdl2.expect("\$ ")
但每次我得到Pexpect的時間到。任何建議表示讚賞。