📄 crack.examples.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Examples</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="crack.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.crack.html">Crack Functions</a></div> <div class="up"><a href="book.crack.html">Crack</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <p class="para"> This example shows how to open a CrackLib dictionary, test a given password, retrieve any diagnostic messages, and close the dictionary. <div class="example"> <p><b>Example #1 CrackLib example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Open CrackLib Dictionary<br /></span><span style="color: #0000BB">$dictionary </span><span style="color: #007700">= </span><span style="color: #0000BB">crack_opendict</span><span style="color: #007700">(</span><span style="color: #DD0000">'/usr/local/lib/pw_dict'</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">'Unable to open CrackLib dictionary'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Perform password check<br /></span><span style="color: #0000BB">$check </span><span style="color: #007700">= </span><span style="color: #0000BB">crack_check</span><span style="color: #007700">(</span><span style="color: #0000BB">$dictionary</span><span style="color: #007700">, </span><span style="color: #DD0000">'gx9A2s0x'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Retrieve messages<br /></span><span style="color: #0000BB">$diag </span><span style="color: #007700">= </span><span style="color: #0000BB">crack_getlastmessage</span><span style="color: #007700">();<br />echo </span><span style="color: #0000BB">$diag</span><span style="color: #007700">; </span><span style="color: #FF8000">// 'strong password'<br /><br />// Close dictionary<br /></span><span style="color: #0000BB">crack_closedict</span><span style="color: #007700">(</span><span style="color: #0000BB">$dictionary</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <blockquote><p><b class="note">Note</b>: If <a href="function.crack-check.html" class="function">crack_check()</a> returns <b><tt>TRUE</tt></b>, <a href="function.crack-getlastmessage.html" class="function">crack_getlastmessage()</a> will return 'strong password'. <br /> </p></blockquote></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="crack.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.crack.html">Crack Functions</a></div> <div class="up"><a href="book.crack.html">Crack</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -