>
>
看图识妹子
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()
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论