其他分享
首页 > 其他分享> > 工信部ICP备案管理系统滑动验证码破解

工信部ICP备案管理系统滑动验证码破解

作者:互联网

文章目录

1. 需求描述

​ ICP备案是指网站在信息产业部提交网站信息进行官方认可。对国内各大小网站(包括企业及个人站点)的严格审查工作,对于没有合法备案的非经营性网站或没有取得ICP许可证的经营性网站, 根据网站性质,将予以罚款,严重的关闭网站,以此规范网络安全,打击一切利用网络资源进行不法活动的犯罪行为。

​ 可以通过工信部政务服务平台-ICP/IP地址/域名信息备案管理系统查询ICP备案信息, 如下图

ICP备案信息查询

页面展示了ICP备案主体信息ICP备案网站信息, 我们尝试采集该页面数据。

查询时滑块验证

2. 抓包分析

  1. 获取滑块配置信息

    链接:https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImage

    请求信息:
    getCheckImage页面请求
    返回信息(由于返回的内容过长,这里提供截图):
    getCheckImage结果

    • 该链接请求头有个token参数,看着像一个加密的字符串,先记录下。
  2. 验证滑块结果

    链接:https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage

    请求信息:
    /checkImage页面验证滑块结果

    返回内容:

      {"code":200,"msg":"操作成功","params":"eyJ0eXBlIjozLCJleHREYXRhIjp7InZhZnljb2RlX2ltYWdlX2tleSI6ImJjNjUxNWU0LTNlZDUtNGMxMy05MDU4LTkzNDlmMjg3NTFiNyJ9LCJlIjoxNjA2ODA5MTk2NjI0fQ.gcJqYl2S9e995dStmYsKhh5dBcyWFIsZ0X-Y6t3Oo4o","success":true}```
    
    • 该请求的请求头依然有token参数,且和链接1的请求头中的值保持一致
    • 该请求的参数中,key的值,跟链接1返回结果的uuid一致,value值未知。
    • 这一步是用来验证滑块的滑动结果,按以往研究极验滑块的经验来看,这里应该写入的有滑动路径参数,但是很明显value不是路径参数,跟路径相关的,除了滑动路径外,很容易想到的是滑动的长度,猜测value的值为滑动的距离,单位是’px’,当然这个猜想稍后会进行验证。
    • 正由于没有像极验滑块那种加入路径参数,才让这个破解难度大大的降低,也为后续继续研究提供了动力
  3. 滑块验证通过,获取ICP信息

    链接:https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition

    请求信息:
    queryByCondition页面展示ICP查询信息

    返回结果:

     {"code":200,"msg":"操作成功","params":{"endRow":0,"firstPage":1,"hasNextPage":false,"hasPreviousPage":false,"isFirstPage":true,"isLastPage":true,"lastPage":1,"list":[{"contentTypeName":"","domain":"baidu.com","domainId":10000245113,"homeUrl":"www.baidu.com","leaderName":"","limitAccess":"否","mainId":282751,"mainLicence":"京ICP证030173号","natureName":"企业","serviceId":282911,"serviceLicence":"京ICP证030173号-1","serviceName":"百度","unitName":"北京百度网讯科技有限公司","updateRecordTime":"2020-11-13 09:30:49"}],"navigatePages":8,"navigatepageNums":[1],"nextPage":1,"pageNum":1,"pageSize":10,"pages":1,"prePage":1,"size":1,"startRow":0,"total":1},"success":true}
    
    • 该请求的请求头依然有token参数,且和前两个链接请求头的token值一致
    • 请求头多了sign参数,不难发现,该sign的值,正是第二步返回结果json中键params的值
    • 请求头中还多一个uuid参数,对比发现,正式链接1返回结果的uuid

3. token参数破解

4. value分析

value参数,是在抓包分析第二步的时候需要写入的参数,开始想通过全局搜索的方式搜索value来找到有价值的代码段,但是搜索发现太多文件和代码片段包含value关键字,此时换个思路,请求的链接为https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage,尝试搜索checkImage关键字,看看会不会有什么发现

5. 带缺口的滑动验证码图片获取

抓包分析的第一步是获取滑块验证码的配置信息,其返回值是一个json,记做res, 我们发现res.params 有键 “bigImage”,这很容联想到,这个键对应的值应该为带缺口的图片地址,分析网络请求也能发现,有个请求的缩略图,很像是滑块的大图,对比其链接和 "bigImage"的值发现,请求的链接为“data:text/javascript;base64,”+res.params.bigImage

请求中分析缺口图链接

观察其返回内容,却是一堆乱码

bigImage返回乱码

明明该请求的缩略图就是一个图像啊,为啥这里却反回一堆乱码,很苦恼,没有拿到预想的结果,此时,注意观察,该请求下面的连续两个请求,其缩略图也是图像,但是开头是以"data:Image/png;base64,“开头的,我尝试点进去一个链接,发现其返回的是一张图片

返回图像

那我想着是不是请求的链接由“data:text/javascript;base64,”+res.params.bigImage换成“data:Image/png;base64,”+res.params.bigImage就能获取到图片了? 抱着试一试的态度,发现真的返回了图片

成功获取大图

我们还能通过同样的方式获取缺口图片,对应的链接为“data:Image/png;base64,”+res.params.smallImage

当然,如果你知识和经验足够丰富的话,res.params.bigImage其实是对应图片的base64编码,要将base64编码转回图片,大概有两种方式,一种就是前面提到的, 使用浏览器请求页面“data:Image/png;base64,”+图片base64编码可获取图片,另外一种相对更简单些,直接对编码进行解码,就能获取图片,对应的python代码为

def base642pic():
    base64str = "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAA0JCgsKCA0LCgsODg0PEyAVExISEyccHhcgLikxMC4pLSwzOko+MzZGNywtQFdBRkxOUlNSMj5aYVpQYEpRUk//2wBDAQ4ODhMREyYVFSZPNS01T09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0//wAARCAC+AfQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaH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WA9KGA9KAJftXybahabdTcD0pVi/2jTATdTt7VIioOgpWA87pSAZvan7moUDf0qWWNA/Ao5iRq1MtIoHpUi0FD1WpVXbRHUjfcoAhaq7J5j1MxPrUa04ki7dtItIxPrTo6uQg+9UMsKtVPXNWOlRBli8x/XOP6Vy934j1SVceZHEP+ma4rKU+XoXGJ1Nz9mj+WWSNP96pI4YmTcvzq/8AFXETwtcAXAkYZ6qScUthrd9bRFIJMoOocA4+lRGs+qK9n5nbfZVorFhv0aJWmkufMIy21hjNFL6zHsRy+Z//2Q=="
    with open('bigImage.jpg','wb') as f:
        f.write(base64.b64decode(base64str))

代码将解码后的文本写入’bigImage.jpg’,执行成功会生成该文件,打开即为滑块的背景图

解密图片的base64编码获取图片

图片获取之后,只需要计算下缺口的位置就可以了,将计算出来的位置值赋值给value进行请求即可。这里并不打算讲图片缺口位置的计算,网上有很多方法,可以参考下,我们的重点是调试和分析该滑块验证码的破解。

6. 总结

通过上述分析,该网站验证码的破解过程大致为:

  1. 使用md5加密字符串 “testtest”+timeStamp(当前时间戳),获取authKey
  2. post方式请求链接https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth,参数为 {“authKey” : authKey,“timeStamp”: timeStamp}, 从结果中提取键 bussiness 的值,作为token,该token用以后续请求的请求头中
  3. post请求https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImage ,获取验证码配置信息,请求头中需添加token
  4. 从第3步的配置信息中,拿到验证码的uuid,以及对应的验证码图片并计算缺口位置,作为value的值
  5. post请求https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage,用以验证滑动结果,参数{“key”: uuid,“value”: 缺口位置},这两个参数值在第4步已获取。验证成功后,返回结果的取出键”params“的值,作为第6步请求头中的sign值,请求头中需添加token
  6. post请求https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition ,用于获取域名的icp备案信息,参数 {“pageNum”:"",“pageSize”:"",“unitName”:“baidu.com”},该请求头中除了token之外,还需要添加第5步拿到的sign值,以及第3步拿到的uuid

至此,完成了数据的获取,根据自己的需求,解析并保存即可。

标签:工信部,请求,滑块,验证码,value,token,参数,ICP,链接
来源: https://blog.csdn.net/SpiritedAway1106/article/details/110480146