Rayquaza01 / authenticator

Firefox addon that generates TOTPs for 2 factor authentication
https://addons.mozilla.org/en-US/firefox/addon/two-factor-authenticator/
MIT License
34 stars 7 forks source link

Database import #13

Open shakasan opened 6 years ago

shakasan commented 6 years ago

It could be nice if can import the database file (SQLite) from Google Authenticator android app by example.

Thanks :-)

Max1Truc commented 6 years ago

@shakasan I would like to help you but I don't know how I could export the database file from the google auth app. Otherwise, you can attach 1 or 2 database example(s) to your comment.

shakasan commented 6 years ago

@Max1Truc Thanks for your reply. The database is located here on Android phones : /data/data/com.google.android.apps.authenticator2/databases/ You must have a rooted device to access it. It's a simple SQLite3 database and all keys are stored in a simple table. If I can help for something, don't hesitate ;-) Thanks for your good extension :-)

Max1Truc commented 6 years ago

Hi, First, it's not my extension, it's @Rayquaza01's. Second, if you could give me an example database file or just table's name and columns' names, it should save me some time. Finally, you can see my work at #11.

Rayquaza01 commented 6 years ago

@shakasan I'm not really sure this fits in the scope of the extension, but I can see how it could be useful. I made a quick python script to convert GA databases here: https://gist.github.com/Rayquaza01/1d58fb8eb31714671bfeca85ea3936ec

It expects the GA database to be in the same folder as the script and named databases (the default name). It then drops a file named totp.json that can be imported into the extension. Let me know if you have any trouble getting it running.

@Max1Truc For future reference, the table is named accounts and the relevant columns are named email and secret, and here's a sample database: databases.zip

Max1Truc commented 6 years ago

Thanks @Rayquaza01.

I'm gonna code it.

Max1Truc commented 6 years ago

Hi @shakasan, Could you test this (JSFiddle) or this (Github's Gists) and speak about it with me? (It's just like Rayquaza01's python script but in HTML)

Max1Truc commented 6 years ago

Hey @shakasan ! I'm waiting for an answer to continue coding.

shakasan commented 6 years ago

@Max1Truc Sorry for my late reply ^^

I have tested it and the import seems to work well. The JSON file look ok. I added the resulted file (without keys of course ;) ) with some old examples.

{"otp_list":[{"name":"Makoto no Blog:makotosan","key":"my_key"},"name":"francois@domain.org","key":"my_key"}, {"name":"Hostens","key":"my_key"},{"name":"Makoto's Nextcloud:francois@domain.org/nextcloud","key":"my_key"},{"name":"root","key":"my_key"},{"name":"null","key":"my_key"}]}

Just a suggestion. Even if it's an exception, but as you can see in the example file, the CSAM-Login entry as no meaningful name in email/original_name columns, but has it in issuer column. Maybe it could be useful to add issuer name as name if email/original_name columns entries have useless values like null.

68109fdf2d1a9c043b3afd8275b6690e

Sorry again for late reply. If I can help more, just tell me :) Thanks again for your work and feedback :)

Max1Truc commented 6 years ago

Okay @shakasan No problem for your late reply. Could you try the new version on JSFiddle or with GitHub's Gists, please ?

Max1Truc commented 5 years ago

@shakasan Sorry, I won't have time to implement it into the extension, maybe somebody will ?

Edit : I write here the link to my JavaScript code on JSFiddle to help anybody who need it : https://jsfiddle.net/Max1Truc/hgfLb09c/

mrx23dot commented 3 weeks ago

.json is industry standard as I know. If you cannot export it as that then you could do a simple python script to convert it to json.