資源描述:
《解析圖片驗(yàn)證碼 -- 可以破解ok卡網(wǎng)站的驗(yàn)證碼》由會(huì)員上傳分享,免費(fèi)在線(xiàn)閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、解析圖片驗(yàn)證碼--可以破解OK卡網(wǎng)站的驗(yàn)證碼文章分類(lèi):Java編程1,生成圖片請(qǐng)參照http://tristan-s.iteye.com/admin/blogs/10263072,目前只能解析沒(méi)有干擾素的數(shù)字圖片。例如:去除干擾素,可以用以下算法a>線(xiàn)條的:檢查該線(xiàn)條是否是貫通的直線(xiàn)條,如是則去掉b>點(diǎn):檢查該點(diǎn)是否是孤立的,如是則去掉3,需要將圖片中的數(shù)字用0,1的形式來(lái)表達(dá)。解析每個(gè)數(shù)字,見(jiàn)附件4,代碼Java代碼?1.import?java.awt.image.BufferedImage;??2.import?java
2、.io.File;??3.??4.import?javax.imageio.ImageIO;??5.??6.public?class?ImageDemo?{??7.??????8.????public?static?String?parse(BufferedImage?img){??9.????????int?width?=?img.getWidth();??10.????????int?height?=?img.getHeight();??11.??12.????????StringBuilder?sb?=?new?Str
3、ingBuilder();??13.??14.????????for?(int?j?=?0;?j?>?16)?&?0xff;??18.????????????????if?(red?100)?{??19.??????????
4、??????????sb.append("1");??20.????????????????}?else?{??21.????????????????????sb.append("0");??1.????????????????}??2.????????????}??3.????????}??4.??????????5.????????String?s?=?sb.toString();??6.????????String?s2?=?s;??7.//??????System.out.println("圖片的String碼:?"
5、?+?s);??8.//??????System.out.println("--------------");??9.//??????for?(int?i?=?0;?i?
6、6.??????17.????public?static?void?calResult(String?s){??18.????????if(s.indexOf(n0)>=0){??19.????????????System.out.print("?0");??20.????????}else?if(s.indexOf(n1)>=0){??21.????????????System.out.print("?1");??22.????????}else?if(s.indexOf(n2)>=0){??23.????????????
7、System.out.print("?2");??24.????????}else?if(s.indexOf(n3)>=0){??25.????????????System.out.print("?3");??26.????????}else?if(s.indexOf(n4)>=0){??27.????????????System.out.print("?4");??28.????????}else?if(s.indexOf(n5)>=0){??29.????????????System.out.print("?5");??
8、30.????????}else?if(s.indexOf(n6)>=0){??31.????????????System.out.print("?6");??32.????????}else?if(s.indexOf(n7)>=0){??33.????????????System.out