In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Software to be installed
1. After installing ImageMagick, add its installation path to the environment variable path
2. Install Tesseract-OCR
# define MAX_NAME_LEN 4 / / defines the length of the CAPTCHA string, which is 4 digits
Int flen; / / defines an integer variable to save the size of the obtained file
Long filedes
Long filedess; / / Save file handle
Char file [256] = "c:\\ test1.jpg"; / / Save file path and file name
Char result [4]; / / defines an array for reading CAPTCHA from a file
Web_set_max_html_param_len ("2000000")
/ / set the maximum number of bytes received by the page, which should be greater than the size of the downloaded file
/ / download the web page element containing the CAPTCHA and save it to the parameters
Web_reg_save_param_ex (
"ParamName=pic"
"LB="
"RB="
SEARCH_FILTERS
"Scope=Body"
"RequestUrl=*/action/ValidateCodeServlet*"
LAST)
/ / Associate the session ID generated with the server during login
Web_reg_save_param_ex (
"ParamName=CorrelationParameter_1"
"LB=Set-Cookie: JSESSIONID="
"RB=; Path"
SEARCH_FILTERS
"Scope=All"
"RequestUrl=*/192.168.12.1:8080/*"
LAST)
/ / visit the test website
Web_url ("192.168.12.1 purl 8080"
"URL= http://192.168.12.1:8080/",
"Resource=0"
"RecContentType=text/html"
"Referer="
"Snapshot=t1.inf"
"Mode=HTML"
EXTRARES
"Url=/p_w_picpaths/login_screenbg.jpg", ENDITEM
"Url=/p_w_picpaths/login_midbg.jpg", ENDITEM
"Url=/p_w_picpaths/login_contentbg.jpg", ENDITEM
"Url=/p_w_picpaths/login_btn.png", ENDITEM
"Url=/p_w_picpaths/login_input1.png", ENDITEM
"Url=/p_w_picpaths/login_input2.png", ENDITEM
"Url=/p_w_picpaths/reset_btn.png", ENDITEM
LAST)
Flen = web_get_int_property (HTTP_INFO_DOWNLOAD_SIZE)
/ / get the file size of the downloaded image
If (flen > 0)
{
If ((filedes = fopen (file, "wb")) = = NULL)
{
Lr_output_message ("oh cloud your Open File Failed!")
Return-1
}
Fwrite (lr_eval_string ("{pic}"), flen,1, filedes)
Fclose (filedes)
}
System ("c:\\ test1.bat"); / / run the OCR command on the CMD command line
/ *
Create a batch file test1.bat under the root directory of disk C:
# enter the directory containing the CAPTCHA image
C:
Cd\
# convert downloaded JPG file to TIF
Convert.exe-compress none-depth 8-alpha offtest1.jpg test1.tif
# call tesseract to convert the file in the picture and save it to the test1.txt file
Tesseract.exe test1.tif test1
# exit the command line automatically after the execution is completed
Exit
, /
If ((filedess = fopen ("c:\\ test1.txt", "rt")) = = NULL)
{
Lr_output_message ("oh,cloud your Open File Failed!")
Return-1
}
Fread (result,4,1,filedess); / / read the CAPTCHA from the file
Fclose (filedess)
Lr_output_message ("result:% s", result); / / print out the read data
Lr_save_var (result,MAX_NAME_LEN,0, "VC")
/ / Save the specified number of digits of data to the variable
Web_submit_data ("UserAction"
"Action= http://192.168.12.1:8080/action/UserAction",
"Method=POST"
"RecContentType=text/html"
"Referer= http://192.168.12.1:8080/",
"Snapshot=t2.inf"
"Mode=HTML"
ITEMDATA
"Name=method", "Value=login", ENDITEM
"Name=goPage", "Value=/index.html", ENDITEM
"Name=currentPage", "Value=/", ENDITEM
"Name=username", "Value=admin", ENDITEM
"Name=password", "Value=123456", ENDITEM
"Name=ValidateCode", "Value= {VC}", ENDITEM, / / enter the obtained CAPTCHA
"Name=loginSubmit", "Value= login", ENDITEM
EXTRARES
...
LAST)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.