Do you know Python? Tell me what this simple python code does

FBGuru

Supreme Member
Jr. VIP
Joined
Sep 22, 2013
Messages
1,209
Reaction score
1,670
Code:
import os
from os import listdir,glob
from os.path import isfile, join

imageUrl = "recaptcha/api/v2....."
imageText = "a fire hydrant"

if imageText in [x[0] for x in os.walk(DIR)]:
folder_path = f"/User/redacted/desktop/images/{entry.name}"
counter = len(glob.glob(os.path.join(folder_path, '*.txt')))
r = requests.get(imageUrl, stream=True)
if r.status_code == 200:
with open(f"{folder_path}/{counter=+1}", 'wb') as f:
for chunk in r:
f.write(chunk)

Let's say the value of the imageUrl variable is a Recaptcha image url.

chrome_3Hk91mPE0c.png


and the raw image from the URL looks like this :

chrome_RgU704tc60.png


Does running the script save only the fire hydrants from the image or the whole image(raw image)?

P.s. The code is not mine but from another experienced programmer who have no time.
 
It writes the entire image, not just hydrants.

That code does not break the captcha if that's what you're wondering.
 
Back
Top