Title Address: http://sec.hdu.edu.cn/question/web/1076/
This question is a bit similar to the previous one, look at the source code:
The HTML tag where the character was found is changed, and the previous question is a GET request, which is a POST request.
Then modify the Python code as follows:
#Coding=utf-8ImportRequests fromBs4ImportBeautifulsoupurl="http://sec.hdu.edu.cn/question/web/1076/"Q=requests.session () Webcontext= Q.get (URL). text#Get page ContentContent=webcontext.split ('') A=content[1]unicode2str=a.encode ("Utf-8") Ln=Len (a) s=0e=0c=0l=0a=0b=0 forIinchRange (LN):if(Unicode2str[i] = ='s'): S=s+1elif(unicode2str[i]=='e'): E=e+1elif(Unicode2str[i] = ='C'): C=c+1elif(unicode2str[i]=='L'): L=l+1elif(Unicode2str[i] = ='a'): A=a+1elif(unicode2str[i]=='b'): b=b+1Else: Continuevalue='%d'%s +'%d'%e +'%d'%c +'%d'%l +'%d'%a +'%d'%Bgetdata={'Answer': Value}result=q.post (url,data=GetData) Z=RESULT.TEXTX=z.encode ('GBK','Ignore')PrintX
Run to get flag.
CTF Character Statistics 2