Imacros登录Captcha

时间:2015-02-04 18:24:27

标签: javascript imacros

拜托!我也是Imacros的新手。 我试图创建我自己的第一个自己的Imacros登录,但我确实填写了用户名和密码,但我的问题是验证码怎么做,我的imacros代码行是



VERSION BUILD=8881205 RECORDER=FX
TAB T=1
URL GOTO=http://www.paidverts.com/
TAG POS=1 TYPE=A ATTR=TXT:LOGIN
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginFrm ATTR=ID:email CONTENT=xxxxxxxxx
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginFrm ATTR=ID:password CONTENT=zzzzzzzzzzz
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:loginFrm ATTR=ID:remember CONTENT=YES
FRAME NAME="I0_1423080140232"
TAG POS=1 TYPE=DIV ATTR=ROLE:presentation&&CLASS:recaptcha-checkbox-checkmark&&TXT:
FRAME NAME="I1_1423080161977"
TAG POS=1 TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=03AHJ_Vuu6vQefEcoVJVhsXZMpzEOGjONceHlLrKcofzhGVBUrTpA8ZPVEg_mptugxljlFIt-SoWOq8hmct9KaweK2NBXlS8oGNy6tZhsk4StFQijv51jQSGa3PcbL08KtttF3MoAgecD8VXFzQDXPb3iEyxLa5uE2wDbviNaEj7UsgH8C5dYtRSpRZ8s0iq50QywV-vAcSBsywYQOtO3Xi10lKlb4F8cHY0xvkse8zr3RqMMYWrqDzm5InTVNb-JJNtSvKPE6DJvzAFQw8ijaSorg3lwfL0VBSA&k=6LcIE_8SAAAAANQbcN_lbzBltZz-v4rrmivih_35




所以请你帮忙

3 个答案:

答案 0 :(得分:0)

您有关于deathbycaptcha.com的示例,但要访问API,您必须注册并购买验证码。

答案 1 :(得分:0)

将reccapcha v2的imacros作为两个文件的完整示例(添加payverts并且您有完整的解决方案):

  1. recaptcha_v2.iim

    
    
    VERSION BUILD=8920312 RECORDER=FX
    SET !EXTRACT_TEST_POPUP NO
    SET !ERRORIGNORE NO
    SET !TIMEOUT_PAGE 999
    SET !TIMEOUT_STEP 999
    TAB CLOSEALLOTHERS
    '
    ' The script fill the captcha of recaptcha v2 demo.
    '
    ' Note for users with firefox with the message "Firefox prevented this page from automatically reloading.":
    ' UNCHECK the option "warn me when pages try to redirect" in your browser
    ' You find the checkbox under Options > Advanced > General > Accessibility
    
    ' Path to the captcha image with timestamp
    ' Tempfolder like C:\ or C:\TEMP under windows or like /tmp under linux
    SET tempfolder C:\
    
    ' Tempslash (Path with slashs as tempfolder) and with the htmlfile recaptcha_v2.html
    SET tempslash C:/
    
    ' Tempfile
    SET tempfile captcha_{{!NOW:yyyymmdd_hhnnss}}.jpg
    
    ' Step 1: Config for 9kw.eu for your apikey
    SET apikey your_api_key
    'And priority (prio 1-20)
    SET prio 0
    
    ' Step 2: Save the captcha picture to local disk
    TAB T=1
    URL GOTO=https://www.google.com/recaptcha/api2/demo
    FRAME NAME=I0_*
    EVENT TYPE=CLICK SELECTOR="#recaptcha-anchor>DIV:nth-of-type(5)" BUTTON=0
    WAIT SECONDS=3
    ONDOWNLOAD FOLDER={{tempfolder}} FILE={{tempfile}} WAIT=YES
    FRAME NAME=I1_*
    TAG POS=1 TYPE=DIV ATTR=ID:rc-imageselect CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
    WAIT SECONDS=5
    
    TAB OPEN
    TAB T=2
    URL GOTO=file:///{{tempslash}}recaptcha_v2.html?file:///{{tempslash}}{{tempfile}}
    WAIT SECONDS=5
    FILEDELETE NAME={{tempfolder}}{{tempfile}}
    TAG POS=1 TYPE=DIV ATTR=* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
    TAB CLOSE
    
    'Wait a random number (1 to 5) of seconds
    SET randomnumber EVAL("Math.floor(Math.random()*5 + 1);")
    WAIT SECONDS={{randomnumber}}
    
    'Syntaxcheck: API Key, prio
    SET apikey EVAL("var s=\"{{apikey}}\"; if(s.match(/^[a-zA-Z0-9]+$/) && s.length <= 50 && s.length >= 5) s; else MacroError(\"API Key is wrong.\")")
    SET prio EVAL("var s=\"{{prio}}\", d = parseFloat(s); if(d >= 0 && d <= 20) d; else MacroError(\"Value(Prio) is not in the set range.\")")
    
    'Step 3: Open the a new tab, and go to 9kw.eu, and submit the captcha picture
    TAB OPEN
    TAB T=2
    URL GOTO=http://www.9kw.eu/grafik/form.html
    'The apikey is used to identify each of our customers, which you can get from the our page. It is assigned to the CONTENT.
    TAG POS=1 TYPE=INPUT ATTR=NAME:apikey CONTENT={{apikey}}
    'Priority in our system like min. 0 to max. 20 (cost +0-20)
    TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT={{prio}}
    'Options for the form. See more under http://www.9kw.eu/grafik/form.html and http://www.9kw.eu/api.html
    TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:selfsolve CONTENT=NO
    TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:confirm CONTENT=NO
    TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:case-sensitive CONTENT=NO
    TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:nomd5 CONTENT=YES
    'We need only numbers for this captcha
    TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:numeric CONTENT=YES
    TAG POS=1 TYPE=INPUT ATTR=NAME:source CONTENT=imacros
    'The path of the captcha picture saved is assigned to the CONTENT
    TAG POS=1 TYPE=INPUT ATTR=NAME:file-upload-01 CONTENT={{tempfolder}}{{tempfile}}
    'Submit the formdata to 9kw.eu
    TAG POS=1 TYPE=INPUT ATTR=TYPE:submit
    'Extract the captchaid from your captcha submit
    TAG POS=1 TYPE=INPUT ATTR=NAME:captchaid EXTRACT=TXT
    SET captchaid {{!EXTRACT}}
    'Clean the !EXTRACT variable for the next task
    SET !EXTRACT NULL
    'Extract the characters that are recoginzed from the picture of captcha.
    TAG POS=1 TYPE=INPUT ATTR=NAME:result EXTRACT=TXT
    'Step 4: Check the captcha answer (text or nothing like #EANF#)
    SET answer EVAL("if (\"{{!EXTRACT}}\" == \"#EANF#\") {var x = \"\";} else {var x = \"{{!EXTRACT}}\";} x;")
    'Clean the !EXTRACT variable for the next task
    SET !EXTRACT NULL
    TAB CLOSE
    
    'Display extracted data (only for debug)
    'PROMPT {{captchaid}}
    
    'Step 5: Fill the recognized characters to the verification box (Click the pictures 1..9)
    TAB T=1
    FRAME NAME="I1_*"
    SET !ERRORIGNORE YES
    SET n1 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(0,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n1}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n2 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(1,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n2}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n3 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(2,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n3}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n4 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(3,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n4}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n5 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(4,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n5}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n6 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(5,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n6}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n7 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(6,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n7}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n8 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(7,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n8}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET n9 EVAL("var s=\"{{answer}}\"; if(s.match(/^[0-9]+$/) && s.length <= 9 && s.length >= 2) s.substr(8,1); else MacroError(\"Captcha answer is wrong.\")")
    TAG POS={{n9}} TYPE=IMG ATTR=SRC:https://www.google.com/recaptcha/api2/payload?c=*
    SET !ERRORIGNORE NO
    
    'Click the Verify button
    EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV" BUTTON=0
    WAIT SECONDS=2
    FRAME F=0
    EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>FORM>FIELDSET>UL>LI:nth-of-type(6)>INPUT" BUTTON=0
    WAIT SECONDS=3
    
    'Step 6: Check and send the captcha feedback back to the captcha service (OK:1, NotOK:2, EN: Right/False, DE: Richtig/Falsch)
    TAG POS=1 TYPE=DIV ATTR=CLASS:recaptcha-success EXTRACT=TXT
    SET htmlcode {{!EXTRACT}}
    SET !EXTRACT NULL
    SET feedback EVAL("if (\"{{htmlcode}}\" == \"Juhu!\") {var x = \"1\";} else {var x = \"2\";} x;")
    TAB OPEN
    TAB T=2
    URL GOTO=http://www.9kw.eu/index.cgi?source=imacros&action=usercaptchacorrectback&apikey={{apikey}}&correct={{feedback}}&id={{captchaid}}
    WAIT SECONDS=2
    TAB CLOSE
    TAB T=1
    
    'Cleanup: Delete the old captcha picture
    FILEDELETE NAME={{tempfolder}}{{tempfile}}
    &#13;
    &#13;
    &#13;

  2. recaptcha_v2.html

    &#13;
    &#13;
    <html>
    <head>
    <style>
    .c{
    	width:392;
    	height:505px;
    	margin: -15px 0 0px -15px;
    	position: relative;
    	overflow: hidden;
    }
    .t{
    	position: absolute;
    	top: 65px;
    	left: 10px;
    	width: 62%;
    	border: 1px red solid;
    	color: rgba(255, 255, 255, 0.9);
    	background: rgba(0, 0, 0, 0.8);
    	font: bold 18px Helvetica, Sans-Serif;padding: 0px 0px 0px 8px;
    }
    .n{
    	position: absolute;
    	width: 20px;
    	border: 1px red black;
    	color:rgb(0, 0, 0);
    	background: rgba(255, 255, 255, 0.9);
    	font: bold 18px Helvetica, Sans-Serif;padding: 0px 0px 0px 8px;
    }
    .n1{
    	top: 120px;
    	left: 7px;
    }
    .n2 {
    	top:120px;
    	left:137px;
    }
    .n3 {
    	top:120px;
    	left:267px;
    }
    .n4 {
    	top:250px;
    	left:7px;
    }
    .n5 {
    	top:250px;
    	left:137px;
    }
    .n6 {
    	top:250px;
    	left:267px;
    }
    .n7 {
    	top:380px;
    	left:7px;
    }
    .n8 {
    	top:380px;
    	left:137px;
    }
    .n9 {
    	top:380px;
    	left:267px;
    }
    </style>
    <body>
    
    <div class='c'>
    	<script>
    		var href = window.location.href;
    		var queryString = href.substring( href.indexOf('?') + 1 );
    		document.write("<img src='"+queryString+"' width='400' height='600'>");
    	</script>
    	<span class='t'>Type the image numbers<br />without spaces as &quot;268&quot;</span>
    	<span class='n n1'>1</span>
    	<span class='n n2'>2</span>
    	<span class='n n3'>3</span>
    	<span class='n n4'>4</span>
    	<span class='n n5'>5</span>
    	<span class='n n6'>6</span>
    	<span class='n n7'>7</span>
    	<span class='n n8'>8</span>
    	<span class='n n9'>9</span>
    </div>
    
    </body>
    </html>
    &#13;
    &#13;
    &#13;

  3. 或在https://www.9kw.eu/grafik/plugins/9kweu_recaptcha_v2.zip下使用验证码服务(您可以使用任何),例如 9kw.eu,验证码叠加(作为结果的文本验证码)和验证码反馈。

    对MOD的注意:问题并不完全相同,但我的解决方案适用于两个(!)线程,非常有用。来自threadcreator的问题的良好解决方案。此帖子没有任何链接,只有imacros中的解决方案。 stackoverflow上的mod非常疯狂,免费的解决方案并不好,但是在没有任何解决方案的情况下使用其他用户的域名进行广告宣传。

答案 2 :(得分:-1)

我之前在imacros中使用了更复杂的健壮架构。

您需要一个验证码服务来提供帮助。这是一个验证码服务中的imacros示例的链接。您可以研究并找到一个链接,脚本应该是simliar

http://karmaproject.co.uk/how-to-solve-captcha-with-deathbycaptcha-in-imacros/