This uses sqlite to read the latest SMS from the Messages App in Mac and uses a regex to parse out the Two Factor Code.
Show HN: Automatically Copy Two Factor SMS Codes to Your Clipboard on a Mac
gist.github.com