?? hougnt.html
字號(hào):
<ul id="tbUserBar">
<li><a href="http://www.baidu.com/">百度首頁(yè)</a> | </li>
<li>
<script>
res_str="http://passport.baidu.com/?reg&tpl=tb&u="+escape(window.location.href)+"&aid=6";
login_str="http://passport.baidu.com/?login&tpl=tb&u="+escape(window.location.href)+"&aid=6";
document.write("<a href=\""+login_str+"\" >登錄</a>");
</script>
</li>
</ul>
</div>
<form name=f1 onSubmit="return gowhere(this)" action=/f>
<input type=hidden name=ct value=352321536>
<input type=hidden name=tn value=baiduPostSearch>
<input type=hidden name=rn value=10>
<input type=hidden name=pn value=0>
<input type=hidden name=lm value=65536>
<input type=hidden name=sc value="">
<input type=hidden name=kw value="">
<input type=hidden name=rs2 value="0">
<input name=myselectvalue type=hidden value=1>
<table border="0" cellpadding="0" cellspacing="0" style="margin-bottom:8px;margin-left:8px;width:90%">
<tr><td width="146" valign="top"><a href="http://tieba.baidu.com/"><img src="http://img.baidu.com/img/post-jg.gif" border="0" vspace="3" style="margin-right:9px" alt="到百度貼吧首頁(yè)"></a></td>
<td valign="top">
<div class="hdch"><a href="http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=03網(wǎng)絡(luò)&t=52" class="top">新聞</a> <a class="top" href="http://www.baidu.com/s?cl=3&wd=03網(wǎng)絡(luò)&t=52">網(wǎng)頁(yè)</a> <span class="fB">貼吧</span> <a class="top" href="http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=03網(wǎng)絡(luò)&t=52">知道</a> <a class="top" href="http://mp3.baidu.com/m?tn=baidump3&ct=134217728&lm=-1&word=03網(wǎng)絡(luò)&t=52">MP3</a> <a class="top" href="http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word=03網(wǎng)絡(luò)&t=52">圖片</a> <a href="http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=21&word=03網(wǎng)絡(luò)">視頻</a> <a class="top" href="http://baike.baidu.com/w?ct=17&lm=0&tn=baiduWikiSearch&pn=0&rn=10&word=03網(wǎng)絡(luò)&submit=search&t=52">百科</a></div>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td valign="top"><input class="i" maxlength=256 size=47 value="03網(wǎng)絡(luò)" name=word> <input name="submit" type=submit value="百度一下"></td><td nowrap> <a href="/f?ct=486539264&cm=58565&tn=bdAdvSearch&word=03網(wǎng)絡(luò)">吧內(nèi)搜索</a> | <a href="http://www.baidu.com/search/post.html" target=_blank>幫助</a></td></tr></table>
<label for="jointb"><input type="radio" name="tb" checked onClick="document.f1.myselectvalue.value=1;document.f1.rs2.value=0" id="jointb">進(jìn)入貼吧</label>
<label for="searchtb"><input type="radio" name="tb" onClick="document.f1.myselectvalue.value=0;document.f1.rs2.value=1" id="searchtb">貼子搜索</label>
<label for="authortb"><input type="radio" name="tb" onClick="document.f1.myselectvalue.value=2;document.f1.rs2.value=2" id="authortb">按作者搜索</label>
</td></tr></table>
</form>
<div style="margin:0 0 5px 8px;width:84%"><script>if(!g_f_js){var g_f_js=true;document.write('<script src=\'http://eiv.baidu.com/other/ff.js\'></'+'script>');}</script>
<script>if (typeof(cf)=="function") {cf("http://eiv.baidu.com/mc_files/20090324/20090324163027_80915000T1T396856.swf","760","90","http://ma.baidu.com/ma/rcv/click.php?t=uv-b5HDhTv-b5Hc1rjbYFMIGujYkFhVGujYkFhqsULnqniuhUWdAULFdUiudThsqpZwYTaR1fiRzwBRzwMILIz4CIy-4Iy78QhPEUi4WUBRzwBu1UWYLnzu15H0kPAn3mHPhmWR4PvmvrHDhTMKET1YkFhwY5y4cm17zpbfkThGhny3s","0");}</script>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td nowrap> <a href="/" >百度貼吧</a> > <a href="/f?kw=03%CD%F8%C2%E7" ><cb>03網(wǎng)絡(luò)</cb>吧</a> > 瀏覽貼子</td>
<td align="right" nowrap>吧主:<a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=shen%BD%A3" target=_blank>shen劍</a> <a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=z%C2%EAx%D1%C5y" target=_blank>z瑪x雅y</a> </td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#0000cc">
<tr>
<td nowrap>
<a href="http://cang.baidu.com/do/add" onClick="window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title)+'&iu='+encodeURIComponent(location.href)+'&tn=%E8%B4%B4%E5%90%A7%E8%B4%B4%E5%AD%90%2C&fr=tb#nw=1','_s','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes'); return false;" target="_blank" class="n">添加到搜藏</a>
<FONT color=#ffffff>|</FONT>
<a href="#sub" onClick=" ResetReplyTitle('','');" class="n">快速回復(fù)</a> </td>
<td align="right" nowrap>
<a class=n href="/tousu/new/add?pbtitle=%CD%E6%D7%AA%B0%D9%B6%C8%28%D7%AA%A3%A9" target=_blank>貼吧投訴</a>
</td>
</tr>
</table>
<table border="0" align=right cellpadding=0 cellspacing=0 id="rightAd">
<tr>
<td style="padding-top:10px;padding-right:3px;">
<script>if(!g_f_js){var g_f_js=true;document.write('<script src=\'http://eiv.baidu.com/other/ff.js\'></'+'script>');}</script><table border=0 cellpadding=0 cellspacing=0><tr><td>
<script>if (typeof(cf)=="function") {cf("http://eiv.baidu.com/mc_files/20090323/20090323165730_56918400T1T396485.swf","224","240","http://ma.baidu.com/ma/rcv/click.php?t=uv-b5HDhTv-b5Hc1rjRdFMIGujYkFhVGujYzFhqsULnqnBuhUWdAULFdUiudThsqpZwYTaR1fiRzwBRzwM-dUAR8mh7GuZR8mvqVFHFAXMf-nbu1pAqLFHFAXy-8XgN-Tv9GIA-8udtvnZGCULN8py78FHFApy4bug68pZwVUau1UWYzPau15H0kPAn3mHPhmWR4PvmvrHDhTMKET1YkFhwY5y4cm17zpbfkThGhny3s","1");}</script>
</td></tr></table>
<div class="cpro_post" id="cproshow"></div>
</td></tr>
</table>
<table width="72%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="pg" style="padding-left:30px;padding-top:10px;padding-bottom:10px;"><div style="float:left;margin:5px 0 10px 0;">共有<font color="#ff0000">3</font>篇貼子 </div><div style="float:left;margin-top:1px"></div></td>
</tr>
</table>
<a name="#1"></a>
<table width="72%" border="0" bgcolor="#FFFFFF">
<tr>
<td height="17" align="center" width="3%" class="gray">1</td>
<td class="p14" align=left >
<a name="1920213202"></a>
<font color=#0000cc>玩轉(zhuǎn)百度(轉(zhuǎn)) </font>
</td></tr>
<tr><td></td>
<td align=left width="97%" >
<table class="wr" border="0" cellspacing="0" cellpadding="0"><tr><td class="gray14">
<cc>百度,作為國(guó)內(nèi)搜索引擎的大戶,為了進(jìn)一步擴(kuò)大自己的用戶群,專門開(kāi)設(shè)了“百度貼吧”(2003年11月百度貼吧 (<a href="http://post.baidu.com)" target="_blank">http://post.baidu.com)</a>自從誕生以來(lái)逐漸成為世界最大的中文交流平臺(tái)!當(dāng)用戶在百度搜索引擎中搜索出需要搜索的關(guān)鍵字,點(diǎn)擊“貼吧”即可進(jìn)入以關(guān)鍵字為專題的相應(yīng)貼吧)的服務(wù)。操作簡(jiǎn)單而又針對(duì)性,這是貼吧火極一時(shí)的重要原因,可正因?yàn)槿绱耍俣荣N吧的安全性又怎么樣呢?這就是我們今天探討的話題!
<br>相信大家都有在論壇灌水的經(jīng)歷吧?但是如果你連續(xù)發(fā)表統(tǒng)一內(nèi)容的東西在論壇中,不久論壇的整個(gè)板塊就全是你發(fā)表的信息了,其他信息全被擠在了后面。假設(shè)你發(fā)表的信息夠多,版主都刪不完時(shí),那么這個(gè)論壇基本就報(bào)廢了!其他的商業(yè)論壇也意識(shí)到了防止惡意灌水的重要性,紛紛使用了一些防止惡意灌水的措施,有發(fā)貼間隔時(shí)間的限制、同一IP地址的發(fā)貼數(shù)限制、內(nèi)容不能重復(fù)等,但是這些都不是今天的重點(diǎn),由于百度使用的是一個(gè)公用發(fā)貼表單,允許匿名發(fā)帖,需要突破唯一的難點(diǎn)是驗(yàn)證碼。(為了防止某個(gè)黑客對(duì)某一個(gè)特定注冊(cè)用戶用特定程序暴力破解方式進(jìn)行不斷的登陸嘗試或是防止不斷提交某網(wǎng)絡(luò)信息而采用的一種網(wǎng)絡(luò)通行方式。隨機(jī)生成字符信息放入圖片中,防止計(jì)算機(jī)直接識(shí)別。比如招商銀行的網(wǎng)上個(gè)人銀行,騰訊的QQ社區(qū)等等)
<br>這時(shí)驗(yàn)證碼在整個(gè)系統(tǒng)中就扮演了了一個(gè)至關(guān)重要的角色。如果我們能突破它,寫一個(gè)自動(dòng)發(fā)布的程序,那么我們來(lái)算一算:假設(shè)每?jī)擅氤绦騪ost一次,一分鐘就是30次、 一小時(shí)就有30×60=1800次、 一天就有1800×24=43200次!如果我們把發(fā)貼程序或是密碼窮舉程序掛在很多肉雞上,進(jìn)行同時(shí)工作,那么結(jié)果可想而知!筆者曾親目睹過(guò)國(guó)內(nèi)某著名安全論壇就是驗(yàn)證碼被人破解,導(dǎo)致被人惡意灌水,最后完全崩潰!當(dāng)然還有某網(wǎng)絡(luò)銀行也因此類原因?qū)е掠脩裘艽a被盜等眾多事件。筆者也作如下聲明:下文介紹的方法并不是有意針某公司或是某機(jī)構(gòu),只是作為技術(shù)交流,如果部分讀者利用本文介紹的方法進(jìn)行破壞或是窮舉他人密碼,這已經(jīng)違法了法律,那么責(zé)任由他自己承擔(dān),與筆者無(wú)關(guān)!
<br>好了,我們可以進(jìn)入正題了(以下出現(xiàn)的代碼為delphi寫的部分源碼,為了防止任意利用,我以介紹方法為主,如果讀者感興趣,可以自己組合編寫完整,在本文附帶的程序中,筆者提供了一個(gè)驗(yàn)證碼參數(shù)確定程序(附源碼))。驗(yàn)證碼分為如下幾類:數(shù)字型、字符型、符號(hào)型、綜合型。
<br>我們看了看百度貼吧的驗(yàn)證碼如圖: 是屬于數(shù)字型的!不過(guò)其圖片中生成了不少彩色和黑白的噪音點(diǎn)(指驗(yàn)證圖片上的斑點(diǎn))。那么我們應(yīng)該怎么去識(shí)別呢?傳統(tǒng)的驗(yàn)證碼識(shí)別方式很簡(jiǎn)單,由于數(shù)字的位置是固定的,所以我們只需要提取每一幅數(shù)字的圖片(沒(méi)有噪音點(diǎn)的)然后把每一個(gè)特殊數(shù)字獨(dú)有的象素位置記錄下來(lái),然后在網(wǎng)絡(luò)上提取需要破解的特征碼,祛除噪音點(diǎn),對(duì)其位置和記錄位置進(jìn)行比對(duì),那就是么就能確定相應(yīng)的數(shù)字了。
<br>總結(jié)一下傳統(tǒng)的就是:
<br>1.先分析驗(yàn)證碼,前景顏色是否不定
<br>2.然后把驗(yàn)證碼的寬度/驗(yàn)證碼文字個(gè)數(shù),比如一驗(yàn)證碼下載后寬度為60,有4個(gè)數(shù)字,那么就60/4=15,然后保存每個(gè)字,如果只有數(shù)字保存0-9數(shù)字到位圖文件,如果英文那更麻煩點(diǎn),0-9,A-Z都要保存到位圖,位圖的前景色都不變,保持一種顏色,背景隨便你改不改
<br>3.如果前景要變則將文字統(tǒng)一為同種顏色,每個(gè)數(shù)字0-9的點(diǎn)陣都有個(gè)公共點(diǎn),取該公共點(diǎn)顏色然后把前景全部統(tǒng)一成一種顏色,比如白色{255,255,255},位圖的結(jié)構(gòu)是BGR,而不是RGB
<br>4.然后進(jìn)行比較,如果驗(yàn)證碼的一點(diǎn)為白色,第2步保存的位圖同一點(diǎn)也是白色,那么頻率增加1
<br>5.最后頻率最高的就是驗(yàn)證碼了!
<br>可是這種傳統(tǒng)的識(shí)別方法卻遇到了挑戰(zhàn)!如果圖片數(shù)字的位置也是隨機(jī)出現(xiàn),大小也是隨機(jī)出現(xiàn),那么這種識(shí)別方法也就失效了,百度貼吧的就是這樣的驗(yàn)證碼。
<br>筆者這里向大家引入一個(gè)專有名詞:“hough變換”也許學(xué)習(xí)計(jì)算機(jī)圖像學(xué)的朋友知道,筆者還是簡(jiǎn)要介紹一下:
<br></cc>
</td></tr></table>
</td></tr>
<tr><td height="17"></td><td class="p14"></td></tr>
<tr><td height="17"></td>
<td align=left class="au"><div class="uau">作者:<a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=z%C2%EAx%D1%C5y" target=_blank>z瑪x雅y</a> </div><script>document.write("<div class=shi id=p_youa_"+(hiID)+"> </div><div class=auw id=p_hi_"+(hiID++)+" value='z瑪x雅y'></div>");</script><div class="uau">
<font class="gray12"> 2007-5-25 16:07 </font>
<input type=hidden id="hTitle_1" value="玩轉(zhuǎn)百度(轉(zhuǎn))"><a href="#sub" class=t onclick="ResetReplyTitle('1','hTitle_1');">回復(fù)此發(fā)言</a>
</div></td></tr>
<tr><td></td><td><hr class="fenge" align=left width="87%" size=1 >
</td>
</tr></table><a name="#2"></a>
<table width="72%" border="0" bgcolor="#FFFFFF">
<tr>
<td height="17" align="center" width="3%" class="gray">2</td>
<td class="p14" align=left >
<a name="1920213203"></a>
<font color=#0000cc>玩轉(zhuǎn)百度(轉(zhuǎn)) </font>
</td></tr>
<tr><td></td>
<td align=left width="97%" >
<table class="wr" border="0" cellspacing="0" cellpadding="0"><tr><td class="gray14">
<cc>直線hough變換:直線Hough變換利用圖像空間和Hough參數(shù)空間的點(diǎn)-線對(duì)偶性,把圖像空間中的檢測(cè)問(wèn)題轉(zhuǎn)換到參數(shù)空間。通過(guò)在參數(shù)空間里進(jìn)行簡(jiǎn)單的累加統(tǒng)計(jì),然后在Hough參數(shù)空間尋找累加器峰值的方法檢測(cè)直線。例如,圖1(a)中的九條線段對(duì)應(yīng)于如圖1(b)所示的其Hough參數(shù)空間的九個(gè)累加器峰值。圖1(b)中,Hough參數(shù)空間的橫縱坐標(biāo)分別為直線極坐標(biāo)方程:ρ=x×cos(θ) + y×sin(θ) 的兩個(gè)參數(shù)ρ和θ。九個(gè)峰值的ρ和θ值唯一的確定其對(duì)應(yīng)線段所在直線的兩個(gè)參數(shù)。并且線段的長(zhǎng)度決定坐標(biāo)(ρ,θ)處的累加值的大小。
<br>1(a)
<br>1(b)
<br>沒(méi)有明白的讀者可以多讀兩遍(數(shù)學(xué)啊數(shù)學(xué)!),還是比較好理解。其實(shí)講通俗一點(diǎn),就是我們只要利用這個(gè)方程ρ=x×cos(θ) + y×sin(θ)統(tǒng)計(jì)出ρ出現(xiàn)的次數(shù),就可以確定一條直線,比如說(shuō)圖片中我們計(jì)算出了某個(gè)方向(θ的大?。┑摩殉霈F(xiàn)次數(shù)的最大值,那么這就是這個(gè)方向最長(zhǎng)的直線了!
<br>好了,知道了hough變換檢測(cè)直線的原理,那么我們就來(lái)寫段代碼
<br>var
<br>p: PByteArray;
<br>Gray, x, y,i1,i2: Integer;
<br>Bmp: TBitmap;
<br>begin
<br>listbox1.Clear;
<br>listbox2.Clear;
<br>Bmp := TBitmap.Create;
<br>Bmp.Assign(Image2.Picture.Bitmap);
<br>//設(shè)置為24位真彩色
<br>Bmp.PixelFormat := pf24Bit;
<br>randomize;
<br>for y := 0 to Bmp.Height - 1 do
<br>begin
<br>p := Bmp.scanline[y];
<br>for x := 0 to Bmp.Width - 1 do
<br>begin
<br>//一個(gè)象素點(diǎn)三個(gè)字節(jié)
<br>Gray := Round(p[x * 3 + 2] * 0.3 + p[x * 3 + 1] * 0.59 + p[x
<br>* 3] * 0.11);
<br>if gray > 128 then //全局閥值128
<br>begin
<br>end
<br>else
<br>begin
<br>i1:=x;//表示檢測(cè)的θ為0度
<br>i2:=y; //表示檢測(cè)的θ為90度
<br>ListBox1.Items.Add(inttostr(i1));//用于日后算出現(xiàn)的次數(shù),當(dāng)然也可以用數(shù)組!
<br>ListBox2.Items.Add(inttostr(i2));
<br>end;
<br>end;
<br>end;
<br>Image2.Picture.Bitmap.Assign(Bmp);
<br>Bmp.Free;
<br>這段代碼的意思就是檢測(cè)圖片0度和90度的直線。
<br>
<br>現(xiàn)在我們就說(shuō)說(shuō)具體操作了。先得到一幅驗(yàn)證碼圖片,這個(gè)得到的方法有很多,我建議用屏幕指定位置抓圖來(lái)實(shí)現(xiàn),然后保存成BMP格式,進(jìn)行圖像的二值化處理。二值化處理就是把圖片轉(zhuǎn)換成兩種顏色,不過(guò)需要設(shè)置一個(gè)適當(dāng)?shù)拈y值(由于24位圖的一個(gè)點(diǎn)是由RGB3個(gè)顏色分量來(lái)控制,那么我們得到這3個(gè)分量的值后除以3就是閥值了),這樣才能起到祛除部分噪音的效果。我們假設(shè)閥值為128 現(xiàn)在我們看看這段代碼
<br>var
<br>p: PByteArray;
<br>Gray, x, y: Integer;
<br>Bmp: TBitmap;
<br>begin
<br>Bmp := TBitmap.Create;
<br>Bmp.Assign(Image1.Picture.Bitmap);
<br>//設(shè)置為24位真彩色
<br>Bmp.PixelFormat := pf24Bit;
<br>randomize;
<br>for y := 0 to Bmp.Height - 1 do
<br>begin
<br>p := Bmp.scanline[y];
<br>for x := 0 to Bmp.Width - 1 do
<br>begin
<br>//一個(gè)象素點(diǎn)三個(gè)字節(jié)
<br>Gray := Round(p[x * 3 + 2] * 0.3 + p[x * 3 + 1] * 0.59 + p[x
<br>* 3] * 0.11);
<br>if gray > 128 then //全局閥值128
<br>begin
<br>p[x * 3] := 255;
<br>p[x * 3 + 1] := 255;
<br>p[x * 3 + 2] := 255;
<br>end
<br>else
<br>begin
<br>p[x * 3] := 0;
<br>p[x * 3 + 1] := 0;
<br>p[x * 3 + 2] := 0;
<br>end;
<br>end;
<br>end;
<br>Image2.Picture.Bitmap.Assign(Bmp);
<br>Bmp.Free;
<br>這樣我們就得到了一幅二值化的BMP。
<br>得到這副圖后,我們需要對(duì)圖像進(jìn)行分割,就是把它變成4個(gè)小位圖,分別裝入4個(gè)數(shù)字。分割算法很簡(jiǎn)單,因?yàn)轵?yàn)證碼的數(shù)字位置左右跳動(dòng)幅度不大,源代碼就不再給出。
<br>然后我們要做的就是把這副圖進(jìn)行幾個(gè)方向的hough變換檢測(cè),由控制θ的角度來(lái)實(shí)現(xiàn),比如說(shuō)這個(gè) 這是數(shù)字3 我們可以看到它有什么特征沒(méi)有?它橫著由三橫組成,豎著由2豎組成!我們就規(guī)定 如果橫著有3條直線,豎著有兩條直線,那么這個(gè)數(shù)就是3了!所以我們只要用hough算子檢測(cè) 0 & 90 度就能確定橫豎有多少直線了,再看這個(gè) 這是數(shù)字1 我們就規(guī)定豎有一條最長(zhǎng)的直線,然而橫的直線如果不超過(guò)豎直線長(zhǎng)的1/2那么就是1了。其他數(shù)以此類推!
<br></cc>
</td></tr></table>
</td></tr>
<tr><td height="17"></td><td class="p14"></td></tr>
<tr><td height="17"></td>
<td align=left class="au"><div class="uau">作者:<a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=z%C2%EAx%D1%C5y" target=_blank>z瑪x雅y</a> </div><script>document.write("<div class=shi id=p_youa_"+(hiID)+"> </div><div class=auw id=p_hi_"+(hiID++)+" value='z瑪x雅y'></div>");</script><div class="uau">
<font class="gray12"> 2007-5-25 16:07 </font>
<input type=hidden id="hTitle_2" value="玩轉(zhuǎn)百度(轉(zhuǎn))"><a href="#sub" class=t onclick="ResetReplyTitle('2','hTitle_2');">回復(fù)此發(fā)言</a>
</div></td></tr>
<tr><td></td><td><hr class="fenge" align=left width="87%" size=1 >
</td>
</tr></table><a name="#3"></a>
<table width="72%" border="0" bgcolor="#FFFFFF">
<tr>
<td height="17" align="center" width="3%" class="gray">3</td>
<td class="p14" align=left >
<a name="1920213204"></a>
<font color=#0000cc>玩轉(zhuǎn)百度(轉(zhuǎn)) </font>
</td></tr>
<tr><td></td>
<td align=left width="97%" >
<table class="wr" border="0" cellspacing="0" cellpadding="0"><tr><td class="gray14">
<cc>當(dāng)然實(shí)際操作當(dāng)然沒(méi)有這么簡(jiǎn)單,因?yàn)檫€是有部分噪音點(diǎn)沒(méi)有祛除干凈,但是這的確說(shuō)明了我們的思想!所以每個(gè)數(shù)有需要準(zhǔn)備幾套特征編碼,如果出現(xiàn)多個(gè)數(shù),就看使用編碼數(shù)最多的數(shù)就是我們要識(shí)別的數(shù)了。最后就是統(tǒng)計(jì)了,統(tǒng)計(jì)函數(shù)我們現(xiàn)在給出
<br>function Repeatcount(s:string;d:string):integer;
<br>var i:integer;
<br>begin
<br>i:=0;
<br>while pos(d,s)>0 do
<br>begin
<br>i:=i+1;
<br>delete(s,pos(d,s),length(d));
<br>end;
<br>result:=i;
<br>end;
<br>利用這個(gè)函數(shù),我們就可以確定出現(xiàn)最多的p的次數(shù)以及使用編碼最多的次數(shù)了!筆者隨文附送了一個(gè)檢測(cè)0度和90度的檢測(cè)器,讀者可以多試幾次就明白了?。ㄈ鐖D)
<br>當(dāng)然只有這兩度檢測(cè)是遠(yuǎn)遠(yuǎn)不夠的,實(shí)際應(yīng)用中,可以使用0~90度中任意一度檢測(cè),比如說(shuō)7,它的豎由于不是90度的(直的)所以要用其他的度數(shù)來(lái)檢測(cè)! 這里也總結(jié)一下,任意數(shù)字,只要我們能得到相應(yīng)的特征,那么我們就可以對(duì)它進(jìn)行識(shí)別!
<br>總結(jié)一下創(chuàng)新的:
<br>1、 獲得圖片,進(jìn)行二值化的變換、祛除噪音。
<br>2、 分割圖像,保存成相應(yīng)的BMP文件。
<br>3、 對(duì)其進(jìn)行幾個(gè)方向的HOUGH變換檢測(cè),根據(jù)相應(yīng)的驗(yàn)證碼來(lái)定!
<br>(你也可以做更多的檢測(cè),比如有英文字母就需用到其他算法了?。?amp;nbsp;
<br>4、 對(duì)特征進(jìn)行統(tǒng)計(jì),得出識(shí)別結(jié)果。
<br>接下來(lái)要做的就是做個(gè)post程序了,這個(gè)太簡(jiǎn)單了,代碼你就自己寫吧!不過(guò)也要做到如下細(xì)節(jié):做成多線程程序進(jìn)行發(fā)貼,不然程序會(huì)失去響應(yīng)的。最好是可以導(dǎo)入大量的代理IP的,然后就是發(fā)貼的內(nèi)容最后加上幾個(gè)隨機(jī)字符,這樣可以防止重復(fù)貼的過(guò)濾!最重要的,只是做測(cè)試,發(fā)貼量不要太多、不要亂發(fā)廣告貼!
<br>所以說(shuō)再安全的驗(yàn)證碼也有軟肋,我們只要發(fā)現(xiàn)就可以找出其中的漏洞!當(dāng)然不只是針對(duì)百度,其他論壇的特征碼同樣能識(shí)別!當(dāng)然網(wǎng)絡(luò)安全技術(shù)也是雙刃劍,我這里再次強(qiáng)調(diào)!這種方法的確能識(shí)別很多重要的部門的一些關(guān)鍵驗(yàn)證碼,但是讀者如果使用其方法進(jìn)行破壞,那已經(jīng)違反了中華人民共和國(guó)的相關(guān)法律,是要付刑事責(zé)任的!并且與筆者無(wú)關(guān)!
<br>其實(shí)上述方法已經(jīng)不是只是對(duì)驗(yàn)證碼進(jìn)行識(shí)別了,完全可以用到現(xiàn)實(shí)生活中去,比如說(shuō)手寫體識(shí)別、車牌識(shí)別等等,但是現(xiàn)實(shí)生活中我們還要進(jìn)行更多的加工,比如說(shuō)圓形檢測(cè),多邊形檢測(cè)等等。所以說(shuō)從網(wǎng)絡(luò)安全技術(shù)中,也有很多東西能造福社會(huì),還等待我們繼續(xù)創(chuàng)造!</cc>
</td></tr></table>
</td></tr>
<tr><td height="17"></td><td class="p14"></td></tr>
<tr><td height="17"></td>
<td align=left class="au"><div class="uau">作者:<a href="http://passport.baidu.com/?detail&aid=6&default_tab=1&un=z%C2%EAx%D1%C5y" target=_blank>z瑪x雅y</a> </div><script>document.write("<div class=shi id=p_youa_"+(hiID)+"> </div><div class=auw id=p_hi_"+(hiID++)+" value='z瑪x雅y'></div>");</script><div class="uau">
<font class="gray12"> 2007-5-25 16:07 </font>
<input type=hidden id="hTitle_3" value="玩轉(zhuǎn)百度(轉(zhuǎn))"><a href="#sub" class=t onclick="ResetReplyTitle('3','hTitle_3');">回復(fù)此發(fā)言</a>
</div></td></tr>
<tr><td></td><td><hr class="fenge" align=left width="87%" size=1 >
</td>
</tr></table>
<table width="72%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="pg" style="padding-left:30px;padding-top:5px;padding-bottom:5px;">共有<font color="#ff0000">3</font>篇貼子 </td>
</tr>
<tr>
<td style="font-weight: bold; font-size: 14px; line-height: 30px; padding-left: 30px;">發(fā)表回復(fù)</td>
</tr>
</table>
<div style="width:80%;margin:0 0 0 26px;" id="subMsg">
<form id="post" name="post" action="/f" method="post" onSubmit="f_submit();return false">
<input type=hidden name=ct id=ct value=385875968>
<input type=hidden name=tn id=tn value=ajaxThreadSubmit>
<input type=hidden name=word id=word value="03網(wǎng)絡(luò)">
<input type=hidden name=lm id=lm value="1540688" >
<input type=hidden name=z id=z value="205306164" >
<input type=hidden name=sc id=sc value="3">
<input type=hidden name=cm id=cm value="0">
<input type=hidden name=rn id=rn value="823082264">
<input type=hidden name=bs id=bs value="313531353430363838393137393332313331393334343630343335303030303030303030303030303031323338313338343330CD8AF306E56354072B41D36F68D2170B">
<input type=hidden name=str2 id=str2 value="">
<input type=hidden name=rs3 id=rs3 value="0">
<input type=hidden name=str3 id=str3 value="4D5FBB1710EBE213764AA8EB90D4C9F0">
<input type=hidden name=str4 id=str4 value="39054602973299247240">
<input type=hidden name=bu id=bu value="">
<input type=hidden name=code id=code value="1">
<script language="Javascript">
document.getElementById("bu").value = window.location.href;
var postMsg =['',
'本吧目前僅限登錄用戶發(fā)貼,不能使用匿名發(fā)貼功能',
'抱歉,本吧目前僅限登錄用戶發(fā)貼',
'本吧目前僅限吧務(wù)團(tuán)隊(duì)及注冊(cè)滿一定時(shí)間的老用戶發(fā)貼,不能使用匿名發(fā)貼功能',
'抱歉,本吧目前僅限吧務(wù)團(tuán)隊(duì)及注冊(cè)滿一定時(shí)間的老用戶發(fā)貼',
'本吧目前僅限會(huì)員發(fā)貼,不能使用匿名發(fā)貼功能',
'抱歉,本吧目前僅限會(huì)員發(fā)貼',
'本吧目前僅限吧務(wù)團(tuán)隊(duì)發(fā)貼,不能使用匿名發(fā)貼功能',
'抱歉,本吧目前僅限吧務(wù)團(tuán)隊(duì)發(fā)貼',
'抱歉,本吧目前只能瀏覽,不能發(fā)貼'];
</script>
<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center class="f9" >
<tr>
<td valign="top" width=85 nowrap >標(biāo) 題:</td>
<td >
<input type="text" id="ti" name="ti" style="width:425px;" value="回復(fù):玩轉(zhuǎn)百度(轉(zhuǎn)) " onpropertychange="textCount(this,63)" onFocus="f_focus()">
<div id="tiError" class="postError"></div>
<input type="hidden" name="ti1" size="60" value="回復(fù):玩轉(zhuǎn)百度(轉(zhuǎn)) ">
</td>
<td rowspan="4" width=180 valign="top">
<div id="Tads" style="display:none"></div>
<script>
var f=false;
var h=false;
if(screen.width>800 &&
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -