zoukankan      html  css  js  c++  java
  • oj Rapid Typing

    import bs4
    import requests
    import urllib2
    import time
    import base64
    session=requests.Session()
    response=session.get('http://oj.blue-whale.me:23331/captcha.php')
    soup=bs4.BeautifulSoup(response.text)
    s=soup.find('img') #get the img tag
    
    #print s
    #we get s,but the type of s is class
    #print s['src']
    #use [] get the tag's attributes
    #use .string get the text between<tag>and</tag>
    #get tag's attributes
    src=s['src']
    #get text of the photo
    photo=src.split(',',1)[1]
    #decode the photo
    photo=base64.b64decode(photo)
    #show photo
    #print photo
    # we take <text></text>,sort by x
    text=photo.split("<line",1)[0]
    text=text.split(">",1)[1]
    text=text.split("</text>")
    #print text
    
    #get char and x pos
    ans={}
    for chars in text:
        print chars
        length=len(chars)
        if length<3:
            break
        char=chars[length-1]
        ch=chars.split()
        x=ch[1].split('"')[1]
        x=int(x)
        ans[x]=char
        print length,char,ch[1],x,ans[x]
    ans=sorted(ans.iteritems(), key=lambda d:d[0], reverse =False )
    print ans
    url='http://oj.blue-whale.me:23331/captcha.php?code='
    s=''
    #print type(ans)
    #after sorted ,type(ans)=list??
    for ch in ans:
        s=s+ch[1]
    url=url+s
    flag=session.get(url)
    print flag.text

    lunix系统下中文支持没有配出来,注释的时候直接用英语了,直接翻译过来就行。。。唉,英语渣的痛谁都懂

    flag{svg_C4P7cHa_n0t_$ecUr3}

  • 相关阅读:
    Android 使用MediaPlayer 播放 视频
    Android加载asset的db
    MAC SVN 基本设置 终端命令
    AFNetWork 简单实用demo
    IntelliJ IDEA导出Java 可执行Jar包
    Xcode快速排错
    Listview多tab上滑悬浮
    N最短路径分词
    进程监控工具supervisor
    nginx配置指南
  • 原文地址:https://www.cnblogs.com/superxuezhazha/p/6111210.html
Copyright © 2011-2022 走看看