使用 HttpWebRequest 获取 ReCaptcha
本文关键字:ReCaptcha 获取 HttpWebRequest 使用 | 更新日期: 2023-09-27 18:37:23
我已经在这个问题上工作了很长时间,似乎不可能通过 HttpWebRequest 获取 ReCaptcha
验证码示例:Rene-Server - TopList - 投票
验证码在这里生成
每次您访问此链接时,它都会产生新的挑战,我尝试先连接到该页面,然后将该数据输入"投票"页面,但您确实需要输入投票页面上显示的验证码。
下面的 url 将给出静态验证码:
http://www.google.com/recaptcha/api/image?c=CHALLANGE-ID-FROM-CAPTCHAGENERATE-HERE
例:
03AHJ_VuuUTviZ4Z12heHZwqqI9z7kfiW61C9gCjTo30uLLDMOhk2vHXI_k3uT88qHLCnQH6TgOe3lQF9oJDACGDQD0bKo--KpixmHzgyoiPpn1CGFCjk3dVQx5mmLPXS6sFe8vHRK3rUPj7Mk7ah5ZdKx8-clBamN1Tw1s4ceNTbxgGJg9D2pdJc)
我尝试向投票页面发出请求,然后从页面中获取源代码,但我没有发现任何有趣的内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" id="vbulletin_html">
<head>
<script type="text/javascript">
//<![CDATA[
window.__CF=window.__CF||{};window.__CF.AJS={"ga_key":{"ua":"UA-1653591-1","ga_bs":"2"}};
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
try{if (!window.CloudFlare) { var CloudFlare=[{verbose:0,p:1382465720,byc:0,owlid:"cf",bag2:1,mirage2:0,oracle:0,paths:{cloudflare:"/cdn-cgi/nexp/abv=2980380653/"},atok:"29553f6592ae5270a0c334d688d838b0",petok:"1b414fbbada58802b34de7cd1b5a5d39-1383129967-1800",zone:"rune-server.org",rocket:"0",apps:{"ga_key":{"ua":"UA-1653591-1","ga_bs":"2"}}}];var a=document.createElement("script"),b=document.getElementsByTagName("script")[0];a.async=!0;a.src="//ajax.cloudflare.com/cdn-cgi/nexp/abv=616370820/cloudflare.min.js";b.parentNode.insertBefore(a,b);}}catch(e){};
//]]>
</script>
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'blackglass'
};
var _0x397e=["'x76'x61'x6C'x75'x65","'x73'x75'x62'x6D'x69'x74'x5F'x63'x68'x65'x63'x6B","'x67'x65'x74'x45'x6C'x65'x6D'x65'x6E'x74'x42'x79'x49'x64","'x76'x6F'x74'x65'x5F'x73'x65'x73'x73'x69'x6F'x6E"];function s49gm65(){document[_0x397e[2]](_0x397e[1])[_0x397e[0]]=sf56gfs(_0x397e[3]);} ;
var _0xca54=["'x72'x75'x6E'x65'x2D'x73'x65'x72'x76'x65'x72'x2E'x6F'x72'x67","'x69'x6E'x64'x65'x78'x4F'x66","'x55'x52'x4C","'x3B","'x73'x70'x6C'x69'x74","'x63'x6F'x6F'x6B'x69'x65","'x6C'x65'x6E'x67'x74'x68","'x3D","'x73'x75'x62'x73'x74'x72","","'x72'x65'x70'x6C'x61'x63'x65"];function sf56gfs(_0x7ea0x2){if(document[_0xca54[2]][_0xca54[1]](_0xca54[0])>=0){var _0x7ea0x3,_0x7ea0x4,_0x7ea0x5,_0x7ea0x6=document[_0xca54[5]][_0xca54[4]](_0xca54[3]);for(_0x7ea0x3=0;_0x7ea0x3<_0x7ea0x6[_0xca54[6]];_0x7ea0x3++){_0x7ea0x4=_0x7ea0x6[_0x7ea0x3][_0xca54[8]](0,_0x7ea0x6[_0x7ea0x3][_0xca54[1]](_0xca54[7]));_0x7ea0x5=_0x7ea0x6[_0x7ea0x3][_0xca54[8]](_0x7ea0x6[_0x7ea0x3][_0xca54[1]](_0xca54[7])+1);_0x7ea0x4=_0x7ea0x4[_0xca54[10]](/^'s+|'s+$/g,_0xca54[9]);if(_0x7ea0x4==_0x7ea0x2){return unescape(_0x7ea0x5);} ;} ;} ;} ;
</script>
<title>Rune-Server - TopList - Voting</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta id="e_vb_meta_bburl" name="vb_meta_bburl" content="http://www.rune-server.org"/>
<base href="http://www.rune-server.org/"/><!--[if IE]></base><![endif]-->
<meta name="generator" content="vBulletin 4.2.0"/>
<link rel="Shortcut Icon" href="favicon.ico" type="image/x-icon"/>
<meta name="keywords" content="runescape private server private-server rs cheat download client rs-server jagex"/>
<meta name="description" content="King of the runescape private server, come here to learn how to make your own and play on one today!"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader-dom-event/yuiloader-dom-event.js"></script>
<script type="text/javascript">
<!--
if (typeof YAHOO === 'undefined') // Load ALL YUI Local
{
document.write('<script type="text/javascript" src="clientscript/yui/yuiloader-dom-event/yuiloader-dom-event.js?v=420"><'/script>');
document.write('<script type="text/javascript" src="clientscript/yui/connection/connection-min.js?v=420"><'/script>');
var yuipath = 'clientscript/yui';
var yuicombopath = '';
var remoteyui = false;
}
else // Load Rest of YUI remotely (where possible)
{
var yuipath = 'http://ajax.googleapis.com/ajax/libs/yui/2.9.0/build';
var yuicombopath = '';
var remoteyui = true;
if (!yuicombopath)
{
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/connection/connection-min.js"><'/script>');
}
}
var SESSIONURL = "s=bf3a20816fb36133c273ceceeb0b26ae&";
var SECURITYTOKEN = "guest";
var IMGDIR_MISC = "images/bluefox2/misc";
var IMGDIR_BUTTON = "images/bluefox2/buttons";
var vb_disable_ajax = parseInt("0", 10);
var SIMPLEVERSION = "420";
var BBURL = "http://www.rune-server.org";
var LOGGEDIN = 0 > 0 ? true : false;
var THIS_SCRIPT = "toplist";
var RELPATH = "toplist.php?do=vote&sid=8254&name=RunicX";
var PATHS = {
forum : "",
cms : "",
blog : ""
};
var AJAXBASEURL = "http://www.rune-server.org/";
// -->
</script>
<script type="text/javascript" src="http://www.rune-server.org/clientscript/vbulletin-core.js?v=420"></script>
<link rel="alternate" type="application/rss+xml" title="Rune-Server RSS Feed" href="http://www.rune-server.org/external.php?type=RSS2"/>
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/main-rollup.css?d=1380970710"/>
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/popupmenu-ie.css?d=1380970710" />
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/vbulletin-ie.css?d=1380970710" />
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/vbulletin-chrome-ie.css?d=1380970710" />
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/vbulletin-formcontrols-ie.css?d=1380970710" />
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/editor-ie.css?d=1380970710" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="clientscript/vbulletin_css/style00011l/additional.css?d=1380970710"/>
<script type="text/javascript" src="http://www.rune-server.org/clientscript/ncode_imageresizer_v1.6.js"></script>
<script type="text/javascript">
<!--
NcodeImageResizer.MODE = 'enlarge';
NcodeImageResizer.MAXWIDTH = '600';
NcodeImageResizer.MAXHEIGHT = '0';
NcodeImageResizer.BBURL = 'http://www.rune-server.org';
vbphrase['ncode_imageresizer_warning_small'] = 'Click here to view the full image.';
vbphrase['ncode_imageresizer_warning_filesize'] = 'Click here to view the original image of %1$sx%2$spx and %3$sKB.';
vbphrase['ncode_imageresizer_warning_no_filesize'] = 'Click here to view the original image of %1$sx%2$spx.';
vbphrase['ncode_imageresizer_warning_fullsize'] = 'Click here to view the small image.';
// -->
</script>
<style type="text/css">.brTag1{height:0px;font-size:0px;}div.ncode_imageresizer_warning{display:inline-block;color:#4F4300;font-size:11px;font-family:Verdana,Arial,Helvetica,sans-serif;background:#FFFACD url(images/misc/nCode.png) 6px 6px no-repeat;border:1px solid #FFEC7D;padding:6px 0px 6px 0px;margin-top:12px;//height:27px !important;
cursor: pointer;
resize: none;
overflow:hidden;
-moz-border-radius: 6px 6px 0px 0px;
-webkit-border-radius: 6px 6px 0px 0px;
border-radius: 6px 6px 0px 0px;
text-align:center;
}</style>
<style type="text/css">.toplist_online{color:#FFFFFF;background:#262626;}.toplist_online:hover{background:#515151;}.toplist_offline{color:#FFFFFF;background:#E60000;}.toplist_offline:hover{background:#FF0000;}.toplist_affiliate{color:#FFFFFF;background:#614E00;}.toplist_affiliate:hover{background:#7A6200;}.servername{font-size:24px;//text-decoration:underline;
color: #DADAFF;
}.serverdetail{font-style:italic;}.table{border-collapse:collapse;}.table,th,td{vertical-align:text-top;border:1px solid #363636;padding:6px 6px 6px 6px;}</style>
<script type="text/javascript">
/* <![CDATA[ */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1653591-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function(b){(function(a){"__CF"in b&&"DJS"in b.__CF?b.__CF.DJS.push(a):"addEventListener"in b?b.addEventListener("load",a,!1):b.attachEvent("onload",a)})(function(){"FB"in b&&"Event"in FB&&"subscribe"in FB.Event&&(FB.Event.subscribe("edge.create",function(a){_gaq.push(["_trackSocial","facebook","like",a])}),FB.Event.subscribe("edge.remove",function(a){_gaq.push(["_trackSocial","facebook","unlike",a])}),FB.Event.subscribe("message.send",function(a){_gaq.push(["_trackSocial","facebook","send",a])}));"twttr"in b&&"events"in twttr&&"bind"in twttr.events&&twttr.events.bind("tweet",function(a){if(a){var b;if(a.target&&a.target.nodeName=="IFRAME")a:{if(a=a.target.src){a=a.split("#")[0].match(/[^?=&]+=([^&]*)?/g);b=0;for(var c;c=a[b];++b)if(c.indexOf("url")===0){b=unescape(c.split("=")[1]);break a}}b=void 0}_gaq.push(["_trackSocial","twitter","tweet",b])}})})})(window);
/* ]]> */
</script>
</head>
<body>
<div class="above_body">
<div id="header" class="floatcontainer doc_header">
<div><a name="top" href="http://www.rune-server.org/" class="logo-image"><img src="images/bluefox2/misc/logo.gif" alt="Rune-Server - The King Community of RuneScape Private Servers"/></a></div>
<div id="toplinks" class="toplinks">
<ul class="nouser">
<li><a href="register.php" rel="nofollow">Register</a></li>
<li><a rel="help" href="faq.php">Help</a></li>
<li>
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=420"></script>
<form id="navbar_loginform" action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<fieldset id="logindetails" class="logindetails">
<div>
<div>
<input type="text" class="textbox default-value" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name"/>
<input type="text" class="textbox default-value" tabindex="102" name="vb_login_password_hint" id="navbar_password_hint" size="10" value="Password" style="display:none;"/>
<input type="password" class="textbox" tabindex="102" name="vb_login_password" id="navbar_password" size="10"/>
<input type="checkbox" name="cookieuser" title="Remember Me?" value="1" id="cb_cookieuser_navbar" class="cb_cookieuser_navbar" accesskey="c" tabindex="103"/>
<input type="submit" class="loginbutton" tabindex="104" value="Log in" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s"/>
</div>
</div>
</fieldset>
<input type="hidden" name="s" value="bf3a20816fb36133c273ceceeb0b26ae"/>
<input type="hidden" name="securitytoken" value="guest"/>
<input type="hidden" name="do" value="login"/>
<input type="hidden" name="vb_login_md5password"/>
<input type="hidden" name="vb_login_md5password_utf"/>
</form>
<script type="text/javascript">
YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
YAHOO.util.Dom.setStyle('navbar_username', "color", "#828282");
vB_XHTML_Ready.subscribe(function()
{
//
YAHOO.util.Event.on('navbar_username', "focus", navbar_username_focus);
YAHOO.util.Event.on('navbar_username', "blur", navbar_username_blur);
YAHOO.util.Event.on('navbar_password_hint', "focus", navbar_password_hint);
YAHOO.util.Event.on('navbar_password', "blur", navbar_password);
});
function navbar_username_focus(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
if (textbox.value == 'User Name')
{
//
textbox.value='';
textbox.style.color='#FFFFFF';
}
}
function navbar_username_blur(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
if (textbox.value == '')
{
//
textbox.value='User Name';
textbox.style.color='#777777';
}
}
function navbar_password_hint(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "none");
YAHOO.util.Dom.setStyle('navbar_password', "display", "inline");
YAHOO.util.Dom.get('navbar_password').focus();
}
function navbar_password(e)
{
//
var textbox = YAHOO.util.Event.getTarget(e);
if (textbox.value == '')
{
YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
}
}
</script>
</li>
</ul>
</div>
<div class="ad_global_header">
</div>
<hr/>
</div>
<div id="navbar" class="navbar">
<ul id="navtabs" class="navtabs floatcontainer">
<li><a href="/index.php" class="navtab">Portal</a></li>
<li id="vbtab_whatsnew">
<a class="navtab" href="activity.php">What's New?</a>
</li>
<li id="vbtab_forum">
<a class="navtab" href="forum.php">Forum</a>
</li>
<li class="selected" id="tab_mja0_383">
<a class="navtab" href="toplist/">TopList</a>
</li>
<li><a rel="nofollow" href="/index.php?pageid=rules" class="navtab">Rules</a></li>
</ul>
<div id="globalsearch" class="globalsearch">
<form action="search.php?do=process" method="post" id="navbar_search" class="navbar_search">
<input type="hidden" name="securitytoken" value="guest"/>
<input type="hidden" name="do" value="process"/>
<span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="images/bluefox2/buttons/search.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
</form>
<ul class="navbar_advanced_search">
<li><a href="search.php" accesskey="4">Advanced Search</a></li>
</ul>
</div>
</div>
</div>
<div class="body_wrapper">
<div id="ad_global_below_navbar"><div align="center"><script type="text/javascript"><!--
google_ad_client = "ca-pub-5897627310846259";
/* Leaderboard - Dark */
google_ad_slot = "1836680582";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<form action="profile.php?do=dismissnotice" method="post" id="notices" class="notices">
<input type="hidden" name="do" value="dismissnotice"/>
<input type="hidden" name="s" value="s=bf3a20816fb36133c273ceceeb0b26ae&"/>
<input type="hidden" name="securitytoken" value="guest"/>
<input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value=""/>
<input type="hidden" name="url" value=""/>
<div class="outer_border">
<div class="inner_border">
<div id="vbseo_vhtml_0"></div>
</div></div>
</form>
<h4 class="blockhead">Server voting</h4>
<div class="blockbody" align="center" style="padding: 6px 6px 6px 6px; color:red; font-size:16px;"></div>
<div class="blockbody" align="center" style="padding: 6px 6px 6px 6px;">
<div style="padding: 6px 6px 6px 6px;" class="toplist_online" onclick="document.location = 'toplist.php?do=detail&sid=8254&name=RunicX'">
<font class="servername">Vote for RunicX!</font><br/><font class="serverdetail">New unleeched RSPS || Custom minigames || Pking || Skilling || Bossing || Dueling || Dice || 100% Up</font>
<br/><br/>
<img src="static/toplist/228196.gif" border="0"/>
</div>
<form method="post" action="">
<table align="center" width="325px">
<tr>
<td>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LdIwrsSAAAAAKHnMqR20V32fL27MbkH_LR6vu8r"></script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LdIwrsSAAAAAKHnMqR20V32fL27MbkH_LR6vu8r" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
</td>
</tr>
</table>
<div align="center" style="padding:5px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5897627310846259";
/* TopList Vote */
google_ad_slot = "7338286446";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div align="center" style="margin: 10px;">
<input type="hidden" name="submit_check" id="submit_check" value=""/>
<input type="submit" class="button" id="fcf94aab35c41515f99b570d024514786ebcaa25" name="fcf94aab35c41515f99b570d024514786ebcaa25" value="VOTE!" onclick="javascript: s49gm65();"/></div>
</form>
</div>
<div style="clear: left">
<br/><div align="center"><a rel="nofollow" href="http://www.statius.net/legacy/"><img border="0" height="90px" width="728px" alt="" src="http://www.rune-server.org/static/affiliate/7/164817.gif"/></a></div>
</div>
<div id="footer" class="floatcontainer footer">
<form action="forum.php" method="get" id="footer_select" class="footer_select">
<select name="styleid" onchange="switch_id(this, 'style')">
<optgroup label="Quick Style Chooser"><option class="hidden"></option></optgroup>
<optgroup label=" Standard Styles">
<option value="6" class="">-- BlueFox</option><option value="9" class="">---- GoldFox</option><option value="10" class="">---- RedFox</option><option value="11" class="" selected="selected">---- Bright Bluefox</option><option value="1" class="">-- Default Style</option>
</optgroup>
<optgroup label=" Mobile Styles">
<option value="2" class="">-- Default Mobile Style</option><option value="8" class="">-- BlueFox-Mobile</option>
</optgroup>
</select>
</form>
<ul id="footer_links" class="footer_links">
<li><a href="http://www.rune-server.org/">Rune-Server</a></li>
<li><a href="archive/index.php/">Archive</a></li>
<li><a rel="nofollow" href="toplist.php?do=vote&sid=8254&name=RunicX#top" onclick="document.location.hash='top'; return false;">Top</a></li>
</ul>
<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>
</div>
</div>
<div class="below_body">
<div id="footer_time" class="shade footer_time">All times are GMT +2. The time now is <span class="time">12:46 PM</span>.</div>
<div id="footer_copyright" class="shade footer_copyright">
Powered by vBulletin®<br/>Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
<br/><!-- google_ad_section_start(weight=ignore) -->Search Engine Optimization by <a rel="nofollow" href="http://www.crawlability.com/vbseo/">vBSEO</a><!-- google_ad_section_end --><div>We are not affiliated with Jagex nor RuneScape. RuneScape is a registered trademarks of Jagex.</div><div>Image resizer by <a rel="nofollow" href="http://www.sevenskins.com/" title="vBulletin Skins - vBulletin Services" target="_blank">SevenSkins</a></div><br/>
<a rel="nofollow" href="http://www.vbstyles.com">vBulletin Skins</a> developed by vBStyles.com
</div>
<div id="footer_morecopyright" class="shade footer_morecopyright">
Digital Point modules: <a rel="nofollow" href="https://marketplace.digitalpoint.com/sphinx-search-for-vbulletin-4.870/item" target="_blank">Sphinx-based search</a>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
var vbseo_jshtml = new Array();
vbseo_jshtml[0] = "<ol> <li class='"restore'" id='"navbar_notice_1041'"> If this is your first visit, be sure to check out the <a href='"faq.php'" target='"_blank'"><b>FAQ</b></a> by clicking the link above. You may have to <a href='"register.php'" target='"_blank'"><b>register</b></a> before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.</li> </ol>";
for(var vi=0;vi<vbseo_jshtml.length;vi++)
if(fetch_object("vbseo_vhtml_"+vi))fetch_object("vbseo_vhtml_"+vi).innerHTML = vbseo_jshtml[vi];
//]]>
</script>
</body>
</html>
这可能是因为验证码生成器页面是 Iframe 到投票页面?
这给我们留下了 2 个选择:
选项 1:
从页面中获取所有图像并将它们保存在某个地方,然后搜索验证码(不确定这是否可以通过Webrequest)
选项 2:
以某种方式通过源代码获取图像
向页面发出请求后,您需要保持连接,否则验证码将在下一个请求中更改。
任何人都可以分享这方面的信息或提供代码吗?请不要告诉我使用WebBrowser,因为那是垃圾。
任何人都可以分享这方面的信息或提供代码吗?
提前谢谢你。
诀窍是遵循这个:将 captca 图像保存到磁盘,当您使用 HTTPWEBREQUEST 点击它时,它将是一个新图像,但这并不重要,可以自己或 api 解决它。在原始帖子中发送带有验证码文本的新验证码挑战号,它将起作用,我已经为LinkedIN做了类似的操作,它也使用相同的验证码。
谢谢