看图识妹子

admin 2022年1月5日22:44:19评论45 views字数 1267阅读4分13秒阅读模式

>

>

看图识妹子

yuchoxuuan

本来不想用替换cookie的,可是90往后裁剪的太狠了,不得已而为之啊。

import matplotlib.pyplot as plt
import numpy as np
iall = cv2.imread('z:/all.png')[50:-1,50:-1,:]
plt.imshow(iall)
iall.shape
h,w = 75,50
url = 'http://a535ad95-2200-4ffb-912d-ad320bbb982e.challenge.ctf.show'
se = requests.session()
import time
cookie={}
while True:
    txt = se.get(url+'/start').text
    if 'ctfshow' in txt:
        print(txt)
        break
    b64start = txt.find('data:image/jpeg;base64,')
    print(txt[-125:-115])
    txt = txt[b64start+23:txt.find("'",b64start)]
    with open('tmp.png','wb') as f:
        f.write(base64.b64decode(txt))
        f.close()
    tmpf = cv2.imread('tmp.png')
    th,tw,_ = tmpf.shape
    tmp=cv2.resize(tmpf,(tw//10,th//10),cv2.INTER_LANCZOS4)
    res =cv2.matchTemplate( iall,tmp,cv2.TM_CCOEFF_NORMED)
    min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
    tmpall = iall.copy()
    rb=(max_loc[0]+tw//10,max_loc[1]+th//10)
    cv2.rectangle(tmpall, max_loc, rb, (0,0,255), 3)
    try:
        nW = 'ABCDEFGHIJ'[(max_loc[1])//h] + str(int((max_loc[0])//w))
    except:
        pass
    print('find:---->',nW)
    cv2.imshow('Target',tmpf)
    cv2.imshow('Find-resault',tmpall)
    po={'meizi_id':nW}
    resp= se.post(url+'/check',data=po)
    txt = resp.text
    cv2.waitKey(delay=10)
    if "回答错误" not in txt:
       cookie = resp.cookies.get('session')
    else:
        print(txt)
        se.cookies.clear_session_cookies()
        se.cookies.set('session',cookie)
    del res,tmpf,tmp ,tmpall
    gc.collect()
input()
cv2.destroyAllWindows()

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月5日22:44:19
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   看图识妹子http://cn-sec.com/archives/719331.html

发表评论

匿名网友 填写信息