{"id":32912,"date":"2021-06-21T16:00:01","date_gmt":"2021-06-21T20:00:01","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=32912"},"modified":"2021-12-20T16:17:42","modified_gmt":"2021-12-20T21:17:42","slug":"reimplementing-security-code-autofill","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/06\/21\/reimplementing-security-code-autofill\/","title":{"rendered":"Reimplementing Security Code AutoFill"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/tylerhall\/status\/1405623582588289024\">Tyler Hall<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/tylerhall\/status\/1405623582588289024\">\n<p>I&rsquo;m very, very close to writing a KeyboardMaestro macro to grab the latest 2FA code from Messages.app to work around this.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/tyler.io\/lets-reimplement-an-amazing-first-party-feature-in-the-dumbest-way-possible\/\">Tyler Hall<\/a>:<\/p>\n<blockquote cite=\"https:\/\/tyler.io\/lets-reimplement-an-amazing-first-party-feature-in-the-dumbest-way-possible\/\"><p>Here&rsquo;s what ended up working.<\/p><p>Click the menubar&rsquo;s clock to activate Notification Center.<\/p><p>[&#8230;]<\/p><p>Take a screenshot.<\/p><p>[&#8230;]<\/p><p>OCR the text contained in that cropped image, which should hopefully contain our two-factor code.<\/p><p>[&#8230;]<\/p><p>Extract the code using a shell script.<\/p><p>[&#8230;]<\/p><p>Type the code into the current app (probably your non-Safari browser).<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/06\/17\/safari-15\/\">Safari 15<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/02\/04\/delivering-origin-bound-one-time-codes-over-sms\/\">Delivering Origin-bound One-time Codes Over SMS<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/10\/21\/safari-security-code-autofill\/\">Safari Security Code AutoFill<\/a><\/li>\n<\/ul>\n\n<p id=\"reimplementing-security-code-autofill-update-2021-06-29\">Update (2021-06-29): <a href=\"https:\/\/twitter.com\/keyboardmaestro\/status\/1407147919963082756\">Keyboard Maestro<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/keyboardmaestro\/status\/1407147919963082756\">\n<p>Nice macro. FYI, I can crop from the right side using the <a href=\"https:\/\/wiki.keyboardmaestro.com\/function\/SCREEN\">SCREEN<\/a> function. Or OCR directly from the cropped area using the Area option and the <a href=\"https:\/\/wiki.keyboardmaestro.com\/function\/IMAGE\">IMAGE<\/a> contextual function, or combine both directly.<\/p>\n<\/blockquote>\n\n<p id=\"reimplementing-security-code-autofill-update-2021-12-20\">Update (2021-12-20): <a href=\"https:\/\/tyler.io\/a-better-way-to-copy-two-factor-codes-on-macos\/\">Tyler Hall<\/a>:<\/p>\n<blockquote cite=\"https:\/\/tyler.io\/a-better-way-to-copy-two-factor-codes-on-macos\/\"><p>To my surprise, very nice reader azorpheunt <a href=\"https:\/\/tyler.io\/lets-reimplement-an-amazing-first-party-feature-in-the-dumbest-way-possible\/#fast-comments-jt=oP0HopQcg\">provided a real solution<\/a> in the comment section earlier today.<\/p><p>Their solution is to grab the most recent text from Messages.app&rsquo;s actual SQLite database and parse the token from <em>that<\/em>. Not only is this way, way faster - it&rsquo;s much more error-proof as well.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Tyler Hall: I&rsquo;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&rsquo;s what ended up working.Click the menubar&rsquo;s clock to activate Notification Center.[&#8230;]Take a screenshot.[&#8230;]OCR the text contained in that cropped image, which should hopefully contain our two-factor code.[&#8230;]Extract the code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-06-21T20:00:12Z","apple_news_api_id":"fbdfd21d-fa52-4350-abe6-4c724ce6cde9","apple_news_api_modified_at":"2021-12-20T21:17:45Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAw==","apple_news_api_share_url":"https:\/\/apple.news\/A-9_SHfpSQ1Cr5kxyTObN6Q","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[279,456,562,30,32,141,111,622,981,103,1393,2090,96],"class_list":["post-32912","post","type-post","status-publish","format-standard","hentry","category-technology","tag-firefox","tag-googlechrome","tag-keyboardmaestro","tag-mac","tag-macapp","tag-messages","tag-notificationcenter","tag-ocr","tag-passwords","tag-safari","tag-short-message-service-sms","tag-two-factor-authentication-2fa","tag-web"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=32912"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32912\/revisions"}],"predecessor-version":[{"id":34508,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32912\/revisions\/34508"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=32912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=32912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=32912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}