JS Analysis Has _ _ _ _ _ _ Translation MD5

Source: Internet
Author: User

0. Reference 1. Analysis 1.1 Enter the translated content, manually click on the "Translate" button

1.2 View submission data, confirm variance with multiple submissions

1.3 Ctrl+shift+f Global SearchSaltOr SignLocate the three JS code block by searching for the version:2.1 in the submitted data.2.1Lock target code block: Salt timestamp correlation, sign generated by MD5

1.4 Add a breakpoint at the upper function entry, click "Translate" again, F10 start stepping debugging

1.5 Python compute comparison MD5

2. Complete code
Import TimeImportRandomImportReImportHashlibImportRequests fromScrapyImportSelectorurl='http://fanyi.youdao.com/'s=requests. Session () s.headers= {    'Referer':'http://fanyi.youdao.com',    'user-agent':'mozilla/5.0 (Windows NT 6.1; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/66.0.3359.139 safari/537.36'}#Get CookiesR_url =s.get (URL)#Get latest D for MD5 from file Fanyi.min.js#<script type= "Text/javascript" src= "http://shared.ydstatic.com/fanyi/newweb/v1.0.9/scripts/newweb/ Fanyi.min.js "></script>#sel = Selector (text=r_url.text)#url_js = Sel.css (' script::attr (SRC) '). Re_first ('. *fanyi.min.js ' )#R_js = S.get (URL_JS)#D = Re.search (R ' d\s*=\s* "(. *?)" ', R_js.text). Group (1)#print (D)B'ebsefb%=xz%t[kz) C (sy!'Url_post='Http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'Data=Dict (#i = ' has you eaten ',i ='have you eaten yet? ',        #From = ' AUTO ',to ='AUTO', Smartresult='Dict', Client='Fanyideskweb', DOCTYPE='JSON', Version='2.1', Keyfrom='Fanyi.web', Action='fy_by_clickbuttion', Typoresult='false') Salt= str (int (time.time () *1000) + random.randint (0, 9))Print(salt) m=hashlib.md5 () m.update (data['Client']+data['I']+salt+d). Encode ('Utf-8') Sign=m.hexdigest ()Print(sign) data.update ({' from':'AUTO','Salt': Salt,' Sign': Sign}) R_post= S.post (Url_post, Data=data)Print(R_post.json ())
View Code

3. Run the Code

JS Analysis Has _ _ _ _ _ _ Translation MD5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.