锘??xml version="1.0" encoding="utf-8" standalone="yes"?>C++鍗氬-<table border="0" cellspacing="0" cellpadding="0" style="margin- left:0px;display:inline;height:30px;"><tr><td style="font-weight:bold; font-size:16px; line- height:30px;">涓骞?#37719;?#27996;屾湀&nbsp璋?#28051;?#37828;?#32457;?lt;/td><td style="font-size:14px; line-height:30px;"></td></tr></table>http://www.9087120.com/qinqing1984/涓撴敞锛?#27996;?#38001;旂綉鍚庡彴銆佺綉缁?#37510;佷俊鎭畨鍏?/description>zh-cnSun, 10 Mar 2019 18:18:25 GMTSun, 10 Mar 2019 18:18:25 GMT60鍏?#27996;巑ake渚濊禆鏂囦欢鐨勮嚜鍔敓鎴?/title><link>http://www.9087120.com/qinqing1984/archive/2018/11/16/216067.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Fri, 16 Nov 2018 04:08:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2018/11/16/216067.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/216067.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2018/11/16/216067.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/216067.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/216067.html</trackback:ping><description><![CDATA[<div>  鍦GNU make涓?#37826;?#37813;嬪唽杩?#37832;?#28052;?#28051;?#38171;?.14鑺傝鍒?#27996;?#28186;濊禆鏂囦欢鐨勮嚜鍔敓鎴?#38171;?#28641;?#28051;嬪浘<hr /><img src="http://www.9087120.com/images/cppblog_com/qinqing1984/gnu-make-314.png" width="1419" height="657" alt="" /><br /><br /><div>  鍥?#28051;?#37928;勮鍒欏C婧?#37826;囦欢?#25328;Makefile鍦?#37722;?#28051;鐩綍锛屾槸姝?#32429;?#37928;?#37510;備絾鏄?#28051;?#37734;?#37722;?#28051;鐩綍鐨勫張甯屾湜渚濊禆鏂囦欢鍦?#28725;?#25652;旂殑鐩綍涓?#38171;屾瘮濡src/log/log_file.c锛?#29999;屾湜渚濊禆鏂囦欢log_file.d?#25939;鎴?#37734;src/log/涓?#37510;?#37733;?#28051;篻cc锛坅ix骞冲彴xlc缂栬瘧鍣?#27996;?#28641;?#23005;?#38171;夌敓鎴?#37928;?#28186;濊禆鏂囦欢鍐呭涓?#37929;?#37837;?#37826;囦欢鍚?#23052;?#37832;?#29999;矾寰?#38171;?#28186;嬪涓?#37813;绀?/div><div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #800000;"><strong>log_file.o</strong></span>: src/log/log_file.c src/log/log_file.h src/log/log_type.h \<br /> src/log/../base/io_ext.h</div><div><br />  鎵浠sed灏?#37813;?#28051;?#37714;src/log/log_file.o鑰屾浛鎹?#27996;?#38171;屾敼姝?#37722;?#37928;勮鍒?#28641;?#28051;?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->%.d: %.c<br />    $(CC) $(CFLAGS) $(INCS) $< $(MFLAGS) $@.$$$$<span style="color: #008000; ">;</span><span style="color: #008000; ">\</span><span style="color: #008000; "><br /></span>    sed 's,<span style="color: #ff0000;">$(*F)</span>.o<span>[</span><span> :</span><span>]</span>*,<span style="color: #ff0000;">$*</span>.o $@: ,g' < $@.$$$$ > $@<span style="color: #008000; ">;</span><span style="color: #008000; ">\</span><span style="color: #008000; "><br /></span>    $(RM) $@.$$$$</div><div><br />  璇?#29785;?#37714;欏C婧?#37826;囦欢?#25328;Makefile鍦?#37722;?#28051;鐩綍涔熼?#37722;?#38171;岀敓鎴?#37722;?#37928;?#28186;濊禆鏂囦欢鍐呭濡?#28051;?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><strong style="color: #800000;">src/log/log_file.o src/log/log_file.d</strong>: src/log/log_file.c src/log/log_file.h src/log/log_type.h \<br /> src/log/../base/io_ext.h</div></div></div></div></div><img src ="http://www.9087120.com/qinqing1984/aggbug/216067.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2018-11-16 12:08 <a href="http://www.9087120.com/qinqing1984/archive/2018/11/16/216067.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鎬?#32513;撶綉缁滆矾鐢?#29863;?#37722;?#29831;?#37826;?#37826;规硶http://www.9087120.com/qinqing1984/archive/2017/12/29/215452.html鏄?#32457;?#37719;?#27996;屾湀鏄?#32457;?#37719;?#27996;屾湀Fri, 29 Dec 2017 09:24:00 GMThttp://www.9087120.com/qinqing1984/archive/2017/12/29/215452.htmlhttp://www.9087120.com/qinqing1984/comments/215452.htmlhttp://www.9087120.com/qinqing1984/archive/2017/12/29/215452.html#Feedback0http://www.9087120.com/qinqing1984/comments/commentRss/215452.htmlhttp://www.9087120.com/qinqing1984/services/trackbacks/215452.html鐢?#27996;traceroute鍙兘璇?#37826;UDP閫氫俊鐨勫寘?#30718;鐢?#38171;?#28051;嶈兘纭?#28729;歍CP閫氫俊鐨勫疄闄呰矾鐢?#38171;?#37721;兘鍙?#37817;?#38171;?#38171;?#37733;?#23005;?#32514;?#37712;?#27996;?#37832;?#37826;?#37510;?#28051;?#37826;?#28186;?#37819;?#26473;?#38171;?#28051;?#38344;?#37928;処P銆丮AC?#25328;绔?#37721;潎涓?#32448;?#28186;?#38171;屽疄闄?#29831;?#37826;?#28051;?#37721;?#37831;?#37817;?#28051;?#37711;?#28003;?#37928;勫?/div>

1. 濡備綍鍒?#37826;?#28729;?#37812;?#32468;?#37714;?#37832;?#37716;?#37731;?#37928;凾CP?#23512;锛屾槸鍚?#32513;?#26473;?#27996;嗙綉鍏?/strong>
     鍦?#28729;?#37812;?#32468;?#37813;?#29723;?tcpdump -i eno16777728 ether dst b0:b9:8a:69:65:3e and host 192.168.0.26 and tcp port 80  鎶?#37721;?#32513;?#26473;囩綉鍏?#28051;斿線杩?#37832;?#37716;?#37731;?#37928;凾CP绔?#37721;?#28051;?0鐨勫寘
     eno16777728 鎺?#37721;?#37722;嶇锛沞ther 浠?#28598;綉?#25724;?#30718;锛宒st 鐩?#37837;?#38171;坰rc琛?#32448;?#23143;?#38171;?#38171;沚0:b9:8a:69:65:3e ?#32137;鍏MAC鍦板潃锛?92.168.0.26 鏈?#37716;?#37731;IP鍦板潃锛?0 鐩?#37722;?#32468;?#37721;?/div>

     杈撳嚭缁撴灉鍒嗘瀽
       ● 鏈?#26440;撳嚭锛?#37714;?#29723;?#32448;?#32513;?#26473;?#27996;嗙綉鍏?/div>
       ● 鏈夐儴鍒?#26440;撳嚭鑰孴CP閫氫俊杩?#37734;?#26473;?#29723;?#38171;?#37714;?#29723;?#32448;?#37711;堝墠鐨勫寘缁?#26473;?#27996;嗙綉鍏?#38171;?#37722;庢潵?#30718;鐢?#29723;?#26916;?#32514;撳瓨琚?#38322;嶅?#27692;悜鏇?#37826;?#38171;屾病缁?#26473;囩綉鍏?#27996;?/div>
       ● 涓?#37826;?#26440;撳嚭锛?#37714;?#29723;?#32448;?#28051;鐩?#32513;?#26473;囩綉鍏?/div>

2. 濡備綍鍒?#37826;矾鐢?#29723;?#26916;?#32514;撳瓨琚?#38322;嶅?#27692;悜鏇?#37826;?/strong>
     鍦?#28729;?#37812;?#32468;?#37813;?#29723;?tcpdump -i eno16777728 src 192.168.1.1 and dst 192.168.1.45 and icmp  鎶?#37721;栨潵?#22172;?#32137;鍏冲拰鍒?#26440;?#28729;?#37812;?#32468;?#37928;?#37813;鏈塱cmp?#23512;
     192.168.1.1 ?#32137;鍏IP锛?92.168.1.45 瀹?#37812;?#32468;?#38171;堝嚭鍙?#38171;塈P

     杈撳嚭缁撴灉鍒嗘瀽
       ● 娌?#37832;?#26440;撳嚭锛?#37714;?#29723;?#32448;?#23052;?#37832;?#37824;?#37714;rerdirect?#23512;锛岃矾鐢?#29723;?#26916;?#32514;撳瓨涓嶅彉
       ● 鏈?#26440;撳?#34425;被浼?span style="color: #ff0000;">ICMP redirect 192.168.0.26 to host 192.168.0.26锛堝墠闈?#28051;涓狪P琛?#32448;?#37714;?#26440;?#37832;?#37716;?#37731;?#37928;?#37929;存帴?#30718;鐢IP锛?#37722;?#28051;涓?#29723;?#32448;?#37832;?#37716;?#37731;IP锛?/div>
       ● 鍒?#29723;?#32448;?#37824;?#37714;?#27996;ICMP閲嶅?#27692;悜?#23512;锛屽唴鏍?#28028;?#37831;?#37826;拌矾鐢?#29723;?#26916;瑰強缂撳瓨?#32137;鍏?#28051;?92.168.0.26锛?#28051;嬫閫氫俊鏃跺氨鐩存帴鍙?#23536;192.168.0.26浜?/div>

3. 濡備綍鎺?#37714;?#37818;?#37824;禝CMP閲嶅?#27692;悜
      ● echo 0 | tee /proc/sys/net/ipv4/conf/*/accept_redirects    绂?#23005;?#37813;鏈夌綉鍗?#37818;?#37824;?#38171;屽彲?#20265;鍏嶈矾鐢?#29723;?#26916;?#32514;撳瓨琚?#28103;敼
      ● echo 1 | tee /proc/sys/net/ipv4/conf/*/accept_redirects    鍚?#37922;?#37813;鏈夌綉鍗?#37818;?#37824;禝CMP閲嶅?#27692;悜?#31223;鎭?/div>

4. 鏌湅銆?#37714;?#37826;拌矾鐢?#29723;?#26916;?#32514;撳瓨
      ● ip route get 192.168.0.26    鍙?#28000;?#28000;?#26440;撳嚭涓?#37930;嬪埌閫氫綇鐩?#37837;IP鐨勫疄闄呰矾鐢?/div>
      ● ip route flush cache             娓呯?#40511;矾鐢?#29723;?#26916;?#32514;撳瓨锛?#28051;嬫閫氫俊鏃跺唴鏍?#28028;?#37836;main琛?#38171;?#37719;冲懡浠route杈撳嚭鐨勮锛?#28000;?#32429;?#28729;氳矾鐢?/div>

]]>娣?#37711;?#37918;嗚SSL/TLS鎶鏈?#37712;?#39582;?/title><link>http://www.9087120.com/qinqing1984/archive/2016/12/15/214491.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Thu, 15 Dec 2016 09:16:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2016/12/15/214491.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/214491.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2016/12/15/214491.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/214491.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/214491.html</trackback:ping><description><![CDATA[<strong style="font-size: 12pt">?#22688;a</strong><br />    杩?#37832;?#37832;?#37832;?#28028;?#38171;屾鍏?#27996;哠SL/TLS鍗忚鍘?#37918;?#28051;?#32513;?#38010;?#38171;?#39582;?#37714;嗘瀽浜?#37929;?#37711;冲?#21977;爜瀛?#37712;呭锛屽寰?#26864;囧锛屽巻缁?#37719;婃湀锛?#32513;?#27996;庡啓鎴?#27996;?#26473;?#28000;?#37826;囨銆?br />    鏈?#27996;烘骞冲鏈?#38340;?#38171;?#38335;?#29831;?#38341;?#37711;?#38171;屾杩庢寚姝?#38171;?#28051;?#38003;?#37808;熸縺銆?br /> <br /> <strong style="font-size: 12pt">鐩綍</strong><br />          <img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/deep-ssl-tls-catalogue.png" /><strong><br /> <br /> </strong><strong style="font-size: 12pt">?#20788;鍒?#32468;?#38010;?#26864;勮</strong><br /> <strong>   绗?绔?/strong><br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/ssl-tls-protocol-stack.png" /></div> <br /> <br />    <strong>绗?绔?#32471;?鑺?/strong><br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/ssl-tls-block-cipher.png" /></div> <br /> <br />    <strong>绗?1绔?#32471;?鑺?br /> </strong> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/ssl-tls-freak-attack.png" /></div> <br /> <strong style="font-size: 12pt">鍏?#37826;?/strong><br />    涓嬭浇鍦板潃锛?a href="/Files/qinqing1984/娣?#37711;?#37918;嗚SSL-TLS鎶鏈?#37712;?#39582;?zip">娣?#37711;?#37918;嗚SSL/TLS鎶鏈?#37712;?#39582;?/a> <img src ="http://www.9087120.com/qinqing1984/aggbug/214491.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2016-12-15 17:16 <a href="http://www.9087120.com/qinqing1984/archive/2016/12/15/214491.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>DSA鏁板瓧绛?#37722;?#37928;?#37818;?#28725;?/title><link>http://www.9087120.com/qinqing1984/archive/2016/11/24/214439.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Thu, 24 Nov 2016 11:39:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2016/11/24/214439.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/214439.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2016/11/24/214439.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/214439.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/214439.html</trackback:ping><description><![CDATA[<strong style="font-size: 12pt;">绠楁硶鎻?#26473;?/strong><br /> 銆?#37711;?#23534;瀵嗛挜銆?   <br />    p鏄?12鍒?024浣?#37928;?#32497;犳暟<br />    q鏄?60浣嶉暱锛?#39582;?#28051;巔-1浜?#32497;?#37928;?#37733;?#28699;?br />    g = h^((p-1)/q) mod p锛?#37711;?#28051;環<p-1涓攇>1 <p-1涓攇><br />    y = g^x mod p<br /> 銆愮鏈?#28725;嗛挜銆?br />    x<q锛岄暱160浣?br /> < q锛岄暱160浣?br /> 銆愮鍚?#37510;?br />    k涓?#28751;?#27996;巕鐨?#38341;?#37832;烘暟锛宬^-1涓簁妯q鐨?#38315;?#37711;?#38171;宮涓烘秷鎭?#38171;H涓?#37719;?#37722;戞暎鍒?#37713;芥暟<br />    r = (g^k mod p) mod q<br />    s = (k^-1(H(m)+xr)) mod q<br /> 銆愰獙璇?#37510;?br />    w = s^-1 mod q<br />    u1 = (H(m)w) mod q<br />    u2 = (rw) mod q<br />    v = ((g^u1 * y^u2) mod p) mod q<br />    鑻v = r锛?#37714;?#32475;?#37722;?#29722;獙璇?br /> <br /> <strong style="font-size: 12pt">楠岀鎺?#28725;?/strong><br />    <strong>1</strong>. 鍏?#29831;?#37828;?#28051;?#28051;?#28051;?#38338;?#32513;?#29825;?br />       鍥?h,p)=1锛坧涓虹?#29363;暟涓h<p锛?a1,a1)鏄?#37825;拌涓?#37928;?#32471;?#37721;?#38171;?#29825;?#28051;a1涓巃2鐨?#37832;澶?#37711;害鏁?#38171;?#38171;屾渚?p锛屾牴鎹?#22994;傚鏄?#37906;跺緱鐭p?#25328;h闄?#27996;?澶?#38171;屾病鏈?#37711;跺畠鍏害鏁?#38171;?br />璐归灏?#28729;?#37918;?#37832;h^(p-1)=1 mod p锛?#37714;欏浠?#37808;?#37825;存暟n锛屾湁<br />       g^(nq) mod p = (h^((p-1)/q))^(nq) mod p <br />                           = h^(n(p-1)) mod p <br />                           = (h^(p-1) mod p)^n  mod p <br />                           = (1^n) mod p = 1     <span style="color: red">(1)</span><br />       瀵?#28000;?#37808;?#37825;存暟t銆乶锛屽彲琛?#32448;?#28051;簍=nq+z锛?#37711;?#28051;瓃>0锛?#37714;?#37832;?br /> <z<q锛屾湁<br />       g^t mod p = g^(nq+z) mod p <br />                      = (g^(nq) mod p * (g^z mod p)) mod p <br />                      = g^z mod p<br />                      = g^(t mod q) mod p    <span style="color: red">(2)</span><br /> <br />   <strong>2</strong>. 鍐嶅亣璁?#32475;?#37722;峽r,s}鍜屾秷鎭痬鍧囨病琚?#28103;敼锛?#28000;H(m)=h锛屽紑濮嬫帹瀵紇<br />       v = ((g^u1 * y^u2) mod p) mod q<br />          = (g^(hw mod q) * ((g^x mod p)^(rw mod q) mod p)) mod q<br />          = ((g^(hw mod q) mod p * ((g^x mod p)^(rw mod q) mod p)) mod p) mod q<br />          = ((g^(hw mod q) mod p * (g^(x * (rw mod q)) mod p)) mod p) mod q<br />          = ((g^(hw) mod p * ((g^(rw mod q) mod p)^x mod p)) mod p) mod q<br />          = ((g^(hw) mod p * ((g^(rw) mod p)^x mod p)) mod p) mod q<br />          = ((g^(hw) mod p * (g^(rwx) mod p)) mod p) mod q<br />          = (g^(hw+rwx) mod p) mod q<br />          = (g^((h+rx)w) mod p) mod q    <span style="color: red">(3)</span> <br /> <br />       ?#24373;鍥w = s^-1 mod q<br />          鏁?sw) mod q = 1<br />            =>(((k^-1(h+xr)) mod q)w) mod q = 1<br />            =>((k^-1(h+xr))w) mod q = 1<br />            =>(h+xr)w = k mod q    <span style="color: red">(4)</span><br /> <br />       灏?4)寮?#28000;?#37711;?3)寮?#28051;?#23536;?br />       v = (g^(k mod q) mod p) mod q<br />          = (g^k mod p) mod q<br />          = r<br /> <br /> <strong>  3</strong>. 鏈鍚?#37922;?4)寮?#37933;?#38171;?#38011;h銆乺?#25328;s浠?#28051;涓?#37832;?#37721;?#37718;?#38171;坰鍙?#37718;栧?#33392;嚧w鍙?#37718;?#38171;?#38171;?#37714;檝 ≠ r </z<q锛屾湁<br /> </p锛屾牴鎹?#22994;傚鏄?#37906;跺緱鐭p?#25328;h闄?#27996;?澶?#38171;屾病鏈?#37711;跺畠鍏害鏁?#38171;?br /> </q锛岄暱160浣?br /> </p-1涓攇><img src ="http://www.9087120.com/qinqing1984/aggbug/214439.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2016-11-24 19:39 <a href="http://www.9087120.com/qinqing1984/archive/2016/11/24/214439.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>RSA鍔犺瀵?#37928;勮瘉鏄?/title><link>http://www.9087120.com/qinqing1984/archive/2016/11/18/214419.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Fri, 18 Nov 2016 09:05:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2016/11/18/214419.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/214419.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2016/11/18/214419.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/214419.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/214419.html</trackback:ping><description><![CDATA[<strong style="font-size: 12pt;">绠楁硶鎻?#26473;?/strong>    <br />   闅?#37832;?#38315;夋嫨涓?#28051;?#28598;?#37928;?#32497;犳暟 p銆乹 锛?#28051;p ≠ q锛?#29825;?#32480;梟 = pq銆乺 = (p-1)(q-1)锛?#28186;?#23046;媺瀹?#37918;?#38171;宺鍗?#28051;?#28051;巒浜?#29840;?#37928;?#32497;犳暟涓?#37825;?#38171;?#38315;夋嫨涓涓?#28751;?#27996;巖鐨勬?#23384;暟e锛?#37719;?#37716;?#28725;嗘?#22248;暟锛?#38171;屾?#20634;緱e鍏?#27996;庢r鐨?#38315;?#37711;d锛?#37719;?#29785;?#28725;嗘?#22248;暟锛?#38171;?#37714;檣n锛宔}涓?#37711;挜銆亄n锛宒}涓虹?#20352;挜锛?#37837;?#37817;?#22959;?#37928;?#38315;?#37711;?#37804;?#29840;?#37832;塭d ≡ 1 (mod r)锛涜m涓?#37828;?#37826;?#38171;?#37714;?#37716;?#28725;?#26473;愮畻涓簃^e ≡ c (mod n)锛?c鍗?#28051;哄瘑鏂?#38171;?#37714;欒瀵?#26473;囩 c^d ≡ m (mod n)銆?br />   璇?#37828;?#28028;?#37922;?#37714;拌?#24402;灏?#28729;?#37918;?#38171;?#37719;?<span style="color: red">鑻y涓虹?#29363;暟涓x涓?#28051;y鐨勫嶆暟锛?鍒?x^(y-1) ≡ 1 (mod y)</span>锛堣?#24402;灏?#28729;?#37918;?#37928;勮瘉鏄庨渶鍏?#29831;?#37828;庢?#23226;瀹?#37918;?#38171;屾澶勭锛?#37510;?#32471;?#37721;?#8801;琛?#32448;?#37722;屼綑锛宆琛?#32448;?font color="&33333" face="Arial">骞?/font>锛寍琛?#32448;烘暣闄?#38171;?琛?#32448;?#37929;?#28052;?#37510;?br /><br /><strong style="font-size: 12pt">绠楁硶璇?#37828;?/strong> <br /><strong> 绗?#28051;绉?#29831;?#37828;?#38315;斿緞</strong>   <br />   鍥?ed ≡ 1 (mod (p-1)(q-1))锛?#28000;?ed = k(p-1)(q-1) + 1锛?#37711;?#28051;?k 鏄?#37825;存暟<br />   鍒?c^d = (m^e)^d = m^(ed) = m^(k(p-1)(q-1)+1)<br />   <strong>1</strong>.鑻m涓?#37828;痯鐨勫嶆暟锛?#28052;?#28051;?#37828;痲鐨勫嶆暟<br />      鍒?m^(p-1) ≡ 1 (mod p) (<span style="color: red;">璐归灏?#28729;?#37918;?</span><br />         => m^(k(p-1)(q-1)) ≡ 1 (mod p)<br />      m^(q-1) ≡ 1 (mod q) (<span style="color: red;">璐归灏?#28729;?#37918;?</span><br />         => m^(k(p-1)(q-1)) ≡ 1 (mod q)<br />      鏁?p銆乹 ?#28494;?#20824;鏁?#38340;?m^(k(p-1)(q-1)) - 1<br />         => pq | m^(k(p-1)(q-1)) - 1<br />      鍗?m^(k(p-1)(q-1)) ≡ 1 (mod pq)   <br />         => m^(k(p-1)(q-1)+1) ≡ m (mod n)   <br /><br />   <strong>2</strong>.鑻m鏄痯鐨勫嶆暟锛屼絾涓?#37828;痲鐨勫嶆暟<br />      鍒?m^(q-1) ≡ 1 (mod q) (<span style="color: red;">璐归灏?#28729;?#37918;?</span><br />         => m^(k(p-1)(q-1)) ≡ 1 (mod q)<br />         => m^(k(p-1)(q-1)+1) ≡ m (mod q)<br />      鍥?p | m<br />         => m^(k(p-1)(q-1)+1) ≡ 0 (mod p)<br />         => m^(k(p-1)(q-1)+1) ≡ m (mod p)<br />      鏁?m^(k(p-1)(q-1)+1) ≡ m (mod pq) <br />      鍗?m^(k(p-1)(q-1)+1) ≡ m (mod n)<br /><br />   <strong>3</strong>.鑻m鏄痲鐨勫嶆暟锛屼絾涓?#37828;痯鐨勫嶆暟锛?#29831;?#37828;?#37722;?#28051;?br /><br />   <strong>4</strong>.鑻m鍚?#28051;p?#25328;q鐨勫嶆暟鏃?br />      鍒?pq | m<br />         => m^(k(p-1)(q-1)+1) ≡ 0 (mod pq)<br />         => m^(k(p-1)(q-1)+1) ≡ m (mod pq)<br />      鍗?m^(k(p-1)(q-1)+1) ≡ m (mod n)<br /><br /><strong> 绗?#27996;岀璇?#37828;?#38315;斿緞<br /></strong>   鍏?#29831;?#37828;巑^ed ≡ m (mod p)鎭?#37812;愮珛<br />   <strong>1</strong>.鑻p涓簃鐨?#37733;?#28699;?#38171;?#37714;檖 | m^ed - m鏄?#37906;?#37812;愮珛锛?#37719;m^ed ≡ m (mod p)<br />   <strong>2</strong>.鑻p涓?#28051;簃鐨?#37733;?#28699;?#38171;?#28000;ed = k(p-1)(q-1) + 1锛?#37714;?m^(ed-1) - 1 = m^(k(p-1)(q-1)) - 1<br />       m^(p-1) ≡ 1 (mod p) (<span style="color: #ff0000;">璐归灏?#28729;?#37918;?/span>)<br />        => m^(k(p-1)) ≡ 1 (mod p)<br />        => m^(k(p-1)(q-1)) ≡ 1 (mod p)<br />        => m^(ed-1) ≡ 1 (mod p)<br />        => m^ed ≡ m (mod p)<br />   鍚岀悊鍙?#29831;乵^ed ≡ m (mod q)<br />   鏁卪^ed ≡ m (mod pq)锛?#37719;m^ed ≡ m (mod n)<br />   ?#24373;鍥?c^d = m^e^d = m^(ed)<br />   鏁?c^d ≡ m (mod n)锛?#29831;?#23011;?br />   <br /><strong style="font-size: 12pt;">鎬?#32513;?/strong><br /> 绗?#27996;岀姣旂涓绉嶇畝鍗?#37929;?#29785;?#38171;?#28000;?#28051;?#29831;?#37828;?#38315;斿?#21227;?#31562;SA绉侀挜绛?#37722;?#28051;?#26976;岀鍚屾閫?#37722;?#37510;?img src ="http://www.9087120.com/qinqing1984/aggbug/214419.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2016-11-18 17:05 <a href="http://www.9087120.com/qinqing1984/archive/2016/11/18/214419.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>Shell搴旂敤锛?0锛?#38171;?#37824;?#37816;佸紑婧?#25652;?#32514;栬瘧鐨凪akefilehttp://www.9087120.com/qinqing1984/archive/2016/10/19/214345.html鏄?#32457;?#37719;?#27996;屾湀鏄?#32457;?#37719;?#27996;屾湀Wed, 19 Oct 2016 07:11:00 GMThttp://www.9087120.com/qinqing1984/archive/2016/10/19/214345.htmlhttp://www.9087120.com/qinqing1984/comments/214345.htmlhttp://www.9087120.com/qinqing1984/archive/2016/10/19/214345.html#Feedback0http://www.9087120.com/qinqing1984/comments/commentRss/214345.htmlhttp://www.9087120.com/qinqing1984/services/trackbacks/214345.html鑴?#37832;?#23143;愮爜

   鐢?#27996;庡?#22557;?#27692;?#26050;敤椤?#37929;?#28186;濊禆璇稿绗?#28051;?#37826;瑰紑婧?#25652;?#38171;?#26473;?#27996;?#23534;婧?#25652;?#37722;?#37832;?#28051;?#37722;?#37928;?#37837;稿鐩綍銆?#25652;?#37929;?#37837;囧拰杈撳嚭浣?#32515;?#38171;?#26473;?#38322;?#37928;?#37837;稿鐩綍鏄寚浠?#27996;敓so搴?/span>鐨勫伐绋?#37929;綍锛?#25652;?#37929;?#37837;?#37828;寚浠?#27996;敓so搴?/span>鐨刴ake鐩?#37837;?#38171;?#26440;撳嚭浣?#32515;?#37828;?#37929;稿浜?#37837;稿鐩綍鐨?#38171;屼絾涓嶅繀鏄?#28699;?#37929;綍锛屽彲鐢?.?#28533;鍥?#23143;?#37714;扮埗鐩綍鐨勬煇浣?#32515;?#38171;屾?#25774;?#27194;眰鐩綍鐨勪綅缃?#38171;?#28186;?#23046;被鎺?#37510;?#28051;?#27996;?#32513;?#28051;鏀?#37816;?#28729;?#28000;?#38171;屼娇鐢?#27996;?#28051;浜?#37814;宸?#38171;?#29831;?#29785;佺渚嬭剼鏈?#28641;?#28051;?
 1.PHONY: all clean lib core
 2
 3thirdlib=openssl-1.0.1u?build_ssl ACE_wrappers/ace json ncurses-6.0??lib
 4coremod=main
 5
 6dir = `echo $@ | awk -F? '{print $$1}'`
 7aim = `echo $@ | awk -F? '{print $$2}'`
 8out = `echo $@ | awk -F? '{print $$3}'`
 9
10copy=\cp -Pf ${dir}/${out}/*.so* output
11
12define MAKE_SUBDIR
13echo "${dir},${aim},${out}"\
14if [ "$(MAKECMDGOALS)" != "clean" ]; then \
15$(MAKE) ${aim} -${dir}\
16if [ "$$is_cp" -eq "1" ]; then \
17$(copy); \
18fi \
19else \
20$(MAKE) clean -C ${dir}; \
21fi 
22endef
23
24all: lib core
25
26lib: $(thirdlib)
27
28$(thirdlib)::
29    @is_cp=1; $(MAKE_SUBDIR)
30
31core: $(coremod)
32
33$(coremod)::
34    @is_cp=0; $(MAKE_SUBDIR)
35
36clean: $(thirdlib) $(coremod)

瀹炵幇鎶宸?/strong>
   1锛?#28003;?#37922;?浣?#28051;?#37714;?#38341;旂锛屾墍鍒?#38341;旂殑3涓煙渚?#23046;?#28051;?#37837;稿鐩綍銆?#25652;?#37929;?#37837;?#37510;?#26440;撳嚭浣?#32515;?#38171;涗娇鐢awk?#28533;?#24143;鍙?#37722;勫煙锛?#37714;?#37714;?#28051;篸ir銆乤im?#25328;out锛?#37734;?#26473;?#29723;?#26473;囩涓?#38171;屽糳ir涓瀹?#38344;炵锛?#38000;宎im涓虹鍒?#29723;?#32448;洪?#27199;鐩?#37837;?#38171;宱ut涓虹琛?#32448;?#26440;撳嚭浣?#32515;?#37719;?#28051;篸ir鐩綍銆?br />   2锛塩opy涓哄懡浠?#37721;?#38322;?#38171;?#37716;熻兘涓?#23011;忓綋涓涓?#25652;?#32514;栬瘧瀹屾垚鍚?#38171;屽皢杈撳嚭鐨so搴撴嫹璐?#37714;output涓?#38171;?#39582;?#28103;?#37816;佽蒋?#25724;鎺?#38171;?#28725;?#27996;?#37832;?#37928;勫紑婧?#25652;?#38171;岄渶鍦?#32514;栬瘧?#22688;锛屼娇鐢?#28725;?#25652;旂殑閫夐?#35268;潵璋?#37922;configure锛屼娇鍏剁敓鎴恠o搴?#37510;?br />   3锛?#28051;?#27996;嗛噸鐢?#28000;爜锛屽?#27691;箟浜哅AKE_SUBDIR?#25057;浠寘锛屽?#20635;暟鍙?#38322;?#28051;篿s_cp锛屽綋is_cp涓?鏃?#38171;?#29723;?#32448;哄?#25779;墠缂栬瘧鐨?#37828;?#28186;濊禆搴?#38171;?#37722;?#37714;?#37828;?#28051;荤?#23338;簭銆?nbsp;
   4锛塼hirdlib?#25328;coremod涓?#28186;濊禆鏂囦欢锛屼娇鐢?#27996;?#37721;屽鍙?#29785;?#37714;?#38171;?#26473;欐涓?#28533;锛屽瑕?#37734;thirdlib涓?#37716;?#37711;?#37826;?#37928;?#28186;濊禆搴?#38171;屾寚瀹?#37837;稿鐩綍銆?#25652;?#37929;?#37837;囧拰杈撳嚭浣?#32515;?#37719;冲彲锛?#37711;跺畠鍦?#37826;?#28051;?#37922;敼銆?img src ="http://www.9087120.com/qinqing1984/aggbug/214345.html" width = "1" height = "1" />

]]>Shell搴旂敤锛?锛?#38171;氳嚜鍔?#37718;?#37813;?#38322;?#32514;栬瘧http://www.9087120.com/qinqing1984/archive/2016/09/28/214307.html鏄?#32457;?#37719;?#27996;屾湀鏄?#32457;?#37719;?#27996;屾湀Wed, 28 Sep 2016 03:04:00 GMThttp://www.9087120.com/qinqing1984/archive/2016/09/28/214307.htmlhttp://www.9087120.com/qinqing1984/comments/214307.htmlhttp://www.9087120.com/qinqing1984/archive/2016/09/28/214307.html#Feedback0http://www.9087120.com/qinqing1984/comments/commentRss/214307.htmlhttp://www.9087120.com/qinqing1984/services/trackbacks/214307.html鑴?#37832;?#22994;?#26473;?/strong>
   褰撻渶瑕?#37734;?#23536;堝锛?#23011;?#28641;傚嚑鍗佽?#20914;?#29365;櫨锛夊彴鏈?#37731;?#28051;?#32514;栬瘧鍚?#28051;绋嬪簭鏃?#38171;?#28641;傛灉涓涓?#28051;?#37734;?#37813;嬪伐鎷?#29840;?#23143;愮爜銆?#37712;?#32514;栬瘧锛岄偅涔?#37825;?#37916;?#28751;?#23536;?#28003;?#38171;?#28051;?#27996;嗚兘澶?#38322;?#38010;?#37930;?#37813;嬪伐銆?#39582;?#29723;?#37734;?#32514;栬瘧锛?#37733;?#23005;?#37712;?#27996;?#28051;涓?#38004;?#37832;?#38171;?#29831;?#38004;?#37832;?#37737;?#27996;庤嚜鍔?#37718;栬剼鏈?#29831;言expect锛坋xpect鍩?#27996;tcl锛?#28729;炵幇锛屽熀鏈?#37720;?#37918;?#37828;?#38333;堝姣?#28051;?#26473;?#32459;?#28051;?#37832;?#38171;?#37714;涘缓涓涓?#28699;?#26473;?#32459;?#38171;?#37734;?#29831;?#28699;?#26473;?#32459;嬪唴鍏?#29835;?#37922;scp鎷?#29840;?#23143;愮爜鍒?#26473;?#32459;?#28051;?#37832;?#38171;屽啀鐢ssh鐧诲綍鍒?#26473;?#32459;?#28051;?#37832;?#37510;?#37721;?#38315;乧d銆乧onfigure?#25328;make?#25057;浠?#38171;?#27996;?#27996;?#37832;熼棿鐨勫懡浠?#26440;撳?#21700;鐢?#23005;?#37714;?#37714;嗘瀽锛屾渶缁?#37928;?#32514;栬瘧杈撳嚭淇濆瓨鍒板?#25779;墠鐩綍output瀛?#37929;綍涓?#37510;?#37711;跺懡浠?#29723;屽?#20635;暟璇?#37828;庡涓?#38171;?br />    绗?鍙傛暟涓?#26473;?#32459;?#28051;?#37832;洪厤缃?#37826;囦欢锛?#28051;涓?#28598;?#29723;屾枃鏈?#37826;囦欢锛屾?#24538;?#23678;寮?#28051;篒P 鐢?#37812;?#37722;?瀵嗙爜锛岀鏍?#32471;?#37714;?#38341;?#38171;屾敮鎸??#25950;閲?#37510;?br />    绗?鍙傛暟涓?#37832;?#37734;?#28051;?#37832;?#23143;愮?#20346;洰?#32141;锛?#29781;佹?#20637;鐩綍?#29928;鍦Makefile?#25328;configure鏂囦欢銆?br />    绗?鍙傛暟涓?#26473;?#32459;?#28051;?#37832;?#37929;?#37837;?#37929;綍锛?#37922;?#27996;庡?#27195;斁婧愮?#20346;殑浣?#32515;?#37510;?br />
鑴?#37832;?#28729;炵幇
   鎷?#29840;?#23143;愮爜
 1proc copy_file {host user srcdir dstdir passwd {to 10} } {
 2    if [catch "spawn scp -rq $srcdir $user@$host:$dstdir" msg] {
 3        send_error "failed to spawn scp: $msg\n"
 4        exit 1
 5    }
 6    
 7    set timeout $to
 8    expect_after eof { 
 9        send_error "$host scp died unexpectedly\n"
10        exit 1
11    }
12    expect {
13        "(yes/no)?" { send "yes\r"; exp_continue }
14        -re "(?:P|p)assword:" { send "$passwd\r" }
15        timeout { do_timeout "$host scp" }
16    }
17
18    expect {
19        full_buffer { exp_continue }
20        timeout { exp_continue }
21        eof 
22    }
23}
   绗?琛?#29835;?#37922;spawn?#25057;浠?#37813;?#29723;宻cp?#25057;浠?#38171;?#39582;?#37922;catch鎹?#37817;夐敊璇?#38171;涘?#25780;墽琛屾垚鍔?#37722;?#38171;岀12琛?#37922;expect绛?#23536;?#26473;?#32468;?#26440;撳嚭锛堣秴鏃堕?#27199;涓?0绉?#38171;?#38171;岀13銆?4琛岃嚜鍔?#26440;?#37711;?#37922;?#37812;?#37722;嶅拰瀵嗙爜锛屽綋杩囩涓綉缁?#26473;?#37818;?#37826;?#23534;鏃?#38171;屼?#27692;?#24402;厤鍒?#32471;?琛?#37928;eof锛涘綋杈撳嚭瀹屾垚杩?#37818;?#37711;?#38338;?#37827;?#38171;屼?#27692;?#24402;厤鍒?#32471;?1琛?#37928;eof锛?#28641;傛灉杈撳?#21700;澶氳秴杩噀xpect鍐呴儴鐨刡uffer鏃?#38171;屼?#27692;?#24402;厤鍒?#32471;?9琛?#37928;full_buffer锛?#26473;?#38322;?#37922;?#27996;?#28051;?#27996;嗘?#24880;?#27195;晥鐜?#38171;屼娇鐢?#27996;?#38344;欓粯鏂瑰紡鐨scp锛?#37733;?#27996;?#28729;?#38340;?#28028;氬?#24402;厤鍒?#32471;?0琛?#37928;timeout锛?#28051;嶇鍖归厤鍒板绉嶆鍐?#38171;岄兘瑕佺户缁?#37929;村埌eof銆?br /> 
   鎵?#29723;?#32514;栬瘧
 1proc do_make {host user passwd subdir {to 10} } {
 2    if [catch {spawn ssh $user@$host} msg ] {
 3        send_error "failed to spawn ssh: $msg\n"
 4        exit 1
 5    }
 6    
 7    set timeout $to
 8    expect_after eof { 
 9        send_error "$host ssh died unexpectedly\n"
10        exit 1
11    }
12    
13    expect {  
14        "*yes/no" { send "yes\r"; exp_continue }
15        -re "(?:P|p)assword:" { send "$passwd\r" }  
16        timeout { do_timeout "$host ssh" }
17    }  
18    wait_cmd $spawn_id passwd
19
20    send "cd $subdir\r"  
21    wait_cmd $spawn_id cd
22    
23    send "source configure\r"
24    wait_cmd $spawn_id configure
25
26    send "make\r"  
27    wait_cmd $spawn_id make
28
29    send "exit\r"  
30    expect eof  
31}
   鍏?#27996;spawn?#25328;expect鐨勮閲?#28051;?#28051;?#38010;?a href="#copy_file">鎷?#29840;?#23143;愮爜鐩?#37722;?#38171;?#28051;?#37722;?#37928;?#37828;?#28186;?#23046;?#37721;?#38315;佸懡浠cd銆乻ource configure銆乵ake锛屾瘡涓懡浠?#26916;荤鍒板懡浠?#37819;愮?#34425;鍚?#38171;?#29835;?#37922;嚜瀹氫箟鍑芥暟wait_cmd锛?#37712;嶅彂涓?#28051;涓?#38171;屾渶鍚庡彂閫乪xit閫?#22189;ssh銆佸?#33392;嚧杩?#37818;?#37711;?#38338;?#38171;屽?#24402;厤鍒?#37832;鍚?#28051;琛?#37928;eof銆傚浜?#37832;?#37928;?#26916;?#37929;?#23143;愮爜锛屽彲?#20824;娌?#37832;?#37812;?#28051;?#37922;厤缃?#38171;岄偅涔configure鏂囦欢鍙?#28000;?#28051;嶅瓨鍦?#37812;?#37712;呭涓虹锛?#28641;傛灉涓嶅瓨鍦?#28725;艰?#23384;閿?#28052;熸病鍏崇郴锛?#28051;嶅?#21342;搷make锛?#28641;傛灉configure?#22189;閿?#38171;岄偅涔坢ake涔?#28028;氬嚭閿?#37510;?#26473;?#38322;屼娇鐢source鏄?#28051;?#27996;?#28003;K厤缃?#37734;?#35120;撳墠shell涓敓鏁?#37510;?br />   
   涓?#23536;?#37916;?/strong>
 1set f [open $file r]
 2set curtime [clock seconds]
 3
 4log_user 0
 5set s {[:blank:]}
 6set pattern "^(\[^#$s]+)\[$s]+(\[^$s]+)\[$s]+(\[^$s]+)"
 7
 8while { [gets $f line] != -1 } {
 9    if { ![regexp $pattern [string trimleft $line] ? host user passwd] } {
10        continue
11    }
12    send_user "$host $user $passwd\n"
13    if { ![fork] } {
14        
15        set filename output/${host}_[clock format $curtime -format %y.%m.%d_%H.%M.%S].log
16        log_file -noappend -a $filename
17
18        copy_file $host $user $srcdir $dstdir $passwd 30
19        do_make $host $user $passwd $subdir 30
20
21        send_user "$host finish\n"
22        exit
23    }
24}
   鎵撳紑杩?#32459;?#28051;?#37832;洪厤缃?#37826;囦欢锛?#29831;?#37721;?#23011;?#28051;琛?#37929;村埌鏂囦欢灏?#38171;屽?#30028;?#25950;閲?#29723;?#38171;?#37922;?#23005;?#37714;欐?#24876;彇IP銆佺敤鎴?#37722;嶅拰瀵嗙爜锛?#37714;涘?#21700;瓙杩?#32459;?#38171;屾?#22600;P?#25328;褰撳墠鏃?#38338;村懡鍚峫og鏂囦欢锛?#37922;?#27996;庡墠闈?#29835;?#37922;log_user 0鍏?#38338;?#27996;嗘帶鍒跺彴杈撳嚭锛?#37733;?#23005;?#28051;?#27996;嗚兘璁板綍杈撳嚭鍒?#37827;?#36423;?#37826;囦欢锛?#28051;瀹?#29781;?#37716;?a閫夐锛?#38171;屾渶鍚?#29835;?#37922;?#37713;芥暟copy_file?#25328;do_make銆?br />   
   瀹屾暣鑴?#37832;?#28051;嬭浇锛?a href="/Files/qinqing1984/autobuild.zip">autobuild.zip


]]>涓绉嶆嫤鎴狶inux鍔?#37804;?#25652;揂PI鐨?#37826;规硶鍙婅缃?/title><link>http://www.9087120.com/qinqing1984/archive/2016/08/25/214213.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Thu, 25 Aug 2016 03:10:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2016/08/25/214213.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/214213.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2016/08/25/214213.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/214213.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/214213.html</trackback:ping><description><![CDATA[<strong style="font-size: 14pt">鎻?#26473;?/strong><br />    鎷?#37812;狶inux鍔?#37804;?#25652;揂PI鐨勫父瑙?#37826;规硶锛屾槸鍩?#27996;庡姩鎬佺鍙烽摼鎺?#29781;?#37929;栨妧鏈?#28729;炵幇鐨?#38171;屽熀鏈?#23005;?#26976;?#37828;?br />    1. 閲嶅懡鍚嶈?#20345;嫤鎴?#37928;?#37929;?#37837;?#37716;?#37804;?#25652;?#37510;?br />    2. 鍒涘缓鏂?#37928;?#37722;?#37722;?#37716;?#37804;?#25652;?#38171;屽?#27691;?#22798;?#20345;嫤鎴?#37928;?#37722;?#37722;岮PI锛?#37734;API鍐呴儴璋?#37922;?#37720;?#37716;?#37804;?#25652;撳搴旂殑API銆?#26473;?#38322;?#37928;?#37722;?#37722;?#37828;寚涓?#38322;嶅懡鍚嶅墠鍔?#37804;?#25652;撳墠鐨?#37722;嶇鐩?#37722;?#37510;?br />    鏄?#38000;屾槗瑙?#38171;?#28641;傛灉瑕佹嫤鎴?#28598;?#28051;?#28051;?#37722;?#37716;?#37804;?#25652;?#28051;?#37928;凙PI锛岄偅涔堝繀椤?#37714;涘?#21700;涓?#28725;?#25652;旂殑鍚?#37722;?#37716;?#37804;?#25652;?#38171;?#26473;欐涓?#28533;涓?#28000;呯?#20346;浣庢晥锛?#26473;樺繀椤?#29722;?#28028;?#37711;摼鎺?#37714;?#28729;?#37812;?#27996;?#26473;?#37714;?#32459;嬪簭涓?#38171;?#37837;?#37817;?#37716;?#37804;?#25652;撻摼鎺?#37720;?#37918;?#38171;屽閲嶅?#23726;BI绗?#37721;?#37928;勫鐞?#37828;?#38315;夋嫨浼?#37711;摼鎺?#37928;勯偅涓?#37716;?#37804;?#25652;?#38171;?#37510;?鍙?#28598;?#37734;?#38333;?#28699;愬?#33445;暟鐨勫疄?#24135;涓?#38171;?#38011;?#37836;?#29835;?#37922;摼璋?#37922;?#37714;?#27996;?#37720;烝PI锛?#37714;?#28028;氬紩璧?#23005;?#23536;?#37916;?#38000;屽穿婧?#37510;?#37832;?#37826;规硶閫?#26473;?#37929;存帴淇敼ELF鏂囦欢涓?#37928;?#37716;?#37804;?#25652;揂PI鍏?#37721;?#29723;?#26916;?#38171;岃鍐?#27996;?#29999;?#29785;?#37826;规硶鐨?#28051;?#26473;?#38338;?#26864;?#37510;?<br /> <br /> <strong style="font-size: 14pt">鐗圭偣</strong><br />    <strong style="color: red">1.</strong> 涓?#28186;濊禆浜庡姩鎬?#25652;撻摼鎺?#26916;?#25652;?#37510;?br />    <strong style="color: red">2.</strong> ?#20824;鎷?#37812;?#28598;?#28051;?#28051;?#37722;?#37716;?#37804;?#25652;?#28051;?#37928;勫涓狝PI銆?br />    <strong style="color: red">3.</strong> 鏀?#37816;?#26473;?#29723;屾椂鍔?#37804;侀摼鎺?#37928;勬嫤鎴?#37510;?br />    <strong style="color: red">4.</strong> 閽?#28699;愬?#33445;暟鍐?#37928;勫疄鐜颁綋锛?#38011;?#29835;?#37922;?#37714;板師API锛?#37714;?#28051;?#28028;?#23005;?#23536;?#37916;?#37510;?<br /> <br /> <hr /> <strong style="font-size: 14pt">瀹炵幇</strong><br />    <strong style="font-size: 12pt">鎷?#37812;?#37828;?#28751;勮</strong><br />       涓?#27996;嗘敮鎸佺?#22317;偣2?#25328;3锛屽?#34425;珛浜?#28051;涓?#37815;?#37812;?#37828;?#28751;勮锛?#26473;?#28051;?#37828;?#28751;勮鏈?绾?#37510;?#32471;?绾?#28051;ELF鏂囦欢鍒?#28729;?#37928;凙PI閽?#28699;?#37828;?#28751;勮锛?#38335;?#28051;ELF鏂囦欢鍙?#37836;?#38171;屽?#28051;篈PI閽?#28699;?#37828;?#28751;勮锛?#32471;?绾?#28051;篈PI鍒?#28729;?#37928;?#38333;?#28699;愬?#33445;暟鏄?#28751;勮锛?#38335;?#28051;篈PI鍚嶇锛屽?#28051;哄寘鍚?#37832;鑰佸師鍑芥暟鍦板潃鍜屾渶鏂?#38333;?#28699;愬?#33445;暟鍦板潃鐨?#32513;撴?#21226;綋锛?#28641;?#28051;嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/api_hook_map.png" /></div>       褰撴渶鍏?#37813;撳紑ELF鏂囦欢鎴?#37716;熸椂锛屼?#27692;湪绗?绾?#37828;?#28751;勮涓?#37819;?#37711;?#29825;板綍锛?#37721;?#28052;嬪?#25780;渶鍚庡叧闂?#37722;?#28051;ELF鏂囦欢鏃?#38171;屽?#21464;?#27691;粠涓?#32457;?#38340;?#28725;?#25652;旂?#21230;?#26495;綍銆傚?#25782;涓娆?#37816;?#38333;?#37716;?#37804;?#25652;揂PI鏃?#38171;屽?#21464;?#27692;湪绗?绾?#37828;?#28751;勮鎻?#37711;?#29825;板綍锛?#37721;?#28052;?#37719;?#38333;?#37722;?#28051;API鏃?#38171;屽?#21464;?#27691;粠涓?#37714;?#38340;?#28725;?#25652;旂?#21230;?#26495;綍銆?br /> <br />    <strong style="font-size: 12pt">璁?#32480;ELF鏂囦欢鐨?#37828;犲?#24531;熀鍦板潃</strong><br />       璁?#32480;?#37828;犲?#24531;熀鍦板潃鏄?#28051;?#27996;?#23536;?#37714;癊LF涓?#37716;?#37804;佺鍙?#29723;拰閲嶅?#27691;?#23945;摼鎺?#26473;囩琛?#37928;勫?#21613;锛?#37733;?#28051;?#26473;?#27996;?#29723;?#37928;勪綅缃兘鏄?#37929;稿浜庡熀鍦板潃鐨勫?#24533;閲?#38171;?#29831;?#32480;楁硶鍦?#37813;撳紑ELF鏂囦欢鏃?#37813;?#29723;?#38171;?#28641;?#28051;嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/elf_baseaddr_algo.png" /></div>       EXE鏂囦欢涓?#37721;?#37813;?#29723;屾?#22246;欢锛孌YN鏂囦欢涓?#37716;?#37804;?#25652;?#37510;傚浜庡彲鎵?#29723;屾?#22246;欢锛屾槧灏勫熀鍦板潃涓?#37721;?#37813;?#29723;岃?#21616;?#33445;鐨勮?#27693;嫙鍦板潃锛?#28725;?#27996;庡姩鎬?#25652;?#38171;屽彲閫?#26473;囦换涓API鐨?#37734;板潃鍑?#37720;?#28729;?#37928;勫?#24533;閲?#23536;?#37714;?#38171;?#28000;?#28051;API鐨?#37734;板潃鍙?#38315;?#26473;?#29835;?#37922;libdl.so搴揂PI dlsym寰?#37714;?#38171;屽?#24533;閲?#38315;?#26473;囨煡璇?#37716;?#37804;侀摼鎺?#32471;?#37721;?#29723;?#23536;?#37714;?#37510;?br /> <br />    <strong style="font-size: 12pt">鎵撳紑ELF鏂囦欢</strong><br />       涓?#27996;嗘敮鎸佺?#22317;偣2鍗?#37815;?#37812;?#28051;?#37722;?#37716;?#37804;?#25652;?#37928;勫涓狝PI锛?#38010;?#37930;?#23011;?#23046;?#37816;?#38333;API?#22688;瑕?#37813;撳紑骞?#29831;?#37826;囦欢鐨勫紑閿锛岀嫭绔嬫彁渚?#27996;?#37813;撳紑ELF鏂囦欢鐨?#37818;?#37721;搷浣?#38171;屾?#20346;?#23338;涓嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/elf_open.png" /></div>      鑻?#26440;?#37711;ELF鏂囦欢鍚?#28051;虹锛?#37714;?#29723;?#32448;?#37813;撳紑褰撳墠杩?#32459;?#37928;勫彲鎵?#29723;屾?#22246;欢锛屾鏃?#29781;佷粠浼?#37826;囦欢?#37108;缁?proc/self/exe璇?#37721;?#37826;囦欢?#30718;寰?#37722;?#38171;?#28000;?#23005;?#32429;?#29835;?#37922;郴缁?#29835;?#37922;open銆傚綋鍚?#28051;ELF鏂囦欢琚?#28598;?#23046;?#37813;撳紑鏃?#38171;屽椤?#38315;掑缁撴瀯elf鐨勫紩鐢?#29825;?#37825;?#37510;?br /> <br />    <strong style="font-size: 12pt">鎸?#38333;API</strong><br />       褰撴?#25779;紑ELF鏂囦欢鍚?#38171;屽氨鍙?#37816;?#38333;API浜?#38171;屾?#20346;?#23338;涓嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/elf_hook_api.png" /></div>       褰撶涓娆?#37816;?#38333;?#37827;?#38171;岄渶瑕佷繚瀛樺師鍑芥?#39041;互渚?#37722;?#38344;?#37719;?#38333;?#38171;?#32471;?#27996;屾浠?#37722;?#32513;?#32513;?#37816;?#38333;?#37722;?#28051;API鏃?#38171;屾洿鏂?#38333;?#28699;愬?#33445;暟锛屼絾鍘?#37713;芥暟涓嶅彉銆?nbsp;  <br />    <br />    <span style="font-size: 12pt"><strong>鍗?#38333;API</strong></span><br />       褰撴?#25779;紑ELF鏂囦欢鍚?#38171;屽氨鍙?#37719;?#38333;API浜?#38171;屾?#20346;?#23338;涓嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/elf_unhook_api.png" /></div> <br />    <strong style="font-size: 12pt">鍏?#38338;璄LF鏂囦欢</strong><br />       鍥?#28051;?#37819;?#28186;?#27996;?#37813;撳紑ELF鏂囦欢鐨?#37818;?#37721;搷浣?#38171;屾墍浠?#23536;厤鏈?#37711;?#38338;璄LF鏂囦欢鐨?#37818;?#37721;搷浣?#37510;傚綋涓嶉渶瑕佹寕閽API鐨勬?#36346;?#38171;屽氨鍙?#28000;?#37711;?#38338;璄LF鏂囦欢浜?#38171;屾?#20346;?#23338;涓嬪浘<br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/elf_close.png" /></div> <br /> <hr /><strong style="font-size: 14pt;">杩?#29723;屾椂鍔?#37804;佹嫤鎴?#29761;?#32515;?/strong><br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/run_dyn_hook_mod.png" /></div>    鍦?#37714;?#28654;嬪?#26664;鍧?#28051;?#37813;撳紑褰撳?#23941;彲鎵?#29723;屾?#22246;欢锛屾寕閽libdl.so搴?#37928;凙PI dlopen?#25328;dlsym锛?#37734;?#26462;?#37817;?#22959;?#37735;?#28051;?#38171;屾鍔?#37804;?#25652;?#37721;?#37836;勫拰API鍚嶇鍦?#37815;?#37812;?#37828;?#28751;勮涓?#37836;?#37813;?#38333;?#28699;愬?#33445;暟锛?#38011;?#37813;?#37714;?#37714;?#26473;?#37733;為挬瀛愬?#33445;暟锛?#37722;?#37714;?#26473;?#37733;?#29835;?#37922;dlsym鐨?#32513;撴灉锛?#37734;?#38335;姣佹鍧?#28051;?#38171;?#37719;?#38333;dlopen?#25328;dlsym銆?br /> 褰?#37716;?#37804;?#25652;?#29722;?#26473;?#32459;?#37716;犺浇鐨勬?#36346;?#38171;屼細璋?#37922;?#37714;?#28654;嬪?#26664;鍧?#38171;涘綋琚?#26473;?#32459;?#37719;歌浇鎴?#26473;?#32459;?#38315;?#22189;鐨勬?#36346;?#38171;屼細璋?#37922;?#38335;姣佹鍧?#38171;涘綋閫?#26473;dlsym璋?#37922;API鏃?#38171;?#37714;?#28028;氬湪dlsym鐨?#38333;?#28699;愬?#33445;暟涓?#29835;?#37922;?#26462;?#37817;?#22959;?#37735;?#37510;?#38315;?#26473;囩幆?#37721;?#38322;LD_PRELOAD灏?#37716;?#37804;?#25652;libhookapi.so璁?#28051;?#26864;?#37716;犺浇搴?#38171;?#26473;欐灏辫兘鎷?#37812;?#37714;?#37813;鏈?#26473;?#32459;嬪dlopen鍙奷lsym鐨?#29835;?#37922;?#38171;?#26473;?#38000;屾嫤鎴?#37714;板鎸?#38333;?#37716;?#37804;?#25652;揂PI鐨?#29835;?#37922;?#37510;?img src ="http://www.9087120.com/qinqing1984/aggbug/214213.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2016-08-25 11:10 <a href="http://www.9087120.com/qinqing1984/archive/2016/08/25/214213.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>涓绉?#32513;?#29825;?#27996;戞煡璇?#27035;?#37826;囦欢鐨?#37826;规硶鍙婄郴缁?/title><link>http://www.9087120.com/qinqing1984/archive/2016/08/25/214212.html</link><dc:creator>鏄?#32457;?#37719;?#27996;屾湀</dc:creator><author>鏄?#32457;?#37719;?#27996;屾湀</author><pubDate>Thu, 25 Aug 2016 03:10:00 GMT</pubDate><guid>http://www.9087120.com/qinqing1984/archive/2016/08/25/214212.html</guid><wfw:comment>http://www.9087120.com/qinqing1984/comments/214212.html</wfw:comment><comments>http://www.9087120.com/qinqing1984/archive/2016/08/25/214212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/qinqing1984/comments/commentRss/214212.html</wfw:commentRss><trackback:ping>http://www.9087120.com/qinqing1984/services/trackbacks/214212.html</trackback:ping><description><![CDATA[<strong style="font-size: 14pt;">鎻?#26473;?/strong><br />    浜戞煡?#28483;骞冲彴浠nginx浣?#28051;?#37721;?#37722;?#28000;?#37918;?#37832;?#37716;?#37731;?#38171;屼綔涓哄畨鍏?#32513;?#32468;?#28051;?#27996;戞煡璇?#37832;?#37716;?#37928;勬姊?#37510;傚?#25779;畨鍏?#32513;?#32468;渶瑕佹煡璇?#27035;?#37826;囦欢鏃?#38171;HTTP璇?#23033;傚強鍏跺搷搴兘浼?#32513;?#26473;nginx锛?#28051;?#27996;嗚幏鍙?#39582;?#32513;?#29825;?#28051;澶?4灏?#37827;?#37836;?#29831;?#37928;勯粦鏂囦欢鏁?#38322;?#38171;屽氨寰?#37711;?#37812;幏缁?#26473;nginx鐨凥TTP鍝?#25652;?#38171;屽?#23941;?#27693;暟鎹?#37714;嗘瀽銆?#37812;幏HTTP鏁?#37817;?#23092;?#37832;夊?#27697;鏂规硶锛?#28051;?#27996;嗙畝鍗?#26946;樻晥锛?#26473;?#38322;屼娇鐢?#27996;嗘?#20635;帴HTTP杩囨护妯?#37735;?#37928;?#37826;规硶锛屽彟澶?#28051;?#27996;?#28051;嶅?#21342;搷nginx鏈韩鐨処O澶?#37918;?#38171;屽皢HTTP鍝?#25652;斿疄浣?#37721;?#38315;?#37714;?#37721;?#28051;涓?#26473;?#32459;?#37719;?#32513;?#29825;?#37832;?#37716;?#38171;?#37922;?#32513;?#29825;?#37832;?#37716;潵鎺?#37824;?#39582;?#37714;嗘瀽HTTP鍝?#25652;?#38171;屾灦鏋?#28641;?#28051;嬪浘 <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/kstat_schema.png" width="599" height="289" /></div>    缁?#29825;?#37832;?#37716;?#37922;?涓?#37818;?#37824;?#32510;?#32459;嬪拰1涓?#28699;樺偍绾?#32459;嬫瀯鎴?#38171;?#37711;?#28051;?#37818;?#37824;?#32510;?#32459;嬭璐?#37818;?#37824;?#28000;巒ginx杩囨护妯?#37735;?#37721;戞潵鐨凥TTP鍝?#25652;斿疄浣?#38171;岃鏋愬畠骞?#37819;愬彇榛?#37826;囦欢MD5锛?#37716;?#37711;?#37711;?#27996;?#37916;?#35120;槦鍒?#38171;?#38000;屽?#27194;偍绾?#32459;?#28000;庡叡浜?#37916;?#35120;槦鍒?#32457;诲嚭榛?#37826;囦欢MD5锛屾彃鍏?#37714;?#28051;存?#36346;?#21613;瓨鏄?#28751;?#37826;囦欢锛?#27996;?#23011;忓瀹?#37827;?#37722;屾鍒扮?#20346;鏂囦欢銆?br /> <br /> <strong style="font-size: 14pt">鐗圭偣</strong><br />    杩?#32457;嶆灦鏋勫噺灏?#27996;唍ginx IO?#27426;杩?#38171;屼?#28618;瘉浜唍ginx鐨勭?#20914;畾楂樻晥杩?#29723;?#38171;?#28000;?#38000;?#28051;嶅?#21342;搷鐢?#37812;?#37928;?#28051;氬姟杩?#29723;?#38171;?#37832;?#37734;?#26473;?#37818;?#28051;?#38344;為?#35826;鐨?#38171;屾敮鎸?#27996;?#32513;?#29825;?#37832;?#37716;?#37928;勭嫭绔?#26473;?#29723;?#28051;?#37719;囩骇銆?br /> <br /> <strong style="font-size: 14pt">瀹炵幇</strong><br />    <strong style="font-size: 12pt">nginx杩囨护妯?#37735;?/strong><br />       璇?#23092;佺杩?#29723;?#37734;nginx?#20240;浣?#26473;?#32459;?#37510;?br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/kstat_ngxmod.png" width="279" height="802" /></div>       鐢?#27996;巒ginx閲?#37922;?#27996;?#23534;?#23005;IO鏈?#37714;?#38171;?#37733;?#23005;?#28000;呭?#25780;埅?#24143;鍒HTTP鍝?#25652;斿疄浣?#28052;?#28751;?#37828;?#37832;夋暟鎹?#32513;?#26473;囨椂锛屾墠鏈?#37722;?#38344;?#37928;勬搷浣?#38171;涜嫢娌?#37832;夋暟鎹?#38171;?#37714;?#28000;涔?#28052;?#28051;?#37922;?#37707;?#37510;?#26473;?#38322;屾瘡娆?#37721;?#38315;佸墠鍏?#37714;?#37826;?#37828;?#37722;?#26473;?#37818;?#27996;?#32513;?#29825;?#37832;?#37716;?#38171;屾槸涓?#27996;嗘敮鎸佺粺璁?#37832;?#37716;?#37928;勭嫭绔?#26473;?#29723;?#28051;?#37719;囩骇锛屾崲鍙?#29831;濊锛?#28051;嶇缁?#29825;?#37832;?#37716;?#37828;?#37722;?#26473;?#29723;屾?#26663;穿婧?#38171;岄兘涓嶅?#21342;搷nginx鐨勮繍琛?#37510;?br /> <br /> <strong style="font-size: 12pt">缁?#29825;?#37832;?#37716;?/strong><br />    <strong>鎺?#37824;?#32510;?#32459;?/strong><br />       杩?#38322;?#37928;?#37818;?#37824;?#32510;?#32459;?#28052;?#28751;?#37828;?#28051;荤嚎绋?#37510;?br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/kstat_receiver.png" width="575" height="592" /></div>    <hr width="97%" />    <strong>瀛樺偍绾?#32459;?/strong><br />       瀛樺偍绾?#32459;?#28051;?#37721;?#28051;涓伐浣?#32510;?#32459;?#37510;?br /> <div align="center"><img border="0" alt="" src="http://www.9087120.com/images/cppblog_com/qinqing1984/kstat_storer.png" width="492" height="644" /></div>       鍚屾鏂囦欢瀹?#37827;跺櫒鐨勬椂闂?#38338;?#38341;?#29781;?#23011;?#37826;板缓鏂囦欢瀹?#37827;跺櫒鐨勭锛?#37922;?#27996;庡畾鏃跺櫒鍒?#37832;?#37928;?#27996;嬩欢澶?#37918;?#37828;?#28051;绉嶅紓姝?#37813;?#29723;屾祦锛屾墍浠?#28751;?#28729;?#28000;?#35120;撳?#27692;苟琛?#38171;?#28051;?#8220;浠巕澶寸?#35826;嚭榛?#37826;囦欢MD5”?#25655;浣?#37922;?#37734;?#27996;?#37722;?#28051;姘?#39582;?#37826;?#37722;?#37510;?img src ="http://www.9087120.com/qinqing1984/aggbug/214212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/qinqing1984/" target="_blank">鏄?#32457;?#37719;?#27996;屾湀</a> 2016-08-25 11:10 <a href="http://www.9087120.com/qinqing1984/archive/2016/08/25/214212.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>涓绉?#37837;?#37817;甦entry?#24143;鍙?#32513;?#28725;矾寰?#37722;?#37928;勫疄?#24135;鏂规硶http://www.9087120.com/qinqing1984/archive/2016/08/24/214229.html鏄?#32457;?#37719;?#27996;屾湀鏄?#32457;?#37719;?#27996;屾湀Wed, 24 Aug 2016 11:22:00 GMThttp://www.9087120.com/qinqing1984/archive/2016/08/24/214229.htmlhttp://www.9087120.com/qinqing1984/comments/214229.htmlhttp://www.9087120.com/qinqing1984/archive/2016/08/24/214229.html#Feedback0http://www.9087120.com/qinqing1984/comments/commentRss/214229.htmlhttp://www.9087120.com/qinqing1984/services/trackbacks/214229.html
   1. 鍏堣幏鍙杁entry鎵灞?#37826;囦欢?#37108;缁?#28725;?#25652;旂殑鎸傝?#30028;偣锛屽熀鏈?#37720;?#37918;?#37828;?#38316;嶅巻鏂囦欢?#37108;缁焩fsmount鏍?#38171;屾壘鍒?#28051;巇entry鏈?#37929;?#37722;岃?#21615;骇鍧?#37928;剉fsmount锛屽疄?#24135;濡?#28051;?
 1extern spinlock_t *vfsmnt_lock;
 2
 3static struct vfsmount* next_mnt(struct vfsmount *p, struct vfsmount *root)
 4{
 5    struct list_head *next = p->mnt_mounts.next;
 6    if (next == &p->mnt_mounts) {
 7        while (1{
 8            if (p == root)
 9                return NULL;
10            next = p->mnt_child.next;
11            if (next != &p->mnt_parent->mnt_mounts)
12                break;
13            p = p->mnt_parent;
14        }

15    }

16    return list_entry(next, struct vfsmount, mnt_child);
17}

18
19static struct vfsmount* get_dentry_mnt(struct dentry *dentry)
20{
21    struct vfsmount *p, *root;
22    struct fs_struct *fs = current->fs;            
23
24    read_lock(&fs->lock);
25    root = fs->root.mnt;
26    mntget(root);
27    read_unlock(&fs->lock);
28
29    spin_lock(vfsmnt_lock);
30    for(p = root; p; p = next_mnt(p,root)){
31        if(p->mnt_sb == dentry->d_sb){
32            mntget(p);
33            break;    
34        }

35    }

36    spin_unlock(vfsmnt_lock);
37
38    mntput(root);
39    
40    return p;
41}
   next_mnt鍑芥暟瀹炵幇浜?span style="color: red;">鍏?#37837;归?#23941;巻?#30838;锛岄?#23941;巻浠root涓?#37837;?#37928;?#37826;囦欢?#37108;缁熸?#20637;?#30028;偣锛宲涓洪?#23941;巻杩囩涓?#37928;勫?#25779;墠缁撶偣锛?#26473;?#37733;p鐨?#28051;?#28051;涓?#37816;傝?#30028;偣锛泇fsmnt_lock鍙?#38315;?#26473;?#37712;?#37837;?#37713;芥暟kallsyms_on_each_symbol鎴杒allsyms_lookup_name鏌?#37813;捐幏寰?#37510;?br />
   2. 鍐?#29835;?#37922;?#37712;?#37837;?#37713;芥暟d_path锛屾帴鍙?#28751;佽濡?#28051;?br />
 1char* get_dentry_path(struct dentry *dentry,char *buf,int len)
 2{
 3    char *= "";    
 4    struct vfsmount *mnt = get_dentry_mnt(dentry);
 5    
 6    if(mnt){
 7        struct path ph = {.dentry = dentry, .mnt = mnt};
 8        p = d_path(&ph,buf,len);
 9        if(IS_ERR(p))
10            p = "";
11        mntput(mnt);
12    }

13    
14    return p;
15}


]]>
տ3
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>