python mOTP
1.0.0
如果您需要使用 Mobile-OTP / mOTP 演算法從命令列產生一次性密碼,而無需擺弄手機。
這是一種自稱為一次性密碼的「標準」演算法。它令人困惑,看起來幾乎已經過時,並且似乎主要在德語國家使用。您不想使用此代碼,除非您被迫與使用此類代碼進行 2FA 的現有系統進行互動。
似乎支援它的行動應用程式:
適用於 iOS 的 Swiss SafeLab OTP 驗證器:在 iTunes 上
適用於 Android 的 Swiss SafeLab OTP 驗證器:APK 免費下載
支援該演算法的Android應用程式:Google Play Store上的DroidOTP
該演算法的原理解釋得很糟糕,實現也很混亂,但它非常簡單:你有一個令牌秘密(一個ASCII 字串,通常是十六進製或字母數字)和一個PIN(一個ASCII 字串,通常是4 位數字),並將其轉換為6 位數字代碼使用:
counter = ASCII((UNIX epoch time) / 10s) digest = MD5HEX(counter || secret || pin) code = LEFT(digest, 6 characters)
就是這樣。 ˙_(ツ)_/˙
需要 Python 3.x。
$ ./motp.py SECRET PIN a1b329
更詳細地說:
$ ./motp.py -v SECRET PIN Epoch time: 1549323786 Counter: 154932378 a1b329 (current)
所有可用選項:
$ ./motp.py --help usage: motp.py [-h] [-s SECONDS] [-l LENGTH] [-w WINDOW] [-v] secret pin positional arguments: secret mOTP secret value (often hex or alphanumeric digits) pin mOTP PIN value (usually 4 digits) optional arguments: -h, --help show this help message and exit -s SECONDS, --seconds SECONDS Duration of mOTP codes in seconds (default 30 seconds) -l LENGTH, --length LENGTH Length of mOTP output (default 6 characters) -w WINDOW, --window WINDOW Number of counter values before and after current one to show (for testing time-skew) -v, --verbose
麻省理工學院