{"id":229521,"date":"2020-12-13T14:32:01","date_gmt":"2020-12-13T06:32:01","guid":{"rendered":"http:\/\/4563.org\/?p=229521"},"modified":"2020-12-13T14:32:01","modified_gmt":"2020-12-13T06:32:01","slug":"%e8%af%b7%e9%97%ae-python-%e5%88%a9%e7%94%a8-telnetlib-%e7%99%bb%e5%bd%95%e8%a2%ab-acl-%e6%8b%92%e7%bb%9d%e8%af%a5%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86%e5%bc%82%e5%b8%b8%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=229521","title":{"rendered":"\u8bf7\u95ee Python \u5229\u7528 telnetlib \u767b\u5f55\u88ab ACL \u62d2\u7edd\u8be5\u5982\u4f55\u5904\u7406\u5f02\u5e38\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u95ee Python \u5229\u7528 telnetlib \u767b\u5f55\u88ab ACL \u62d2\u7edd\u8be5\u5982\u4f55\u5904\u7406\u5f02\u5e38\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CR7sun <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8bf7\u95ee\u7528 python \u7684 telnetlib \u8fdb\u884c telnet \u767b\u5f55\u65f6,\u8fde\u63a5\u4e0a\u53bb\u53c8\u88ab ACL \u62d2\u4e86\u7136\u540e\u4ee3\u7801\u62a5\u9519\u3002\u8bf7\u95ee\u8be5\u5982\u4f55\u5904\u7406\u8fd9\u4e2a\u5f02\u5e38\uff0c\u7ed3\u675f\u8fd9\u6b21\u767b\u9646\u5c1d\u8bd5\uff1f<\/p>\n<pre><code> try:     self.tn = telnetlib.Telnet(host_ip,port=23,timeout=2)  except:     logging.warning(\"failed to connect to host:%s\" %host_ip)     return False  self.tn.read_until(b'Username:', timeout=3)  self.tn.write(user_name.encode('ascii') + b'n')  self.tn.read_until(b'Password:', timeout=3)  self.tn.write(pass_word.encode('ascii') + b'n')  <\/code><\/pre>\n<p>\u624b\u52a8\u767b\u5f55\u6d4b\u8bd5\u622a\u56fe\uff1a<\/p>\n<p>https:\/\/imgchr.com\/i\/rgKksH<\/p>\n<p>\u4ee3\u7801\u62a5\u9519\u622a\u56fe\uff1a<\/p>\n<p>https:\/\/imgchr.com\/i\/rgKFQe<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4709102\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u90fd\u662f\u5148\u5efa\u7acb\u8fde\u63a5\u518d\u65ad\u5f00\u8fde\u63a5\u7684\u3002\u9519\u8bef\u4fe1\u606f\u5199\u7684\u5f88\u660e\u767d\u554a EOFError \u4f60\u8bd5\u8bd5 except \u8fd9\u4e2a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u95ee Python \u5229\u7528 teln&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/229521"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=229521"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/229521\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229521"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}