Created
April 17, 2021 10:38
-
-
Save ajdiaz/86af345e27b84b09536a05ac9b0161d0 to your computer and use it in GitHub Desktop.
Python script which convert plain text backup from Aegis OTP to andOTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © 2021 Andrés J. Díaz <ajdiaz@ajdiaz.me> | |
# | |
# Distributed under terms of the MIT license. | |
import sys | |
import time | |
import json | |
def main(): | |
aegis = json.load(sys.stdin) | |
andotp = [] | |
for item in aegis['db']['entries']: | |
andotp.append({ | |
"secret": item['info']['secret'], | |
"issuer": item['issuer'], | |
"label": item['name'], | |
"digits": item['info']['digits'], | |
"type": item['type'].upper(), | |
"algorithm": item['info']['algo'], | |
"thumbnail": item['issuer'], | |
"last-used": int(time.time()), | |
"used_frequency": 0, | |
"period": item['info']['period'], | |
"tags": [], | |
}) | |
print(json.dumps(andotp)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment