{"id":16646,"date":"2025-04-18T23:02:47","date_gmt":"2025-04-18T15:02:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/16646.html"},"modified":"2025-04-18T23:02:47","modified_gmt":"2025-04-18T15:02:47","slug":"%e9%80%9a%e8%bf%87shell%e8%84%9a%e6%9c%ac%e5%ae%9e%e7%8e%b0%e6%89%b9%e9%87%8fssh%e7%99%bb%e5%bd%95%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%90%8e%e5%8f%b0%e6%8a%93%e5%8c%85","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/16646.html","title":{"rendered":"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305"},"content":{"rendered":"<h2 style=\"margin-left:.0001pt;text-align:left\"><span style=\"color:#000000\">\u524d\u8a00<\/span><\/h2>\n<h3 style=\"margin-left:.0001pt;text-align:justify\">\u9700\u6c42\u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u9879\u76ee\u73b0\u573a\u9047\u5230\u591a\u8282\u70b9\u968f\u673a\u8bbf\u95ee\u7684\u96c6\u7fa4\u73af\u5883&#xff0c;\u9700\u8981tcpdump\u6293\u5305\u5b9a\u4f4d\u95ee\u9898&#xff0c;\u7531\u4e8e\u8282\u70b9linux\u670d\u52a1\u5668\u6570\u91cf\u5f88\u591a&#xff0c;\u6bcf\u4e2a\u670d\u52a1\u5668\u767b\u5f55ssh\u540e\u53f0\u4f7f\u7528tcpdump\u547d\u4ee4\u6355\u83b7\u7f51\u7edc\u62a5\u6587&#xff0c;\u975e\u5e38\u9ebb\u70e6&#xff0c;\u9700\u8981\u6709\u5de5\u5177\u6216\u8005\u811a\u672c \u80fd\u5728\u672c\u5730\u67d0\u4e2a\u670d\u52a1\u5668\u4e0a\u53d1\u8d77ssh\u8bf7\u6c42&#xff0c;\u5e76\u5411\u76ee\u6807\u670d\u52a1\u5668\u53d1\u9001\u6293\u5305\u547d\u4ee4\u3002<\/p>\n<h3 style=\"margin-left:.0001pt;text-align:justify\">\u89e3\u51b3\u601d\u8def<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6279\u91cf\u4e3b\u673a\u7684\u8fd0\u7ef4&#xff0c;\u9996\u5148\u60f3\u5230\u7684\u662fansible\u3002\u4f17\u6240\u5468\u77e5ansible\u7684\u5f3a\u5927\u4e4b\u5904&#xff0c;\u5fc5\u7136\u662f\u53ef\u4ee5\u5b9e\u73b0\u7684(ansible&#043;playbook\u65b9\u5f0f\u5f88\u5bb9\u6613)&#xff0c;\u4f46\u662f\u8003\u8651\u5230ansible\u7684\u5b89\u88c5\u9700\u8981\u4f9d\u8d56python &#xff0c;\u5e76\u4e14\u5b89\u88c5\u9700\u8981\u6709epel\u7684yum\u8d44\u6e90 &#xff0c;\u6216\u8005\u672c\u5730\u9700\u8981\u6253\u5305\u4e00\u5806\u7684rpm\u5305 \u901a\u8fc7rpm\u65b9\u5f0f\u5b89\u88c5&#xff0c;\u4e0d\u5229\u4e8e\u5728\u4e0d\u540c\u73b0\u573a\u7684\u6613\u7528\u6027&#xff0c;\u4e8e\u662f\u4e4e\u60f3\u5230linux\u4e3b\u673a\u4e0a\u51e0\u4e4e\u90fd\u80fd\u4f7f\u7528\u7684shell\u811a\u672c\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u521a\u5f00\u59cb\u5e0c\u671b\u901a\u8fc7 ssh\u547d\u4ee4 \u5e76\u4e14\u643a\u5e26tcpdump\u6307\u4ee4\u548c\u53c2\u6570\u7684\u65b9\u5f0f&#xff0c;\u7136\u540e\u901a\u8fc7for\u5faa\u73af&#xff0c;\u904d\u5386\u8981\u6267\u884c\u547d\u4ee4\u7684\u4e3b\u673a\u5217\u8868&#xff0c;\u540e\u6765\u53d1\u73b0\u8fd9\u79cd\u65b9\u5f0f\u9700\u8981\u5148\u914d\u7f6e\u514d\u5bc6\u767b\u5f55&#xff0c;\u5bf9\u4e8e\u8d85\u591a\u7684\u8282\u70b9\u670d\u52a1\u5668\u6765\u8bf4\u4e5f\u4e0d\u662f\u5f88\u53cb\u597d&#xff0c;\u800c\u4e14\u5f88\u591a\u4e3b\u673a\u5e76\u4e0d\u662froot\u7528\u6237\u76f4\u63a5ssh\u540e\u53f0\u7684&#xff0c;\u8fd8\u9700\u8981\u5207\u6362\u7528\u6237\u53bb\u6267\u884c&#xff0c;&#xff0c;\u5e76\u4e14ssh\u547d\u4ee4 \u65e0\u6cd5\u8fd4\u56de\u6267\u884c\u7684\u7ed3\u679c&#xff0c;\u770b\u4e0d\u5230\u6267\u884c\u662f\u5426\u6210\u529f&#xff0c;\u672c\u5730\u4e5f\u65e0\u6cd5\u6709\u65e5\u5fd7\u8bb0\u5f55\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u4e8e\u662f\u4e4e&#xff0c;\u5728\u5ea6\u5a18\u7684\u641c\u7d22\u4e2d\u627e\u5230\u4e00\u4e2a\u6bd4\u8f83\u53e4\u8001\u7684\u65b9\u6848&#xff0c;\u901a\u8fc7\u5728\/bin\/bash\u811a\u672c\u4e2d\u63d2\u5165\/usr\/bin\/expect\u7684\u4ee3\u7801\u6bb5&#xff0c;\u4f7f\u7528spawn&#043;expect\u547d\u4ee4\u6765\u5b9e\u73b0\u811a\u672c\u4e2d\u4ea4\u4e92\u5f0f\u7684\u8f93\u5165 \u767b\u5f55\u76ee\u6807\u4e3b\u673assh&#xff0c;\u8f93\u5165\u9700\u8981\u7684\u6307\u4ee4&#xff0c;\u5e76\u5728\u672c\u5730\u5c55\u793a\u6267\u884c\u7ed3\u679c&#xff0c;\u5b9e\u73b0ssh\u5230\u76ee\u6807\u4e3b\u673a\u7684\u6279\u91cf\u6293\u5305\u548c\u65e5\u5fd7\u6536\u96c6<\/p>\n<p>\u4e14expect\u7684\u5b89\u88c5\u4f9d\u8d56\u5c11&#xff0c;\u5f88\u591a\u60c5\u51b5\u4e0b\u4e3b\u673a\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u643a\u5e26&#xff0c;\u4fbf\u4e8e\u4e0d\u540c\u73af\u5883\u95f4\u7684\u590d\u7528<\/p>\n<h2 style=\"margin-left:.0001pt;text-align:justify\">\u811a\u672c\u5185\u5bb9<\/h2>\n<h3>\u6838\u5fc3\u7247\u6bb5<\/h3>\n<p>#\u6784\u5efa\u4e00\u4e2assh\u51fd\u6570&#xff0c;\u652f\u6301\u811a\u672c\u4e2d\u5224\u65ad\u670d\u52a1\u7aef\u7684\u8fd4\u56de\u5b57\u6bb5 \u5e76\u53d1\u9001\u9884\u8bbe\u7684\u5b57\u7b26\u4e32\u5185\u5bb9\u7ed9\u670d\u52a1\u7aef<br \/>\nmy_ssh()<br \/>\n{<br \/>\n#\u63d2\u5165expect\u7684\u4ee3\u7801\u6bb5<br \/>\n    \/usr\/bin\/expect&lt;&lt;-EOF<br \/>\n#spawn\u7684\u65b9\u5f0f\u767b\u5f55\u76ee\u6807\u4e3b\u673a<br \/>\n    spawn ssh $ssh_username&#064;$ssh_host -p $ssh_port<br \/>\nset timeout 2.5 #\u7b49\u5f85\u76ee\u6807\u4e3b\u673a\u8fd4\u56de\u65f6\u957f<br \/>\n#\u4ee5\u4e0b\u662f\u671f\u5f85\u8fd4\u56de\u7684\u5185\u5bb9&#xff0c;\u4e0d\u540c\u7684\u8fd4\u56de\u5185\u5bb9\u4f1asend \u4e0d\u540c\u7684\u8f93\u5165&#xff0c;\u8fd9\u91cc\u5c31\u5217\u4e3e\u4e86\u4e00\u4e9b\u5e38\u89c1\u7684ssh\u52a8\u4f5c\u540e\u7684\u8fd4\u56de<br \/>\n    expect {<br \/>\n &#034;*yes\/no*&#034; { send &#034;yes\\\\r&#034;;exp_continue;}<br \/>\n &#034;*password:&#034; { send &#034;$ssh_passwd\\\\r&#034;;exp_continue;}<br \/>\n &#034;*\u5bc6\u7801&#xff1a;&#034;    { send &#034;$ssh_passwd\\\\r&#034; }<br \/>\n}<br \/>\n#su\u5230root\u7528\u6237 \u5e76\u6839\u636e\u63d0\u793a\u8f93\u5165\u5bc6\u7801 \u89e3\u51b3ssh\u65f6\u5019\u4e3a\u975eroot\u7528\u6237<br \/>\n    expect &#034;#&#034;<br \/>\nsend &#034;su &#8211; root\\\\r&#034;<br \/>\nexpect {<br \/>\n &#034;*Password:&#034; { send &#034;$root_passwd\\\\r&#034;;exp_continue;}<br \/>\n                 &#034;*\u5bc6\u7801&#xff1a;&#034;    { send &#034;$ssh_passwd\\\\r&#034;; exp_continue;}<br \/>\n &#034;#&#034; { send &#034;mkdir -p $cap_data_dir&amp;&amp;chmod 777 $cap_data_dir\\\\r&#034; }<br \/>\n}<br \/>\n    #\u53d1\u9001\u9700\u8981\u7684\u547d\u4ee4<br \/>\nexpect {<br \/>\n &#034;#&#034; { send &#034;$cmd\\\\r&#034; }<br \/>\n}<br \/>\nexpect eof<br \/>\nEOF<br \/>\n} <\/p>\n<h3>\u811a\u672c\u76ee\u5f55\u7ed3\u6784<\/h3>\n<p>\u811a\u672c\u6709\u4e24\u90e8\u5206 \u4e00\u90e8\u5206start_auto_cap_4.1.sh\u63a7\u5236\u542f\u52a8 \u505c\u6b62\u548c\u7528\u6237\u4ea4\u4e92\u00a0&#xff0c;\u4e00\u90e8\u5206\u00a0auto_ssh_4.1.sh\u4e3a\u767b\u5f55\u76ee\u6807\u4e3b\u673a\u540e\u53f0\u6267\u884c\u547d\u4ee4<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u5b58\u5728config\u76ee\u5f55\u7684auto_cap.config\u6587\u4ef6\u4e2d<\/p>\n<p>Dependency_Packages\u4e0b\u5b58\u653e\u7740\u4e0d\u540c\u7684linux\u64cd\u4f5c\u7cfb\u7edf\u4f9d\u8d56\u7684expect\u7684rpm\u5305<\/p>\n<p>log\u76ee\u5f55\u4e3a\u811a\u672c\u8fd0\u884c\u65e5\u5fd7&#xff0c;\u53ef\u4ee5\u67e5\u770b\u5386\u53f2\u6267\u884c\u60c5\u51b5\u548c\u76ee\u6807\u4e3b\u673a\u7684\u8fd4\u56de\u7ed3\u679c<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"83\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150245-68026995ac8e8.png\" width=\"720\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"604\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150245-68026995c01d2.png\" width=\"573\" \/><\/p>\n<h3>\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9<\/h3>\n<p>#ssh\u7528\u6237\u540d<br \/>\nuser&#061;hadmin<br \/>\n#ssh\u767b\u5f55\u5bc6\u7801<br \/>\npasswd&#061;Gongan&#064;2023<br \/>\n#ssh\u767b\u5f55\u7aef\u53e3<br \/>\nport&#061;22<br \/>\n#\u76ee\u6807\u4e3b\u673aroot\u7528\u6237\u5bc6\u7801<br \/>\nroot_passwd&#061;Gongan&#064;2023<br \/>\n#\u76ee\u6807\u4e3b\u673a\u5730\u5740\u6bb5\u914d\u7f6e<br \/>\nhosts_list&#061;( 10.56.19.86 10.56.19.{111..113} 10.56.19.173 10.56.19.77 )<br \/>\n#\u8fdc\u7a0b\u4e3b\u673a\u6293\u5305\u5b58\u50a8\u76ee\u5f55<br \/>\ncap_data_dir&#061;&#034;\/cloud\/cap_data&#034;<br \/>\n#\u6293\u5305\u8fc7\u6ee4\u6761\u4ef6(tcpdump\u8fc7\u6ee4\u5668\u8bed\u6cd5\u4e00\u81f4)<br \/>\ncap_fliter&#061;&#034;&#034;<br \/>\n#\u6293\u5305\u8fc7\u6ee4\u7f51\u5361(\u9ed8\u8ba4any,\u53ef\u6839\u636e\u7f51\u5361\u540d\u79f0\u4fee\u6539)<br \/>\ncap_network_card&#061;&#034;any&#034;<br \/>\n#\u6293\u5305\u81ea\u5faa\u65f6\u95f4(\u79d2)<br \/>\ncycle_time&#061;1200<br \/>\n#\u6293\u5305\u5207\u7247\u5927\u5c0f(MB)<br \/>\ncut_size&#061;300<br \/>\n#\u811a\u672c\u65e5\u5fd7\u5b58\u50a8\u8def\u5f84(\u9ed8\u8ba4\u4e3a\u811a\u672c\u8def\u5f84\u4e0b\u7684log\u76ee\u5f55)<br \/>\nlog_dir&#061;&#034;.\/log&#034;<br \/>\nlog_file&#061;&#034;.\/log\/auto_cmd_$(date &#043;&#034;%F&#034;).log&#034;<\/p>\n<h3>\u811a\u672c\u5b8c\u6574\u5185\u5bb9<\/h3>\n<p>auto_ssh_4.1.sh<\/p>\n<p>#\/bin\/bash<br \/>\nCAP_SCRIPT_DIR&#061;&#034;$( cd &#034;$( dirname &#034;${BASH_SOURCE[0]}&#034; )&#034; &amp;&amp; pwd )&#034;<\/p>\n<p>if [ ! -e $CAP_SCRIPT_DIR\/config\/auto_cap.config ];then<br \/>\n   echo &#034;Config file not exit ,Please Check ! Script Exit ! &#034;<br \/>\n   exit 1<br \/>\nfi<br \/>\nsource $CAP_SCRIPT_DIR\/config\/auto_cap.config<\/p>\n<p>ssh_host&#061;$1<br \/>\nssh_port&#061;$port<br \/>\nssh_username&#061;$user<br \/>\nssh_passwd&#061;$passwd<br \/>\naction&#061;$2<br \/>\nif [ $# -eq 0 ];<br \/>\nthen<br \/>\n    echo &#034;Please check your args!&#034;;exit<br \/>\nelif [ $# -ne 2 ];<br \/>\nthen<br \/>\n    echo &#034;Too many args!&#034;<br \/>\nfi<\/p>\n<p>cmd_keyword&#061;&#034;tcpdump&#034;<br \/>\nlog_dir&#061;&#034;.\/log&#034;<br \/>\nlog_file&#061;&#034;$log_dir\/auto_cmd_$(date &#043;&#034;%F&#034;).log&#034;<br \/>\nif [ $# -eq 0 ];<br \/>\nthen<br \/>\necho &#034;Please check your args!&#034;;exit<br \/>\nfi<\/p>\n<p>if [ $action -eq 1 ];<br \/>\nthen<br \/>\ncmd&#061;&#034;nohup tcpdump -i  $cap_network_card -w $cap_data_dir\/$ssh_host.pcap -s 0 -v -G $cycle_time -C $cut_size &gt;\/dev\/null 2&gt;&amp;1 &amp; \\\\r&#034;<br \/>\ncmd_keyword&#061;&#034;tcpdump&#034;<br \/>\nelif [ $action -eq 0 ];<br \/>\nthen<br \/>\ncmd&#061;&#034;pidof tcpdump | xargs  kill -9 \\\\r&#034;<br \/>\ncmd_keyword&#061;&#034;tcpdump&#034;<br \/>\nelif [ $action -eq 2 ];<br \/>\nthen<br \/>\ncmd&#061;&#034;find $cap_data_dir -name $ssh_host.pcap* -delete&#034;<br \/>\ncmd_keyword&#061;&#034;delete&#034;<br \/>\nelse<br \/>\necho &#034;illegal action!&#034;;exit<br \/>\nfi<br \/>\nfunction log_info()<br \/>\n{<br \/>\n        echo &#034;$(date &#043;&#034;%F %T&#034;) [INFO] $*&#034; &gt;&gt; $log_file<br \/>\n}<br \/>\nmy_ssh()<br \/>\n{<br \/>\n\/usr\/bin\/expect&lt;&lt;-EOF<br \/>\nspawn ssh $ssh_username&#064;$ssh_host -p $ssh_port<br \/>\nset timeout 2.5<br \/>\nexpect {<br \/>\n &#034;*yes\/no*&#034; { send &#034;yes\\\\r&#034;;exp_continue;}<br \/>\n &#034;*password:&#034; { send &#034;$ssh_passwd\\\\r&#034;;exp_continue;}<br \/>\n &#034;*\u5bc6\u7801&#xff1a;&#034;    { send &#034;$ssh_passwd\\\\r&#034; }<br \/>\n}<br \/>\nexpect &#034;#&#034;<br \/>\nsend &#034;su &#8211; root\\\\r&#034;<br \/>\nexpect {<br \/>\n &#034;*Password:&#034; { send &#034;$root_passwd\\\\r&#034;;exp_continue;}<br \/>\n                 &#034;*\u5bc6\u7801&#xff1a;&#034;    { send &#034;$ssh_passwd\\\\r&#034;; exp_continue;}<br \/>\n &#034;#&#034; { send &#034;mkdir -p $cap_data_dir&amp;&amp;chmod 777 $cap_data_dir\\\\r&#034; }<br \/>\n}<br \/>\nexpect {<br \/>\n &#034;#&#034; { send &#034;$cmd\\\\r&#034; }<br \/>\n}<br \/>\nexpect eof<br \/>\nEOF<br \/>\n}<\/p>\n<p>if [ ! -d $log_dir ];then<br \/>\nmkdir $log_dir<br \/>\nfi<br \/>\nstime&#061;&#096;date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;&#096;<br \/>\necho &#034;[$stime] \u6b63\u5728ssh\u767b\u5f55$ssh_host:$ssh_port \u6267\u884c\u6307\u4ee4&#034;<br \/>\nlog_info &#034;\u767b\u5f55$ssh_host:$ssh_port \u6267\u884c\u547d\u4ee4\u5185\u5bb9$cmd&#034;<br \/>\nssh_result&#061;$(my_ssh)<br \/>\nexitflag&#061;&#096;echo $ssh_result | grep -c $cmd_keyword&#096;<br \/>\netime&#061;&#096;date &#043;&#034;%Y-%m-%d %H:%M:%S&#034;&#096;<br \/>\nif [ $exitflag &#061;&#061; 1 ];then<br \/>\n   echo -e &#034;[$etime]$ssh_host \\\\033[32m\u6307\u4ee4\u53d1\u9001\u5b8c\u6bd5\\\\033[0m!&#034;<br \/>\n   log_info &#034;\u767b\u5f55$ssh_host:$ssh_port \u6267\u884c\u547d\u4ee4\u5185\u5bb9$cmd \u6210\u529f!&#034;<br \/>\n   log_info &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-$ssh_host \u6267\u884c\u6210\u529f\u5feb\u7167 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#034;<br \/>\n   log_info  &#034;$ssh_result&#034;<br \/>\n   log_info &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- $ssh_host \u5feb\u7167\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#034;<br \/>\nelse<br \/>\n   echo -e &#034;[$etime]$ssh_host \\\\033[31m\u6307\u4ee4\u53d1\u9001\u5931\u8d25\\\\033[0m!&#034;<br \/>\n   log_info &#034;\u767b\u5f55$ssh_host:$ssh_port \u6267\u884c\u547d\u4ee4\u5185\u5bb9$cmd \u5931\u8d25!&#034;<br \/>\n   log_info &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-$ssh_host \u6267\u884c\u5931\u8d25\u5feb\u7167&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<br \/>\n   log_info &#034; $ssh_result&#034;<br \/>\n   log_info &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-$ssh_host \u5feb\u7167\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<br \/>\n   exit 1<br \/>\nfi<\/p>\n<p>start_auto_cap_4.1.sh<\/p>\n<p>#\/bin\/bash\/<\/p>\n<p>CAP_SCRIPT_DIR&#061;&#034;$( cd &#034;$( dirname &#034;${BASH_SOURCE[0]}&#034; )&#034; &amp;&amp; pwd )&#034;<\/p>\n<p>if [ ! -e $CAP_SCRIPT_DIR\/config\/auto_cap.config ];then<br \/>\n   echo &#034;Config file not exit ,Please Check ! Script Exit ! &#034;<br \/>\n   exit 1<br \/>\nfi<br \/>\nsource $CAP_SCRIPT_DIR\/config\/auto_cap.config<\/p>\n<p>function log_info()<br \/>\n{<br \/>\n        echo &#034;$(date &#043;&#034;%F %T&#034;) [INFO] $*&#034; &gt;&gt; $log_file<br \/>\n}<\/p>\n<p>ipaddrs&#061;&#096;echo ${hosts_list[*]}&#096;<br \/>\nstart_cap()<br \/>\n{<br \/>\nfor ip in $ipaddrs;<br \/>\ndo<br \/>\n{ .\/auto_ssh_4.1.sh $ip  1<br \/>\nif [ $? -eq 0 ];then<br \/>\nip_send_sucess[${#ip_send_sucess[&#064;]}]&#061;$ip<br \/>\necho -e &#034;\\\\033[32m $ip is in Tcpdump&#8230; \\\\033[0m&#034;<br \/>\nelse<br \/>\nip_send_failed[${#ip_send_failed[&#064;]}]&#061;$ip<br \/>\necho -e &#034;\\\\033[31m $ip Tcpdump is not start,Please Check Config!\\\\033[0m&#034;<br \/>\nfi<br \/>\necho -e &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\\\n&#034;<br \/>\n}<br \/>\ndone<br \/>\n}<\/p>\n<p>stop_cap()<br \/>\n{<br \/>\nfor ip in $ipaddrs;<br \/>\ndo<br \/>\n{        .\/auto_ssh_4.1.sh $ip  0<br \/>\nif [ $? -eq 0 ];then<\/p>\n<p> ip_stop_sucess[${#ip_stop_sucess[&#064;]}]&#061;$ip<br \/>\n echo -e &#034;\\\\033[31m $ip Tcpdump is stoped&#8230; \\\\033[0m&#034;<br \/>\nelse<br \/>\n ip_stop_failed[${#ip_stop_failed[&#064;]}]&#061;$ip<br \/>\necho -e &#034;\\\\033[31m $ip Tcpdump is not stoped,Please Check\\\\033[0m&#034;<br \/>\nfi<\/p>\n<p>echo  -e &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\\\n&#034;<br \/>\n}<br \/>\ndone<br \/>\n}<br \/>\nclear_cap()<br \/>\n{<br \/>\nfor ip in $ipaddrs;<br \/>\ndo<br \/>\n{        .\/auto_ssh_4.1.sh $ip  2<br \/>\nif [ $? -eq 0 ];then<br \/>\nip_clear_sucess[${#ip_clear_sucess[&#064;]}]&#061;$ip<br \/>\n echo -e &#034;\\\\033[31m $ip cap_files are Deleted&#8230; \\\\033[0m&#034;<br \/>\nelse<br \/>\nip_clear_failed[${#ip_clear_failed[&#064;]}]&#061;$ip<br \/>\necho -e &#034;\\\\033[31m $ip Cap_files are not Deleted,Please Check\\\\033[0m&#034;<br \/>\nfi<\/p>\n<p>echo -e &#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;\\\\n&#034;<br \/>\n}<br \/>\ndone<\/p>\n<p>}<br \/>\nif [ ! -d $log_dir ];then<br \/>\nmkdir $log_dir<br \/>\nfi<br \/>\nlog_info &#034;\u5f00\u59cb\u8fdc\u7a0b\u767b\u5f55\u6267\u884c\u547d\u4ee4&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&#034;<br \/>\nif  [ &#034;$1&#034;  &#061; &#034;clear&#034; ];then<br \/>\nclear_cap<br \/>\necho -e &#034;\\\\033[31m \u6e05\u7406\u5931\u8d25\u7684\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_clear_failed[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[31m \u6e05\u7406\u5931\u8d25\u7684\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_clear_failed[&#064;]} \\\\n&#034;<br \/>\necho -e &#034;\\\\033[32m \u5b8c\u6210\u6e05\u7406\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_clear_sucess[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[32m \u5b8c\u6210\u6e05\u7406\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_clear_sucess[&#064;]}\\\\n&#034;<br \/>\necho -e &#034;\\\\033[36m \u6293\u5305\u6587\u4ef6\u6e05\u7406\u5b8c\u6bd5!\\\\033[0m&#034;<\/p>\n<p>elif [  $# -eq 0  ];then<br \/>\nstart_cap<br \/>\necho -e &#034;\\\\033[31m \u6293\u5305\u542f\u52a8\u5931\u8d25\u7684\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_send_failed[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[31m \u6293\u5305\u542f\u52a8\u5931\u8d25\u7684\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_send_failed[&#064;]} \\\\n&#034;<br \/>\necho -e &#034;\\\\033[32m \u6b63\u5728\u6293\u5305\u4e2d\u7684\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_send_sucess[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[32m \u6b63\u5728\u6293\u5305\u4e2d\u7684\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_send_sucess[&#064;]} \\\\n&#034;<br \/>\necho -e &#034;\\\\033[36m Please Press any key  to Stop the Capture: \\\\033[0m&#034;<br \/>\nread -p  &#034;        Waiting For Press to stop<br \/>\n&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&#034; Arg<\/p>\n<p>stop_cap<br \/>\necho -e &#034;\\\\033[31m \u6293\u5305\u5173\u95ed\u5931\u8d25\u7684\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_stop_failed[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[31m \u6293\u5305\u5173\u95ed\u5931\u8d25\u7684\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_stop_failed[&#064;]} \\\\n&#034;<br \/>\necho -e &#034;\\\\033[32m \u6293\u5305\u5173\u95ed\u6210\u529f\u7684\u4e3b\u673a\u6570\u91cf&#xff1a;\\\\033[0m${#ip_stop_sucess[&#064;]}&#034;<br \/>\necho -e &#034;\\\\033[32m \u6293\u5305\u5173\u95ed\u6210\u529f\u7684\u4e3b\u673a\u5730\u5740&#xff1a;\\\\033[0m${ip_stop_sucess[&#064;]} \\\\n&#034;<br \/>\nelse<br \/>\necho -e &#034; \\\\&#034;$&#064;\\\\&#034; \\\\033[31m are illegal &#xff0c;Please Check your args!\\\\033[0m&#034;<br \/>\nfi<br \/>\nlog_info &#034;\u8fdc\u7a0b\u767b\u5f55\u6267\u884c\u7ed3\u675f&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&#034;<br \/>\necho -e &#034;\\\\033[36m Auto Tcpdump Completed \\\\033[0m&#034;<\/p>\n<h2>\u811a\u672c\u7684\u4f7f\u7528<\/h2>\n<p>1.\u73af\u5883\u51c6\u5907<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9488\u5bf9\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf \u5728v4.1 \u538b\u7f29\u5305\u5185\u6709Dependency_Packages\u76ee\u5f55&#xff0c;\u53ef\u4ee5\u6839\u636e\u670d\u52a1\u5668\u67b6\u6784\u548c\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578brpm \u2013ivh \u5bf9\u5e94rpm\u5305\u540d \u65b9\u5f0f\u5b89\u88c5&#xff0c;\u5148\u5b89\u88c5tcl\u00a0\u518d\u5b89\u88c5expect&#xff0c;\u6b64\u5904\u4ee5Centos7\u4e3a\u4f8b<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"220\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150245-68026995df21c.png\" width=\"554\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<li>\u4e0a\u4f20\u811a\u672c\u5230\u5bf9\u5e94\u7684\u670d\u52a1\u5668\u540e\u53f0\u4efb\u610f\u76ee\u5f55<\/li>\n<p>unzip\u00a0\u00a0auto_ssh_cap_v4.1.tar <\/p>\n<p>\u00a0 \u00a0 2.\u89e3\u538b\u540e\u83b7\u5f97\u5982\u4e0b\u811a\u672c\u548c\u76ee\u5f55&#xff0c;\u914d\u7f6e\u6587\u4ef6\u5728config\/auto_cap.config\u4e2d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"57\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-6802699602c30.png\" width=\"554\" \/><\/p>\n<li>\u4fee\u6539\u914d\u7f6e\u53c2\u6570&#xff1a;<\/li>\n<p>vim config\/auto_cap.config<br \/>\n\u914d\u7f6e\u8bf4\u660e<\/p>\n<p>#ssh\u7528\u6237\u540d<br \/>\nuser&#061;hadmin<br \/>\n#ssh\u767b\u5f55\u5bc6\u7801<br \/>\npasswd&#061;Gongan&#064;2023<br \/>\n#ssh\u767b\u5f55\u7aef\u53e3<br \/>\nport&#061;22<br \/>\n#\u76ee\u6807\u4e3b\u673aroot\u7528\u6237\u5bc6\u7801<br \/>\n(\u5982\u679cssh\u7528\u6237\u4f7f\u7528\u7684root \u8fd9\u91cc\u586b\u5199\u4e0essh\u7528\u6237\u5bc6\u7801\u4e00\u81f4)<br \/>\nroot_passwd&#061;Gongan&#064;2023<br \/>\n#\u76ee\u6807\u4e3b\u673a\u5730\u5740\u6bb5\u914d\u7f6e<br \/>\nhosts_list&#061;(172.168.19.{8..9} 192.168.19.{10..11})<br \/>\n\u9700\u8981\u767b\u5f55\u5230\u540e\u53f0\u6293\u5305\u7684\u670d\u52a1\u5668\u5730\u5740\u6bb5\u4fe1\u606f&#xff0c;\u793a\u4f8b\u4e3a172.168.19.8-172.168.19.9, 192.168.19.10-192.168.19.11\u53ef\u6839\u636e\u73b0\u573a\u5b9e\u9645\u7f51\u6bb5\u4fee\u6539&#xff0c;\u5982\u679c\u6d89\u53ca\u8de8\u7f51\u6bb5,\u5728\u62ec\u53f7\u5185\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u7f51\u6bb5\u5b57\u7b26 \u7528\u7a7a\u683c\u9694\u5f00<\/p>\n<p>#\u8fdc\u7a0b\u4e3b\u673a\u6293\u5305\u5b58\u50a8\u76ee\u5f55<br \/>\ncap_data_dir&#061;&#034;\/cloud\/cap_data&#034;<br \/>\n\u9ed8\u8ba4\u4e3a\u8be5\u76ee\u5f55\u53ef\u6309\u9700\u4fee\u6539<br \/>\n#\u6293\u5305\u8fc7\u6ee4\u6761\u4ef6(tcpdump\u8fc7\u6ee4\u5668\u8bed\u6cd5\u4e00\u81f4)<br \/>\ncap_fliter&#061;&#034;&#034;<br \/>\n\u9ed8\u8ba4\u4e3a\u65e0\u8fc7\u6ee4\u6761\u4ef6&#xff0c;\u6293\u5305\u4f1a\u6bd4\u8f83\u5927 \u5efa\u8bae\u6dfb\u52a0\u8fc7\u6ee4\u89c4\u5219\u5982&#xff1a;<br \/>\n\u4e00\u4e9b\u793a\u4f8b&#xff1a;<br \/>\ncap_fliter&#061;&#034; src host 192.168.1.1 or udp &#034;<br \/>\ncap_fliter&#061;&#034; portrange 11000-13000 &#034;<br \/>\ncap_fliter&#061;&#034; dst host 192.168.1.1 &#034;<br \/>\ncap_fliter&#061;&#034; src net 192.168.1 &#034;<\/p>\n<p>#\u6293\u5305\u8fc7\u6ee4\u7f51\u5361(\u9ed8\u8ba4any,\u53ef\u6839\u636e\u7f51\u5361\u540d\u79f0\u4fee\u6539) \u9700\u8981<br \/>\ncap_network_card&#061;&#034;any&#034;<br \/>\n\u9ed8\u8ba4\u7f51\u5361\u4e3aany &#xff0c;\u53ef\u6839\u636e\u9700\u8981\u6307\u5b9a\u7f51\u5361\u540d\u79f0<br \/>\n#\u6293\u5305\u81ea\u5faa\u65f6\u95f4(\u79d2)<br \/>\ncycle_time&#061;1200<br \/>\n\u9ed8\u8ba4\u4ee51200s\u4e3a\u5468\u671f\u5faa\u73af&#xff0c;\u8986\u76d6\u6293\u5305\u6587\u4ef6<br \/>\n#\u6293\u5305\u5207\u7247\u5927\u5c0f(MB)<br \/>\ncut_size&#061;300<br \/>\n\u9ed8\u8ba4\u4e3a300MB\u8fdb\u884c\u5207\u5272\u6293\u5305\u6587\u4ef6<br \/>\n#\u811a\u672c\u65e5\u5fd7\u5b58\u50a8\u8def\u5f84(\u9ed8\u8ba4\u4e3a\u811a\u672c\u8def\u5f84\u4e0b\u7684log\u76ee\u5f55)<br \/>\nlog_dir&#061;&#034;.\/log&#034;<br \/>\nlog_file&#061;&#034;.\/log\/auto_cmd_$(date &#043;&#034;%F&#034;).log&#034;<\/p>\n<li>\u5f00\u59cb\u6293\u5305<\/li>\n<h4 style=\"margin-left:.0001pt;text-align:justify\">(1)\u6b63\u5e38\u793a\u4f8b&#xff1a;<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\"># .\/start_auto_cap_4.1.sh<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdc\u7a0b\u5230\u670d\u52a1\u5668\u540e\u53f0\u540e\u6b64\u65f6\u6253\u5370\u7eff\u8272\u63d0\u793a\u7b26&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"56\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-68026996155e9.png\" width=\"659\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6240\u6709\u4e3b\u673a\u6267\u884c\u5b8c\u6210 \u8fdb\u5165\u7b49\u5f85\u754c\u9762&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"107\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-6802699627742.png\" width=\"660\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6b64\u65f6\u53ef\u4ee5\u590d\u73b0\u95ee\u9898\u6216\u8fdb\u884c\u76f8\u5173\u7684\u64cd\u4f5c\u83b7\u53d6\u62a5\u6587\u4fe1\u606f\u540e<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6309\u4efb\u610f\u952e\u540e\u56de\u8f66&#xff0c;\u4f1a\u9010\u4e2a\u4e3b\u673a\u505c\u6b62\u6293\u5305&#xff0c;<span style=\"background-color:#ffff00\"><span style=\"color:#ff0000\">\u8bf7\u52ff<\/span><\/span><span style=\"background-color:#ffff00\"><span style=\"color:#ff0000\">\u76f4\u63a5Ctrl&#043;C<\/span><\/span>\u00a0<span style=\"background-color:#ffff00\"><span style=\"color:#ff0000\">\u9000\u51fa\u811a\u672c<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#ff0000\">\u52a1\u5fc5\u6bcf\u6b21\u6267\u884c\u90fd<\/span><span style=\"color:#ff0000\">\u8fdb\u884c\u505c\u6b62\u6293\u5305\u64cd\u4f5c\u540e&#xff0c;\u9000\u51fa\u7a0b\u5e8f&#xff0c;\u5426\u5219\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6293\u5305\u672a\u505c\u6b62&#xff0c;\u5360\u7528\u8fdc\u7a0b\u4e3b\u673a\u7cfb\u7edf\u76ee\u5f55\u7a7a\u95f4)&#xff0c;\u5982\u610f\u5916\u672a\u6267\u884c\u505c\u6b62 \u53ef\u4ee5\u518d\u6b21\u8fd0\u884c<\/span><span style=\"color:#ff0000\">.<\/span><span style=\"color:#ff0000\">\/start_auto_cap_4.1.sh<\/span><span style=\"color:#ff0000\">&#xff0c;<\/span><span style=\"color:#ff0000\">\u4e5f\u53ef\u5173\u95ed\u8fdc\u7a0b\u4e3b\u673a\u6293\u5305<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"95\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-680269963b50e.png\" width=\"662\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6253\u5370Tcpdump\u00a0Completed\u540e\u8bf4\u660e\u6293\u5305\u6b63\u5e38\u505c\u6b62,\u5982\u6709\u5931\u8d25\u4e3b\u673a \u9700\u8981\u5173\u6ce8\u662f\u5426\u9700\u8981\u624b\u52a8\u53bb\u540e\u53f0\u505c\u6b62<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6293\u5305\u6587\u4ef6\u53ef\u5230\u5bf9\u5e94\u7684\u4e3b\u673a\u6587\u4ef6\u8def\u5f84\u4e2d\u83b7\u53d6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"290\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-680269964e22c.png\" width=\"554\" \/><\/p>\n<h4 style=\"margin-left:.0001pt;text-align:justify\">(2)\u6e05\u7406\u8fdc\u7a0b\u4e3b\u673a\u6293\u5305\u6587\u4ef6&#xff1a;<\/h4>\n<p>.\/start_auto_cap_4.1.sh  clear <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6293\u5305\u4efb\u52a1\u5b8c\u6210\u540e &#xff0c;\u518d\u6b21\u6267\u884c\u811a\u672c \u643a\u5e26clear\u53c2\u6570 \u00a0\u53ef\u4ee5\u89e6\u53d1\u9010\u4e2a\u4e3b\u673a\u5220\u9664cap_data\u76ee\u5f55\u4e0b\u7684pcap\u6587\u4ef6&#xff0c;\u5b8c\u6210\u540e\u663e\u793a\u6293\u5305\u6587\u4ef6\u6e05\u7406\u5b8c\u6bd5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"108\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-680269966932f.png\" width=\"661\" \/><\/p>\n<h4 style=\"margin-left:.0001pt;text-align:justify\">(3)\u5f02\u5e38\u793a\u4f8b<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u6709\u8fdc\u7a0b\u4e3b\u673a\u65e0\u6cd5\u8fde\u63a5&#xff0c;\u6216\u6267\u884c\u7684\u6293\u5305\u547d\u4ee4\u6709\u5f02\u5e38&#xff0c;\u9700\u68c0\u67e5\u914d\u7f6e\u4fe1\u606f&#xff0c;\u4f1a\u8fd4\u56de\u5982\u4e0b \u63d0\u793a&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"84\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-680269967c935.png\" width=\"554\" \/><\/p>\n<h4 style=\"margin-left:.0001pt;text-align:justify\">(4)\u65e5\u5fd7\u83b7\u53d6&#xff1a;<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6267\u884c\u540e\u4f1a\u6839\u636e\u6267\u884c\u65f6\u95f4\u751f\u6210\u5bf9\u5e94\u7684\u65e5\u5fd7&#xff0c;\u9ed8\u8ba4\u5728\u811a\u672c\u76ee\u5f55\u4e0b\u7684log\u4e2d&#xff0c;\u53ef\u4ee5\u67e5\u770b\u6293\u5305\u547d\u4ee4\u6267\u884c\u5f02\u5e38\u539f\u56e0<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"22\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-680269968f9d0.png\" width=\"554\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u65e5\u5fd7\u4e2d\u4f1a\u9644\u4e0a\u5bf9\u5e94\u7684\u4e3b\u673a\u6267\u884c\u7ed3\u679c&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"410\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150246-68026996a01c2.png\" width=\"706\" \/><\/p>\n<h2 style=\"margin-left:.0001pt;text-align:justify\">\u5c0f\u7ed3<\/h2>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u81f3\u6b64&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u54b1\u4eec\u9879\u76ee\u4e0a\u4e00\u4e9b\u8fdc\u7a0b\u4e3b\u673a\u81ea\u52a8\u6293\u5305\u7684\u9700\u6c42&#xff0c;\u540c\u65f6\u4ee3\u7801\u7684\u6838\u5fc3\u90e8\u5206\u53ef\u4ee5\u590d\u7528&#xff0c;\u5982\u9700\u8981\u8fdc\u7a0b\u6267\u884c\u5176\u4ed6\u547d\u4ee4&#xff0c;\u6216\u8005\u6279\u91cf\u8fdb\u884c\u4fee\u6539\u67d0\u4e2a\u7cfb\u7edf\u914d\u7f6e\u7684\u64cd\u4f5c<\/p>\n<p>\u00a0\u5f85\u4f18\u5316&#xff1a;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u7531\u4e8e\u6574\u4e2a\u811a\u672c\u4f7f\u7528\u4e32\u884c\u7684\u65b9\u5f0f\u5b8c\u6210&#xff0c;\u4e00\u53f0\u8fdc\u7a0b\u4e3b\u673a \u9700\u8981\u6d88\u80173s\u5de6\u53f3\u7684\u65f6\u95f4&#xff0c;\u5f53\u4e3b\u673a\u6570\u91cf\u6709\u51e0\u5341\u751a\u81f3\u4e0a\u767e\u53f0\u7684\u65f6\u5019 \u4f1a\u5bfc\u81f4\u811a\u672c\u6267\u884c\u6548\u7387\u4e0b\u964d&#xff0c;\u7b49\u5f85\u65f6\u95f4\u6bd4\u8f83\u957f&#xff0c;\u540e\u7eed\u8003\u8651\u5e76\u53d1\u65b9\u5f0f\u8fdb\u884c\u4f18\u5316<\/p>\n<h2>\u9644\u4ef6\u811a\u672c\u4e0b\u8f7d<\/h2>\n<p>\u94fe\u63a5: https:\/\/pan.baidu.com\/s\/1r7-CcTNaXo0hjCGRgDU_gA \u63d0\u53d6\u7801: p416\u00a0<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e16\u6b21\uff0c\u6536\u85cf25\u6b21\u3002ssh\u8fdc\u7a0b \u6279\u91cf\u6293\u5305 expect shell\u811a\u672c tcpdump\u6293\u5305 expect spawn_ssh\u6293\u5305\u547d\u4ee4<\/p>\n","protected":false},"author":2,"featured_media":16634,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[77,1173,43,44,1172],"topic":[],"class_list":["post-16646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ssh","tag-tcpdump","tag-43","tag-44","tag-1172"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/16646.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e16\u6b21\uff0c\u6536\u85cf25\u6b21\u3002ssh\u8fdc\u7a0b \u6279\u91cf\u6293\u5305 expect shell\u811a\u672c tcpdump\u6293\u5305 expect spawn_ssh\u6293\u5305\u547d\u4ee4\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/16646.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T15:02:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150245-68026995ac8e8.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16646.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/16646.html\",\"name\":\"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:02:47+00:00\",\"dateModified\":\"2025-04-18T15:02:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/16646.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/16646.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16646.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/16646.html","og_locale":"zh_CN","og_type":"article","og_title":"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\uff0c\u70b9\u8d5e16\u6b21\uff0c\u6536\u85cf25\u6b21\u3002ssh\u8fdc\u7a0b \u6279\u91cf\u6293\u5305 expect shell\u811a\u672c tcpdump\u6293\u5305 expect spawn_ssh\u6293\u5305\u547d\u4ee4","og_url":"https:\/\/www.wsisp.com\/helps\/16646.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:02:47+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418150245-68026995ac8e8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/16646.html","url":"https:\/\/www.wsisp.com\/helps\/16646.html","name":"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:02:47+00:00","dateModified":"2025-04-18T15:02:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/16646.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/16646.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/16646.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u901a\u8fc7shell\u811a\u672c\u5b9e\u73b0\u6279\u91cfssh\u767b\u5f55\u670d\u52a1\u5668\u540e\u53f0\u6293\u5305"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=16646"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16646\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/16634"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=16646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=16646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=16646"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=16646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}