WELCOME TO EHOST.COM.NP

Thursday, August 17, 2017

Speed up 2 Factor Authentication on Android with Tasker

ads space

We all know that security online is very important, so many of us have begun using various 2 Factor Authentication methods.

“Your Google verification code is 431973”

But every time I receive this message when I want to log in, I think: oh, come-on! I want to be secure, but how many times do I have to tell you: ‘It’s me Google!’ With security, you usually can’t have the cake and eat it too… or can you? This is where Tasker Authentication Helper comes in! While I’m aware of Google’s sign in from phone feature, this project goes beyond that and should work with any type of SMS-based 2 factor authentication. What we’ll be doing is retrieving the token from a text message and sending it to other devices using Join.

Tasker ($2.99 $0.99, Google Play) →


Join by joaoapps (Free+, Google Play) →


Tasker 2 Factor Authentication Helper

I have to admit, that most often the simplest profiles are the one that solve the most annoying issues. Tasker Authentication Helper is very simple, though it took me a while to fail miserably at regular expressions (regex). I have not been able to find a single regex formula to do this all in one step, but the profile works well with 2 regex filters working together. If you are a pro at regex, feel free to combine both formulas together and let me know!

If you are REALLY concerned about what devices you are sharing this clipboard with, you can limit the devices receiving the code to an active PC in Tasker.

Vanilla Tasker Trigger

While personally, I prefer using the paid AutoNotification Tasker plugin to intercept SMS notifications, you can do this whole setup using just Tasker only – without any paid plugins. The vanilla set up checks each message received, (Received Text message event) trying to parse its content. The text message is stored in the system variable %SMSRB.


Authentication Helper Profile - Vanilla Tasker


Profile: Pin Code Vanilla
Event: Received Text [ Type:Any Sender:* Content:* ]
Enter: Grab A Code Txt

AutoNotification Trigger

AutoNotification (Free+, Google Play) →

Unlike the vanilla Tasker trigger, using the AutoNotification intercept we can run the task only if the text message contains the words “pin” or “code”. This way the Tasker profile won’t run on every received text message. I’m using the AutoNotification Intercept trigger to intercept the message. A simple filter of the Notification Text: %antext (pin|code)  set in the context, will assure that I don’t start assigning any values without a reason. Let’s not run the task if we don’t have to.

 

Authentication Helper Profile


Profile: Pin Code Txt
Event: AutoNotification Intercept [ Configuration:Event Behaviour: true
Notification Type: Only Created Notifications
Notification App: Signal
Notification Text: pin|code (regex) (case ins)
Package Name: org.thoughtcrime.securesms ]
Enter: Grab A Code

Getting the 2 Factor Authentication Code

To fish out the code from a text message, we are going to use 2 regex filters. This should prevent incorrect values from being assigned:

  • A text with a number, but without pin or code word.
  • A text with a number that is not a pin or code.
  • A text with multiple numbers. Capture the first match after code/pin.
  • A text with multiple numbers where the code/pin word is placed after the code.

If you are using the Vanilla Tasker trigger please replace the %antext with %SMSRB.

Grab a Code TASK


Grab A Code
A1: Variable Search Replace [ Variable:%antext Search:(code|pin).*?\d+
Ignore Case:On Multi-Line:On One Match Only:On
Store Matches In:%code Replace Matches:Off Replace With: ]
A2: Variable Search Replace [ Variable:%antext Search:^(.*?)\d+
Ignore Case:On Multi-Line:On One Match Only:On
Store Matches In:%code Replace Matches:Off Replace With: ] If [ %code1 !Set ]
A3: Variable Search Replace [ Variable:%code1 Search:\d+
Ignore Case:On Multi-Line:On One Match Only:On
Store Matches In:%auth Replace Matches:Off Replace With: ]
A4: Set Clipboard [ Text:%auth1 Add:Off ]

Please test the message, to make sure that your messages are being filtered accordingly.

Tasker Authentication Helper – regex

To capture the actual code, I’m going to use Regex. I have several different variations stored on my phone and I’m going to use it as an example. I tried to cover the biggest number of scenarios possible, but if your verification text falls outside of the scope of my regex filters – you will have to modify it to your needs.

Let’s start with capturing the numbers after the words pin/code (case insensitive). I’m using www.regex101.com to help with this.


(code|pin).*?\d+

The result is good, but I failed with the last example. Our matches are:


code is 431973
code:895941
PIN is 4044

Using search/replace action I will store the matches in an array %code. Our match will be placed in the 1st element: %code1. The %code1 won’t be set if the verification text follows the last example. If that’s the case I can set another Regex filter:


^(.*?)\d+

Instead of building a very complicated Regex filter (and mostly because it’s a task way above my understanding of Regex), I will just filter the results again. In both circumstances, the second filter will be the same:


\d+

The result of the second filter is stored in the %auth array as the first element %auth1. This variable is used to set a clipboard and is shared with other devices via the Join app.


Conclusion

Tasker Authentication Helper project works fast and helps speeds up login times. I think I’m getting too old to remember the short numbers, or simply too old to go and find my mobile each time I want to log in anywhere without compromising my security. The project file below contains both setups (vanilla and AutoNotification). Please pick one and disable the other profile.

Download the Tasker 2 Factor Authentication Helper Project

Download the above ZIP file and extract the contents onto the internal storage of your Android device. Open up Tasker and disable “Beginner Mode” in Preferences. Then, go back to Tasker’s main page and long-press on the home icon in the bottom left corner. You will see an option to “import” a project. Tap that option then find the .prj.xml file you extracted earlier. Once imported, you will see a new tab at the bottom alongside the default home icon in Tasker. This contains the profiles and tasks of this helper project.

Follow the XDA-Developers Tutorials feed for more posts such as this. Also, check out our Tasker Tips & Tricks forum for the latest creations among the automation enthusiasts in our community.

ads space
ADS SPACE

0 comments:

Post a Comment

Categories

Article How-to All Posts WordPress Android Web design Blogger Plugins CSS Google JQuery Plugins Programming Reviews Web Hosting Blogger Blogging Blogging Tips Tricks Web Development Facebook Git Internet Make Money Online Social Plugins Tips Tips and Tricks Tools Tutorials Windows WordPress Plugins Blogging Tips and Tricks Freebies GSM Google Analytics HTML How To's JavaScript Plugin Development S.E.O SEO SMS SmartPhone Social Media Tips amp; Tricks Top-Most Updates Webmaster Tools Whatsapp Applications Apps Blogger Basics Documentary Downloads Entertainment Gadgets Games Gmail Google AdSense Guest Post IPhone Make Money Blogging SVN Security Softwares Web Hosting Tips and Tricks Wordpress Tips Wordpress Tips and Tricks hostgator iOS Advertising Networks Advertising Technology Affiliates Antivirus Audience amp; Traffic Biography Blog post Blog post Blogger Blogger Errors Blogger Tips Blogger Tools Blogger Widget Blogosphere Bogger Widgets CSS selectors CSS symbols CSS3 Computer amp; Internet Content Writing Coupon Codes Data amp; Analytics Deleted blog Design DoubleClick for Publishers Email and newsletter marketting Email marketing Excel Tips Excel Tips and Tricks Facebook Tricks Feed Feedburner Feedburner subscribers Font Fun GitHub Giveaways Gmail primary inbox Gmail tabs Google sign-in Guides HTML amp; CSS HTML5 Infographics Inspirational Instagram Internet Marketing Internet Tips amp; Tricks Job Listings Knowledge Life Hacks Lists Make-Money Monetization amp; Conversion Monetize Navigation Online Marketing Other PHP Tutorials Passport Publishing amp; Content Quotes RSS Sidebar Smartphones Social Networking Status Tech Tech Blog Technology Telegram Themes UI / UX User Psychology amp; Research VB.Net Web Tools Web browser Widget Windows Tips Windows-10 ad viewability admin notice blogging tools bluehost cherry-pick clone cors custom scrollbar customizer dismissible notices duplicate post feed title git branch git clone gpg gpg2 hybridauth iPad icon font notice responsive wordpress theme same origin policy scrollbar signed git commit smartsvn theme customizer vcs wordpress theme wordpress themes

Blog Archive