苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 5998|回复: 1

[例子] 苹果网站预订页面验证码获取

[复制链接]
发表于 2013-9-21 19:31:30 | 显示全部楼层 |阅读模式
背景:在写一个iphone预订程序的时候,发现他的验证码是用base64编码进行传输的,在他的js文件里发现这些:
[code=javascript]
data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABGAKADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYW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gbJ5kgB4P8Atr6/hj86AU3RsGYnpHMTxJ/sNx+HP86AH/vt54iMpHI4xOv8wR+XNJ821MFFQHEbkDMJ6bT/AC/zmmfugjDy5AinLID80B9R7fT/ABp3y7/ubpGXpkbbhcdfTOOf/rUAKRId4MMZz/rYBj5/9pf/AK/pS5l3KRJGXI/dzcYcf3T/AD49PwqPMWxTmRUU4WUn5oT/AHT7fXP8qUhMyKYGyeZIAeD/ALa+v4Y/OgB3IQ/Iixg5ZPlzA3Xd6Y78/wD1qX99vPERlI5HGJ1/mCPy5pgKbo2DMT0jmJ4k/wBhuPw5/nSfugjDy5AinLID80B9R7fT/GgB/wA21MFFQHEbkDMJ6bT/AC/zmgiQ7wYYzn/WwDHz/wC0v/1/Sk+Xf9zdIy9MjbcLjr6Zxz/9am5i2KcyKinCyk/NCf7p9vrn+VAE5glDeWJm2gFkfPzL7H+8Of8APWk2TFQ5YYc7ZEBOOuNynqD3/wA5oooAXyrjcQJhvQAo5/iB7MPw6ikEUhCDeRHJzgNzGcZ+U+nsf/rUUUABWcK0m9S6cMv8Mgx3HY0pglDeWJm2gFkfPzL7H+8Of89aKKAE2TFQ5YYc7ZEBOOuNynqD3/zml8q43ECYb0AKOf4gezD8OooooAQRSEIN5EcnOA3MZxn5T6ex/wDrUFZwrSb1Lpwy/wAMgx3HY0UUAKYJQ3liZtoBZHz8y+x/vDn/AD1pNkxUOWGHO2RATjrjcp6g9/8AOaKKAF8q43ECYb0AKOf4gezD8OopBFIQg3kRyc4DcxnGflPp7H/61FFAAVnCtJvUunDL/DIMdx2NKYJQ3liZtoBZHz8y+x/vDn/PWiigBNkxUOWGHO2RATjrjcp6g9/85pfKuNxAmG9ACjn+IHsw/DqKKKAEEUhCDeRHJzgNzGcZ+U+nsf8A61BWcK0m9S6cMv8ADIMdx2NFFAH/2Q==
[/code]
从Base64String提取图片的话,需要Convert.FromBase64String()方法,实现代码
[code=csharp]
MemoryStream stream = new MemoryStream( Convert.FromBase64String( txtString.Text ) ); 
bitmap img = new Bitmap( stream ); 
img.Save( txtImg.Text ); 
MessageBox.Show( "Completed!" ); 
[/code]
这是第一次见到这种方式显示验证码的,记录下



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2013-9-22 09:11:10 | 显示全部楼层
这个方法不知道好还是不好,看上去感觉是还行,就是不知道会不会省流量,和Gzip比较怎么样?
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-12-23 19:16

© 2014-2021

快速回复 返回顶部 返回列表