Monday, June 21, 2021

Reimplementing Security Code AutoFill

Tyler Hall:

I’m very, very close to writing a KeyboardMaestro macro to grab the latest 2FA code from Messages.app to work around this.

Tyler Hall:

Here’s what ended up working.

Click the menubar’s clock to activate Notification Center.

[…]

Take a screenshot.

[…]

OCR the text contained in that cropped image, which should hopefully contain our two-factor code.

[…]

Extract the code using a shell script.

[…]

Type the code into the current app (probably your non-Safari browser).

Previously:

Update (2021-06-29): Keyboard Maestro:

Nice macro. FYI, I can crop from the right side using the SCREEN function. Or OCR directly from the cropped area using the Area option and the IMAGE contextual function, or combine both directly.

Update (2021-12-20): Tyler Hall:

To my surprise, very nice reader azorpheunt provided a real solution in the comment section earlier today.

Their solution is to grab the most recent text from Messages.app’s actual SQLite database and parse the token from that. Not only is this way, way faster - it’s much more error-proof as well.

Comments RSS · Twitter

Leave a Comment