forgetfulfellow Posted May 27, 2021 Posted May 27, 2021 Hi @squatto! Thanks for making this workflow! I was really excited to use it; I got my first 2fa code today after downloading your workflow, but it doesn't seem to work for items like this: `1592 is your code ...` Is something broken on my side? Thanks again! squatto 1
deanishe Posted May 28, 2021 Posted May 28, 2021 17 hours ago, forgetfulfellow said: Is something broken on my side? 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. 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.
MVR London Posted August 30, 2021 Posted August 30, 2021 On 2/1/2020 at 3:02 PM, Cheah said: Not sure what's going on here? I get the same thing - just downloaded the latest version of the workflow. Log shows this - [12:25:23.781] Logging Started... [12:25:31.242] iMessage 2FA[Script Filter] Queuing argument '' [12:25:31.312] iMessage 2FA[Script Filter] Script with argv '' finished [12:25:31.314] ERROR: iMessage 2FA[Script Filter] Code 127: /Users/MVR/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E2E72D95-AC79-413C-849E-619AD2A47E78: line 1: php: command not found
deanishe Posted August 30, 2021 Posted August 30, 2021 27 minutes ago, MVR London said: php: command not found Your OS is unsupported. Apple has removed PHP from macOS.
squatto Posted November 5, 2021 Author Posted November 5, 2021 (edited) 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" Thanks @luckman212 for the PR! Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.8/iMessage.2FA.alfredworkflow Edited November 5, 2021 by squatto Typo
squatto Posted November 5, 2021 Author Posted November 5, 2021 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: Install Homebrew by following the installation instructions on the Homebrew website 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. Ben428 1
squatto Posted November 5, 2021 Author Posted November 5, 2021 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:
deanishe Posted November 5, 2021 Posted November 5, 2021 The regexes are getting pretty hairy now. I wonder if it might not be more manageable to split identification of code messages (i.e. check for words like "code", "2FA" etc.) from the actual extraction of the codes?
Slazh Posted November 10, 2021 Posted November 10, 2021 On 11/5/2021 at 8:42 PM, squatto said: 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" Thanks @luckman212 for the PR! Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.8/iMessage.2FA.alfredworkflow Hey squatto, for some reason I get this error when trying to run the workflow: [19:24:42.861] iMessage 2FA[Script Filter] {"items":[{"arg":"","subtitle":"We were unable to run the query that reads your text messages","title":"ERROR: Unable to Query Your Messages","valid":true},{"arg":"","subtitle":"SQLSTATE[HY000]: General error: 14 unable to open database file","title":"Error Message:","valid":true}]}
flocki Posted November 14, 2021 Posted November 14, 2021 I get the error 'unable to access the file that contains your text messages' this is mac book pro .. just updated to monterey . install brew .. installed php ..
Slazh Posted December 12, 2021 Posted December 12, 2021 Is there some way to grant PHP access to the chat.db?
squatto Posted December 12, 2021 Author Posted December 12, 2021 1 hour ago, Slazh said: Is there some way to grant PHP access to the chat.db? You need to grant full disk access to Alfred. You can find instructions here: https://www.alfredapp.com/help/getting-started/permissions/#full-disk Let me know if that doesn't fix it for you!
Slazh Posted December 12, 2021 Posted December 12, 2021 (edited) 2 hours ago, squatto said: You need to grant full disk access to Alfred. You can find instructions here: https://www.alfredapp.com/help/getting-started/permissions/#full-disk Let me know if that doesn't fix it for you! I already done that, but it dosen't work... I also tried uninstalling Alfred and removing all permissions, installing Alfred again and grant permissions but it does not seam to work 😕 That's why i thought there could be some permissions i need to grant or terminale lines i needed to run 😊 Heres what Alfred says when trying to debug with 2 warnings: ----------------------------------------------------------- Check file cache database... ✅ File cache integrity is ok ----------------------------------------------------------- Check if file is readable... ✅ Alfred has permissions to read this file. ----------------------------------------------------------- Check if volume '/' is indexed by macOS... ✅ Indexing is enabled on this drive ----------------------------------------------------------- Check direct file metadata... ⚠️ Direct metadata available, but content type may be incorrect Display Name: chat.db Other Names: Content Type: dyn.ah62d4rv4ge80k2u Last Used: 2021-12-02 12:34:16 +0000 ----------------------------------------------------------- Check mdls file metadata... ✅ Metadata contains required items ----------------------------------------------------------- Check file is in search scope... ⚠️ File isn't within Alfred's default search scope Add relevant folder to Alfred's Default Search Scope, or if you're using a workflow, add to the File Filter's scope ----------------------------------------------------------- ✅ Troubleshooting passed ⚠️ There were 2 warning(s) Edited December 12, 2021 by Slazh
Bloomer Posted December 13, 2021 Posted December 13, 2021 Hi, great idea, I often miss the function of inserting codes too, but I have a problem with this workflow, error as in the screenshot, how to fix it? All the permissions I have given to alfred, I don’t understand what’s wrong
Slazh Posted December 29, 2021 Posted December 29, 2021 I don't know what happened, but it works now 🤷♂️
MVR London Posted December 15, 2022 Posted December 15, 2022 (edited) Not sure what happened now. It was working fine until recently It launches fine with "2fm" - it finds the code - I selct and press enter - Alfred notification says code was copied. But when I go to paste - it's not there. Whatever was previously copied is pasted Alfred 5.06 2fm ver 1.2.8 MacOS 13.1 Edited December 15, 2022 by MVR London added version numbers
vitor Posted December 16, 2022 Posted December 16, 2022 If you have an issue with a workflow, always post the debugger output. Otherwise the creator won’t know what’s wrong.
xilopaint Posted December 17, 2022 Posted December 17, 2022 This is useful. It would be a nice workflow for the Gallery, @vitor.
vitor Posted December 17, 2022 Posted December 17, 2022 If it’s submitted it in the proper forum with the format, it helps to prioritise.
XorKaya Posted December 20, 2022 Posted December 20, 2022 Love this workflow, been using it for years now. Was wondering, Is it possible to trigger this with a shortcut and have it select the most recent one, then paste it? i.e. Avoiding the Alfred UI altogether? Cheers/Thanks.
GMN Posted March 7 Posted March 7 Hello! Love this workflow. Would it be possible to add the capability to delete the selected message? Thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now