Extract Captcha text to Login

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Extract Captcha text to Login

Post by Tamilselvan » Thu Nov 05, 2020 4:13 pm

Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)

Hi,
I am trying to Login page but struggled in Captcha / Security Code. I can only extracted Captcha / Security as image but not text. I request anyone to help.

Code: Select all

URL GOTO=http://nregade4.nic.in/netnrega/MGNREGA_new/Nrega_Login.aspx?salogin=Y&state_code=25
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddl_FinYr CONTENT=%2020
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_UserID CONTENT=29720579357
'Type Password
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_PW CONTENT=
PAUSE
TAG POS=1 TYPE=IMG ATTR=SRC:http://nregade4.nic.in/netnrega/CaptchaImage/JpegImage.aspx CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
PAUSE
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_Captcha CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_Button1
Login-Extracted Text.jpg
Thanks & Regards,
S. Tamilselvan.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract Captcha text to Login

Post by chivracq » Thu Nov 05, 2020 5:32 pm

Tamilselvan wrote:
Thu Nov 05, 2020 4:13 pm

Code: Select all

Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)
Hi,
I am trying to Login page but struggled in Captcha / Security Code. I can only extracted Captcha / Security as image but not text. I request anyone to help.

Code: Select all

URL GOTO=http://nregade4.nic.in/netnrega/MGNREGA_new/Nrega_Login.aspx?salogin=Y&state_code=25
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddl_FinYr CONTENT=%2020
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_UserID CONTENT=29720579357
'Type Password
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_PW CONTENT=
PAUSE
TAG POS=1 TYPE=IMG ATTR=SRC:http://nregade4.nic.in/netnrega/CaptchaImage/JpegImage.aspx CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT
PAUSE
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_Captcha CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_Button1
Login-Extracted Text.jpg
Thanks & Regards,
S. Tamilselvan.

Woaw..., I'm "nearly impressed", you've finally managed to open a Thread in the "correct" Sub-Forum, very good...! :D 8)

But hum, your "I request anyone to help." sounds/feels very "commanding", foufff...! :shock: Maybe that's "the Way" People "communicate" in India when addressing People from a "lower" Caste, but this doesn't really work on a Tech Forum where all Users are "Equal"... Nobody is "at your Service", ah-ah...! :roll:

And hum, you didn't follow up on your previous Thread, apart from bumping the even previous one, while I had "requested" you to report those 2 Threads to the Forum Admin to ask them to move those 2 Threads from the 'iMacros for FF' Sub-Forum to their "correct" Sub-Forum, but you didn't do anything...
Not following up on their Threads and/or not reacting to my Qt's/Suggs/Remarks is usually a Show-Stopper for me to help Users (again)... :idea:
I hope you'll do "a bit better" in this one... :idea:

>>>

OK, well, concerning this one..., yeah well, "I can only extracted Captcha / Security as image but not text.", that's "a little bit" the Purpose of Captcha, ah-ah...! No Wonder then... :P
=> You need to use some Anti-Captcha/Captcha-Solving Service if you want to automate that part and integrate it in your iMacros Script, you have a Dedicated Thread on the Forum:
- OFFICIAL (Anti-)Captcha Providers Thread.
The one called "9kw" is run by Advanced User on the Forum @thecoder2012 who's pretty Advanced in iMacros (same Level like me, and even much more Advanced than me, when JS is involved...), and who's usually quite responsive... 8)

Or you'd need to use some OCR Solution, either Locally through the Command Line, or from some Online Website... :idea:

But hum, some "new" Service/Site ("True Captcha") got added to that Captcha Thread a bit recently, (at the end of the Thread, I haven't included it yet in the previous Posts I maintain in that Thread), using AI, I had not tried it yet, so I just gave it a go with the Captcha from your Site, and hum, that could maybe be an option for you..., but the Site/Tool only works with Capital Letters and Numbers. :idea:

=> I got a "98Bi90" in my (one and only) Test and the Demo read it as "98BI90", thus converting the Lowercase "i" to an Uppercase "I". Hum...! Not quite perfect...! :(

Depending on how the Captchas get generated, and which Chars/Combinations regularly come back, if you always "only" get 2 Letters in a 6-Char String, then you have 25% Chance of getting the "correct" one from this Tool, which can maybe be increased to 50%, if there is always 1 Upper + 1 Lower Char, and maybe if you are "lucky", the Lowercase Char is maybe always in the 2nd Position... Or maybe the Site allows to submit x2 or x4 the same Captcha... I don't know, you would need to "test" yourself... :idea:
(I didn't run more Tests, I don't want to "burn" my IP... :wink: )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Extract Captcha text to Login

Post by Tamilselvan » Fri Nov 06, 2020 4:11 pm

I don't know how to ask admin to move those 2 Threads from the 'iMacros for FF' Sub-Forum to their "correct" Sub-Forum. Is there any id or create new post to ask admin ?
Please help me....
Thank You...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract Captcha text to Login

Post by chivracq » Fri Nov 06, 2020 4:24 pm

Tamilselvan wrote:
Fri Nov 06, 2020 4:11 pm
I don't know how to ask admin to move those 2 Threads from the 'iMacros for FF' Sub-Forum to their "correct" Sub-Forum. Is there any id or create new post to ask admin ?
Please help me....
Thank You...

"You don't know...", ah-ah...! I had completely and clearly explained to you in your "last" Thread how to ask the Forum Admin to move a Thread, and also mentioned that that "Procedure" is also explained in the Forum Rules..., and if there was "stg" (= something) you had not understood, then you could have followed up and asked in that Thread... :roll:

But OK, never mind, now focus and follow up on this current Thread...!
=> "Please help me...." Yeah, well, I'm already "helping you", ah-ah...! :?
=> Follow up on everything I mentioned in my previous Post about your Captcha and how to handle it... :idea:

And hum..., I "normally" never help for Captcha, I think that's probably the first time I do so for a Thread on the Forum, so you don't need to ask "dramatically" "Please help me...". I consider that when Web-Sites implement some Captcha, that's a "clear Sign" that they don't want Users to automate using their Site, ... and I respect that... :|
=> Maybe log in manually once, and stay logged in, I guess you then won't need to log in again and to fill in the Captcha again...
Or if you are a "very Legit" User of this Site, contact them explaining your "Business Case" and ask them if they can put your IP on some "Whitelist" that won't require you to fill in the Captcha... Or try the "I request...!" Mode, maybe that will work with them, ah-ah...! :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Extract Captcha text to Login

Post by Tamilselvan » Mon Nov 09, 2020 4:07 pm

I have tried the code with help of 9kw.com. Could you check & verify for me.

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 999
SET !TIMEOUT_STEP 999

' Path to the captcha image with timestamp
' Tempfolder like C:\ or C:\TEMP under windows or like /tmp under linux
SET !VAR0 C:\
' Tempfile
SET !VAR1 captcha_{{!NOW:yyyymmdd_hhnnss}}.jpg

' Step 1: Config for 9kw.eu for your apikey
SET !VAR2 your_api_key
'And priority (prio 1-20)
SET !VAR3 0

URL GOTO=http://nregade1.nic.in/netnrega/Login.aspx?level=HomePO&state_code=29
ONDOWNLOAD FOLDER={{!VAR0}} FILE={{!VAR1}} WAIT=YES
TAG POS=1 TYPE=IMG ATTR=SRC:http://nregade1.nic.in/netnrega/CaptchaImage/JpegImage.aspx CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT

'Wait a random number (1 to 5) of seconds
SET !VAR9 EVAL("Math.floor(Math.random()*5 + 1);")
WAIT SECONDS={{!VAR9}}


'Syntaxcheck: API Key, prio
SET !VAR2 EVAL("var s=\"{{!VAR2}}\"; if(s.match(/^[a-zA-Z0-9]+$/) && s.length <= 50 && s.length >= 5) s; else MacroError(\"API Key is wrong.\")")
SET !VAR3 EVAL("var s=\"{{!VAR3}}\", d = parseFloat(s); if(d >= 0 && d <= 20) d; else MacroError(\"Value(Prio) is not in the set range.\")")

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={{!VAR2}}
'Priority in our system like min. 0 to max. 20 (cost +0-20)
TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT={{!VAR3}}
'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
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={{!VAR0}}{{!VAR1}}
'Submit the form data to 9kw.eu
TAG POS=1 TYPE=INPUT ATTR=TYPE:submit
'Extract the captcha id from your captcha submit
TAG POS=1 TYPE=INPUT ATTR=NAME:captchaid EXTRACT=TXT
SET !VAR5 {{!EXTRACT}}
TAB CLOSE
TAB T=2
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_Captcha CONTENT={{!VAR5}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_btn_Login
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract Captcha text to Login

Post by chivracq » Mon Nov 09, 2020 11:17 pm

Tamilselvan wrote:
Mon Nov 09, 2020 4:07 pm
I have tried the code with help of 9kw.com. Could you check & verify for me.

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 999
SET !TIMEOUT_STEP 999

' Path to the captcha image with timestamp
' Tempfolder like C:\ or C:\TEMP under windows or like /tmp under linux
SET !VAR0 C:\
' Tempfile
SET !VAR1 captcha_{{!NOW:yyyymmdd_hhnnss}}.jpg

' Step 1: Config for 9kw.eu for your apikey
SET !VAR2 your_api_key
'And priority (prio 1-20)
SET !VAR3 0

URL GOTO=http://nregade1.nic.in/netnrega/Login.aspx?level=HomePO&state_code=29
ONDOWNLOAD FOLDER={{!VAR0}} FILE={{!VAR1}} WAIT=YES
TAG POS=1 TYPE=IMG ATTR=SRC:http://nregade1.nic.in/netnrega/CaptchaImage/JpegImage.aspx CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT

'Wait a random number (1 to 5) of seconds
SET !VAR9 EVAL("Math.floor(Math.random()*5 + 1);")
WAIT SECONDS={{!VAR9}}


'Syntaxcheck: API Key, prio
SET !VAR2 EVAL("var s=\"{{!VAR2}}\"; if(s.match(/^[a-zA-Z0-9]+$/) && s.length <= 50 && s.length >= 5) s; else MacroError(\"API Key is wrong.\")")
SET !VAR3 EVAL("var s=\"{{!VAR3}}\", d = parseFloat(s); if(d >= 0 && d <= 20) d; else MacroError(\"Value(Prio) is not in the set range.\")")

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={{!VAR2}}
'Priority in our system like min. 0 to max. 20 (cost +0-20)
TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT={{!VAR3}}
'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
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={{!VAR0}}{{!VAR1}}
'Submit the form data to 9kw.eu
TAG POS=1 TYPE=INPUT ATTR=TYPE:submit
'Extract the captcha id from your captcha submit
TAG POS=1 TYPE=INPUT ATTR=NAME:captchaid EXTRACT=TXT
SET !VAR5 {{!EXTRACT}}
TAB CLOSE
TAB T=2
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt_Captcha CONTENT={{!VAR5}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_btn_Login

"Could you check...?"
=> Beh no, I told you I don't help with Captcha..., I gave you some "Idea" for some Anti-Captcha Site, you don't react to that at all, fair enough..., now wait until the Admin from '9kw' will see this Thread and your Reply and will eventually reply... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Extract Captcha text to Login

Post by Tamilselvan » Wed Nov 11, 2020 5:04 pm

Yes i have checked. But i got some error. Please guide me.
Error.jpg
I have requested to Admin regarding move last two threads to Correct Sub-Forum. This is for your kind information.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extract Captcha text to Login

Post by chivracq » Wed Nov 11, 2020 5:26 pm

Tamilselvan wrote:
Wed Nov 11, 2020 5:04 pm
Yes i have checked. But i got some error. Please guide me.
Error.jpg

Hum, Screenshots are always "nice" and "useful" but for Error Msg's and Runtime Errors, it would also be useful if you could post the Error in plain Text in the Thread, Screenshots are not searchable for Search Engines and other Users will therefore not find this Thread... :idea:
And when I help for a Thread, I do it for "the whole Community", not just for one User...

But yep, your Runtime Error is probably related to saving your Captcha/Image to the 'C:\' Root, I would think..., Win7 and Win10 don't allow Browsers to have Access to the 'C:\' Root for Security Reasons... :idea:
Hum, or maybe that was still "allowed" in Win7, and this "Restriction" only started with Win8.0 or Win8.1, I'm not sure anymore...

>>>
Tamilselvan wrote:
Wed Nov 11, 2020 5:04 pm
I have requested to Admin regarding move last two threads to Correct Sub-Forum. This is for your kind information.

Yep, I saw that, done in a "cute" way that the Forum Admin would have never noticed... I had to ask them myself following the "proper" Procedure, now both Threads have been moved to their "correct" Sub-Forum(s)... Good... :D

I'll have a look "one day" if I have a "quick Solution", as I'll have to "dig into them" again from the beginning, I don't remember what they were about, several months or weeks "later"...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Extract Captcha text to Login

Post by thecoder2012 » Sun Jan 24, 2021 6:58 am

The website in your script has technical maintenance at the moment. ("won't be available from today(Friday) 22/01/2021 9 pm to Monday, 25/01/2021 8 am") :shock:
Tamilselvan wrote:
Mon Nov 09, 2020 4:07 pm
I have tried the code with help of 9kw...
It's always 9kw.eu :!:
Tamilselvan wrote:
Mon Nov 09, 2020 4:07 pm
Could you check & verify for me.
Maybe (without order)
Tamilselvan wrote:
Wed Nov 11, 2020 5:04 pm
But i got some error. Please guide me.
Error.jpg
Is your image captcha under C:\ ?
If not then change your save path (directory) for image captchas in the script. Sometimes is C:\ only with admin rights thinkable.
chivracq wrote:
Wed Nov 11, 2020 5:26 pm
Hum, Screenshots are always "nice" and "useful" but for Error Msg's and Runtime Errors, it would also be useful if you could post the Error in plain Text in the Thread, Screenshots are not searchable for Search Engines and other Users will therefore not find this Thread... :idea:
Sure. Error as text: "Win error 1314 during operation open on file C:\captcha_20201111_221705.jpg (A required privilege is not held by the client.) (Error code: -1001)"
chivracq wrote:
Wed Nov 11, 2020 5:26 pm
But yep, your Runtime Error is probably related to saving your Captcha/Image to the 'C:\' Root, I would think..., Win7 and Win10 don't allow Browsers to have Access to the 'C:\' Root for Security Reasons... :idea:
Yes, sometimes (e.g. win10 pro).
chivracq wrote:
Wed Nov 11, 2020 5:26 pm
Hum, or maybe that was still "allowed" in Win7, and this "Restriction" only started with Win8.0 or Win8.1, I'm not sure anymore...
Yes it was thinkable in the past with old systems.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Post Reply