Jump to content

squatto

Member
  • Posts

    16
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by squatto

  1. On 5/28/2021 at 3:08 AM, deanishe said:

    No. The workflow is really choosy in what it considers a 2fa code. It only matches messages where the word "code" appears before the number, not after.

     

    There's actually a number of different formats that it looks for. Here's the relevant code from the latest version (you can also view it on GitHub here). The comments tell you what it's looking for and has example messages.

     

    if (preg_match('/(^|\s|\R|\t|\b|G-|:)(\d{5,8})($|\s|\R|\t|\b|\.|,)/', $text, $matches)) {
        // 5-8 consecutive digits
        // examples:
        //   "您的验证码是 199035,10分钟内有效,请勿泄露"
        //   "登录验证码:627823,您正在尝试【登录】,10分钟内有效"
        //   "【赛验】验证码 54538"
        //   "Enter this code to log in:59678."
        //   "G-315643 is your Google verification code"
        //   "Enter the code 765432, and then click the button to log in."
        //   "Your code is 45678!"
        //   "Your code is:98765!"
        $code = $matches[2];
    } elseif (preg_match('/^(\d{4,8})(\sis your.*code)/', $text, $matches)) {
        // 4-8 digits followed by "is your [...] code"
        // examples:
        //   "2773 is your Microsoft account verification code"
        $code = $matches[1];
    } elseif (preg_match('/(code:|is:)\s*(\d{4,8})($|\s|\R|\t|\b|\.|,)/i', $text, $matches)) {
        // "code:" OR "is:", optional whitespace, then 4-8 consecutive digits
        // examples:
        //   "Your Airbnb verification code is: 1234."
        //   "Your verification code is: 1234, use it to log in"
        //   "Here is your authorization code:9384"
        $code = $matches[2];
    } elseif (preg_match('/(code|is):?\s*(\d{3,8})($|\s|\R|\t|\b|\.|,)/i', $text, $matches)) {
        // "code" OR "is" followed by an optional ":" + optional whitespace, then 3-8 consecutive digits
        // examples:
        //   "Please enter code 548 on Zocdoc."
        $code = $matches[2];
    } elseif (preg_match('/(^|code:|is:|\b)\s*(\d{3})-(\d{3})($|\s|\R|\t|\b|\.|,)/', $text, $matches)) {
        // line beginning OR "code:" OR "is:" OR word boundary, optional whitespace, 3 consecutive digits, a hyphen, then 3 consecutive digits
        // but NOT a phone number (###-###-####)
        // examples:
        //   "123-456"
        //   "Your Stripe verification code is: 719-839."
        $first = $matches[2];
        $second = $matches[3];
    
        // make sure it isn't a phone number
        // doesn't match: <first digits>-<second digits>-<4 consecutive digits>
        if (! preg_match('/(^|code:|is:|\b)\s*' . $first . '-' . $second . '-(\d{4})($|\s|\R|\t|\b|\.|,)/', $text, $matches)) {
            $code = $first . $second;
        }
    }

     

    I've added new formats and changed existing formats at the request of users of the workflow. You can submit an issue on the GitHub repo if you have a suggestion!

     

    On 5/28/2021 at 3:08 AM, deanishe said:

    I wonder if it might work better if the workflow were less choosy about what it considers a code, but perhaps more restrictive about how recent the message needs to be? A false positive isn't a huge deal because the workflow isn't inserting and submitting the codes automatically.

     

    You can change the number of minutes it looks back by going into the workflow variables. Here is a screenshot showing you how to do it:

     

    workflow-variables.png.358bc7f33cd427177be28d311cb51632.png

  2. On 8/30/2021 at 5:57 AM, deanishe said:

    Your OS is unsupported. Apple has removed PHP from macOS.

     

    While it is true that Apple has removed PHP from macOS, it's a very simple process to install it again:

    1. Install Homebrew by following the installation instructions on the Homebrew website
    2. Install `php`:
    brew install php

     

    The latest version of the workflow (v1.2.8) will automatically locate and use the correct `php` binary on your system.

  3. I just released version 1.2.8 of the workflow, which has the following changes:

    • The `php` binary is located on your system to cover situations where it isn't in your `PATH`
      • If the `php` binary can't be found, an error message is displayed
    • Match 4-8 digit codes followed by "is your [...] code". For example: "2773 is your Microsoft account verification code"

    Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.8/iMessage.2FA.alfredworkflow

  4. I just released version 1.2.6 of the workflow, which has the following changes:

    • Match 3 and 4 digit codes if they immediately follow "code" or "is" (e.g. "your code is 1234", "enter code 573 to log in")

    Thanks to @luckman212 for the PR!

     

    Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.6/iMessage.2FA.alfredworkflow

  5. I just released version 1.2.5 of the workflow, which has the following changes:

    • By default, only messages received in the past 15 minutes will be searched
    • You can change how many minutes to look back by changing the `look_back_minutes` workflow variable
    • Tutorial: How to set workflow variables

    Thanks to @luckman212 for the suggestion 👍🏻

     

    Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.5/iMessage.2FA.alfredworkflow

  6. I just released version 1.2.2 of the workflow, which changes the input method from a system paste to simulated keystrokes. This fixes an issue with websites that monitor keystrokes and don't consider pasting to be a valid input (e.g. Wells Fargo online banking)

     

    Thanks to @cmer for submitting the changes!

     

    Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.2/iMessage.2FA.alfredworkflow

  7. I just released version 1.2.1 of the workflow, which fixes a bug that prevented codes from being found if they were followed by a period: "your code is 12345."

     

    Thanks to @tmm for the bug report and @manonstreet for submitting the fix!

     

    Latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.1/iMessage.2FA.alfredworkflow

  8. On 2/1/2020 at 10:32 AM, Cheah said:

     

    Debug log above

     

    UPDATE: For some reason my permissions got reset and didn't have full disk access. Works now.

     

    However, Google 2FA is not automatically detected in search results - would love to know how to configure it to search for this. Cheers!

     

    Thanks for checking into that and for the update on what was happening. I'll make a note to check read permissions on the database file before attempting to run the query.

     

    Are the Google 2FA codes like "G-000000"? "G-" and then 6 digits? I could add that in to the matches.

  9. On 1/30/2020 at 2:54 PM, deanishe said:

    That works. Thanks very much.

     

    Have you considered adding a Snippet Trigger? I'm not sure if it would work super-well everywhere (I imagine quite a few 2FA input fields are set to digits only), but it would be very handy where it did work.

     

    I'll check into that. My only concern with requiring a snippet to be typed into an input field is that many 2fa code inputs are numeric-only, so a prefix to trigger the snippet won't work. I'll see what options there are though.

  10. 20 hours ago, deanishe said:

    On my machine (High Sierra), I get the following error:

    
    Fatal error: Declaration of Carbon\Translator::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale) in /Users/username/Dropbox/Config/Alfred 4/Alfred.alfredpreferences/workflows/user.workflow.3238863D-7399-4C90-A171-D38E111D9932/vendor/nesbot/carbon/src/Carbon/Translator.php on line 18

    Also, from the README:

     

    I haven't checked, but if you made the workflow with Alfred 4 (and it sounds like this is the case), it isn't compatible with Alfred 3, even if it doesn't use any Alfred 4-only features. Just saving a workflow makes it incompatible with earlier major versions of Alfred.

     

    Thank you for letting me know about this! What version of PHP are you running? That's the result of that error. I will likely need to bring in an earlier version of a package to lower the PHP version that's required. Easily done. Or, I may just remove the Carbon library dependency entirely. It's only there to give you a relative timestamp ("2h ago"). A simple date and time would work just as well.

     

    Regarding the Alfred version, that's good to know about the workflow export format. I'll adjust the message to indicate that it's only for Alfred 4.

     

    Thank you!

  11. Safari automatically reads your text messages and asks you to auto-fill any two-factor codes it finds:

     

    image.png.a666f16720983b65664d549cda0567d1.png

     

    I don't use Safari (I use Chrome) and I was sick of having to manually type the codes from my messages. This workflow reads your message history and finds the most recent 5, 6, 7, or 8 digit two-factor codes. When you select a code and press <enter> it is copied to your clipboard, or you can press <⌘+enter> and it will copy the code to your clipboard and paste it into the active application.

     

    image.png.02b033b0e0d0536ec0829beccca296b1.png

     

    Keyword: 2fm

    Download the latest version: https://github.com/squatto/alfred-imessage-2fa/releases/latest/download/iMessage.2FA.alfredworkflow

    GitHub: https://github.com/squatto/alfred-imessage-2fa

    Packal: http://www.packal.org/workflow/imessage-2fa

×
×
  • Create New...