论坛首页 Java企业应用论坛

使用谷歌的kaptcha验证码被破解了

浏览 41713 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-05-23  

     近期网站当中用用户投票页面用到验证码,但是通过后台的日志观测到发现了很多的非法投票用户,结果是验证码被破解了,kaptcha验证码毕竟是扩展了simpleCaptcha由谷歌开源的,难道谷歌的玩意这么不靠谱,以前听说过微软和谷歌的kaptcha被人破解过,目前来说ocr的识别图片的成功率只能是一般,复杂点的图片识别率不高,噪点和文字扭曲基本上能绕过,如果是文字出现重叠的话基本上不能被破解,另外中文应该也能增加破解的难度,但是用户体验不够优雅,群里的牛人有没有牛逼一点的验证码,最好有文字能够重叠的验证码?求验证码方面的兄弟给点意见,附图我们的验证码

  • 大小: 4.4 KB
   发表时间:2011-05-23  
这个也太好识别了吧
0 请登录后投票
   发表时间:2011-05-23  
原来是虾米啊.....隐藏得那么深.
生产的时候调整下每个字符的位置,就重叠咯.再加几条WS的干扰线。
0 请登录后投票
   发表时间:2011-05-23  
有更好的解决方案吗,加重叠和噪点我都知道
0 请登录后投票
   发表时间:2011-05-23  
尝试 更改字体颜色 和 扭曲 字的倾斜度 和位置呢!
0 请登录后投票
   发表时间:2011-05-23  
啥,你不会问丫中国第一个封建王朝是啥之类的问题吗?
0 请登录后投票
   发表时间:2011-05-23  
你这是谷歌的?
为何和gmail的验证码不同?
0 请登录后投票
   发表时间:2011-05-23   最后修改:2011-05-23
整中文的?

话说人人网的中文验证码才叫一绝啊,不知道有兄弟能不能搞到。

public class ChineseText extends Configurable implements TextProducer {

	public String getText() {
		int length = getConfig().getTextProducerCharLength();
		char[] chars = getConfig().getTextProducerCharString();
		String finalWord = "", firstWord = "";
		String[] array = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
				"a", "b", "c", "d", "e", "f" };

		Random rand = new Random();

		for (int i = 0; i < length; i++) {
			switch (rand.nextInt(3)) {
			case 1:
				firstWord = String.valueOf(chars[rand.nextInt(chars.length)]);
				break;
			case 2:
				int r1,
				r2,
				r3,
				r4;
				String strH,
				strL;// high&low
				r1 = rand.nextInt(3) + 11; // 前闭后开[11,14)
				if (r1 == 13) {
					r2 = rand.nextInt(7);
				} else {
					r2 = rand.nextInt(16);
				}

				r3 = rand.nextInt(6) + 10;
				if (r3 == 10) {
					r4 = rand.nextInt(15) + 1;
				} else if (r3 == 15) {
					r4 = rand.nextInt(15);
				} else {
					r4 = rand.nextInt(16);
				}

				strH = array[r1] + array[r2];
				strL = array[r3] + array[r4];

				byte[] bytes = new byte[2];
				bytes[0] = (byte) (Integer.parseInt(strH, 16));
				bytes[1] = (byte) (Integer.parseInt(strL, 16));

				try {
					firstWord = new String(bytes, "GB2312");
				} catch (UnsupportedEncodingException e) {
					e.printStackTrace();
				}
				break;
			default:
				firstWord = String.valueOf(chars[rand.nextInt(chars.length)]);
				break;
			}
			finalWord += firstWord;
		}
		return finalWord;
	}



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
	<!-- 验证码 -->
	<bean id="captchaProducer" class="com.google.code.kaptcha.impl.DefaultKaptcha">
		<property name="config">
			<bean class="com.google.code.kaptcha.util.Config">
				<constructor-arg>
					<props>
						<prop key="kaptcha.textproducer.font.color">blue</prop>
						<prop key="kaptcha.noise.color">blue</prop>
						<prop key="kaptcha.border">no</prop>
						<prop key="kaptcha.textproducer.char.space">4</prop>
						<prop key="kaptcha.textproducer.impl">com.web.ChineseText</prop>
						<prop key="kaptcha.textproducer.font.names">宋体,楷体,微软雅黑</prop>
					</props>
				</constructor-arg>
			</bean>
		</property>
	</bean>
</beans>

  • 大小: 3.4 KB
  • 大小: 3.8 KB
0 请登录后投票
   发表时间:2011-05-23  
1、验证码使用问问题填答案的方式,比如验证码为一个简单的数学运算,让用户填写结果等;
2、使用动态图片作为验证码,验证码内容是浮动的;
0 请登录后投票
   发表时间:2011-05-23  
volking 写道
你这是谷歌的?
为何和gmail的验证码不同?

是谷歌的,但是没加一些参数设置
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics