Skip to content

Breaks Captcha - #28

Merged
SeanDaBlack merged 5 commits into
SeanDaBlack:mainfrom
William-Timimi:main
Dec 12, 2021
Merged

Breaks Captcha#28
SeanDaBlack merged 5 commits into
SeanDaBlack:mainfrom
William-Timimi:main

Conversation

@William-Timimi

Copy link
Copy Markdown
Contributor

Thanks to @jmrushing for providing the code to break the captcha. Just tried to make the code a bit neater. It now has a separate function for breaking the captcha and calls on FFmpeg without a wrapper library as this appeared easier than getting everyone to sort out the extra dependencies. Additionally, it tells people to install FFmpeg in the read me. (Also thanks to @joeyagreco I'd started working on my PR before you submitted yours but I used yours to speed up adding the new constants to my code.)

Comment thread main.py
with open(filename, "wb") as handle:
for data in content.iter_content():
handle.write(data)
# END TEST

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this

Comment thread main.py
time.sleep(1)
outeriframe.click()
time.sleep(2)
allIframesLen = driver.find_elements_by_tag_name('iframe')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"allIFrames" seems like a more accurate name for this variable, unless you want to just save the len() of this directly and skip it on line 71

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you are correct there

@joeyagreco joeyagreco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a few minor changes, otherwise looks good!

Comment thread main.py
except FileNotFoundError:
pass
# convert wav to mp3
subprocess.run(f"ffmpeg -i {mp3Path} {CAPTCHA_WAV_FILENAME}", shell=True, timeout=5)

@jmrushing jmrushing Dec 12, 2021

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any benefits to using ffmpeg over pydub's AudioSegment? Seems like an extra layer of complexity for the end user (installing ffmpeg & setting up the path) vs 3 lines of code in main.py and 1 in requirements.txt à la #26 .
A better way than both methods would be probably be to save the incoming stream straight to WAV, but my brain is too fried to work that out at the moment.
Also, is checking for the file and deleting necessary before running ffmpeg? Using the solution in #26, sound.export() overwrites the old WAV file during each new iteration. Perhaps ffmpeg can't do that for some reason (permissions?) or needs an additional command flag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simply couldn't get pydubs working. I think you are right though saving directly to wav would be best

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also my understanding is that pydubs relies on ffmpeg for conversion anyway

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I wonder if anyone else who's tested with the #26 solution has had issues with pydub? I hope not... 🤦
I didn't mean to give you hard time about ffmpeg, but I've done A LOT of scripting with it in the past. And while it's been...a while...for me, ffmpeg used to have a pretty dodgy reputation for breaking things with their updates, in addition to some nasty security loopholes stemming from outdated libraries. Maybe that's not the case anymore, but it was bad enough just a few years ago that I would regularly have to re-write scripts after updates to account for altered internal default values or implementation differences between distros. That's my unsolicited $0.02 on ffmpeg 😅

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also my understanding is that pydubs relies on ffmpeg for conversion anyway

Well I learned something today. I should have RTFM. Doh!

ffmpeg on its own is still kludgy IMO, maybe that's why I prefer using the pydub wrapper. When I get some time, I'll work out the "clean" solution and hopefully we'll be done with creating multiple audio files.

@SeanDaBlack
SeanDaBlack merged commit 9408912 into SeanDaBlack:main Dec 12, 2021
@SeanDaBlack SeanDaBlack mentioned this pull request Dec 12, 2021
@ghost ghost linked an issue Dec 13, 2021 that may be closed by this pull request
@ghost ghost mentioned this pull request Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Well, they added a reCaptcha -_-

4 participants