TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

TOTP Codes in the Terminal

103 点作者 sea-gold大约 1 年前

20 条评论

evanb大约 1 年前
A pass[0] extension called pass-otp[1] can produce otp codes from the command line<p><pre><code> &gt; pass edit git&#x2F;hub [... put in your totp ...] otpauth:&#x2F;&#x2F;totp&#x2F;GitHub&#x2F;... </code></pre> then you can<p><pre><code> &gt; pass otp -c git&#x2F;hub Copied OTP code for git&#x2F;hub to clipboard. Will clear in 45 seconds. </code></pre> pass-otp is also compatible with the passff firefox plugin; not sure beyond that.<p>[0]: <a href="https:&#x2F;&#x2F;www.passwordstore.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.passwordstore.org&#x2F;</a><p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;tadfisher&#x2F;pass-otp">https:&#x2F;&#x2F;github.com&#x2F;tadfisher&#x2F;pass-otp</a>
评论 #39509718 未加载
评论 #39509991 未加载
评论 #39506358 未加载
评论 #39510451 未加载
评论 #39506194 未加载
coppsilgold大约 1 年前
KeePassXC[1] password manager supports TOTP and I use it for that purpose in addition to storing passwords. It never made sense to me to use an app like Authy.<p>I suspect most people make the assumption that an Authenticator app is something special that needs to talk to the service that issued the QR code&#x2F;secret string.<p>It&#x27;s nothing more than a SHA1 hash of a secret string and an adjusted current time.<p>[1] &lt;<a href="https:&#x2F;&#x2F;keepassxc.org" rel="nofollow">https:&#x2F;&#x2F;keepassxc.org</a>&gt;
评论 #39506515 未加载
评论 #39506197 未加载
评论 #39506307 未加载
评论 #39509553 未加载
xyzzy_plugh大约 1 年前
Several comments here suggesting that using password managers for TOTP defeats the purpose of TOTP as a second factor. I don&#x27;t agree.<p>I strongly prefer other factors (U2F&#x2F;FIDO(2)&#x2F;WebAuthn&#x2F;Passkeys&#x2F;whatever) but unfortunately TOTP is still extremely prevalent. Worse is when only a single secondary factor can be registered, in which case even if something other than SMS or TOTP is available, I slightly bias away from hardware security tokens in order to have a clear recovery path. I can at least back up most TOTP keys.<p>I agree that having a second vault for TOTP seems superior but from a UX and recovery perspective it&#x27;s not so clear. Are both vaults available on all devices? Are they usually unlocked simultaneously? Is it likely that one vault but not the other would be stolen? Or you have a separate device or air-gap and now the usability adds friction. It seems like diminishing returns.<p>Conversely a single vault still offers significant protection from many attack vectors, including keyloggers and phishing. Even if access is obtained via MITM&#x27;ing a TOTP, the blast radius is often limited to a single session. Many services have poor session security, once established, but many do not. And in my experience it&#x27;s still nearly impossible to get rid of SMS 2FA.<p>TOTP is almost always strictly better than SMS 2FA, and storing your TOTP keys alongside your passwords doesn&#x27;t really diminish the effectiveness of TOTP very much at all. Unless you have the keys themselves exposed, they&#x27;re still closer to &quot;something you have&quot; than &quot;something you know&quot;, at least from where I&#x27;m sitting.<p>Their main weakness is that they can be backed up or copied at all, as well as MITM&#x27;d. How I securely store them doesn&#x27;t have much impact.
评论 #39507680 未加载
评论 #39507678 未加载
评论 #39508104 未加载
评论 #39507394 未加载
mistrial9大约 1 年前
TOTP codes acceptable to Github etc. can be generated via<p><pre><code> oathtool - Open AuTHentication (OATH) one-time password tool OATH Toolkit provide components to build one-time password authentication systems. It contains shared C libraries, command line tools and a PAM module. Supported technologies include the event-based HOTP algorithm (RFC 4226), the time-based TOTP algorithm (RFC 6238), and Portable Symmetric Key Container (PSKC, RFC 6030) to manage secret key data. OATH stands for Open AuTHentication, which is the organization that specify the algorithms.</code></pre>
评论 #39507271 未加载
cypherpunks01大约 1 年前
PSA: Authy Desktop is being killed off this year, which could mean the last opportunity to export your tokens out of Authy (for migration, or for external backup)<p>There are a few gists floating around regarding how to export by remote chrome debugging an older version of Authy desktop app, which still worked for me recently. This page explains too:<p><a href="https:&#x2F;&#x2F;jaketrent.com&#x2F;post&#x2F;export-authy-desktop-data&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jaketrent.com&#x2F;post&#x2F;export-authy-desktop-data&#x2F;</a>
评论 #39509834 未加载
评论 #39509051 未加载
TacticalCoder大约 1 年前
I wrote once many years ago, showing me all my TOTP codes in a terminal. I&#x27;d run it on a text-only offline&#x2F;airgapped Raspberry Pi (an old one, with not even WiFi capabilities).<p>I was also pissed off by the clock issue, so I&#x27;d show both the previous, present and next code to come: because it&#x27;s really a PITA when you see 213987 but you&#x27;ve got only two seconds left before it rolls. So I may as well start entering the next code (what the server accept is something not in my control).<p>And I always, always, always have a known, public, 2FA which I can use to double-check that everything is smooth (for example by entering it on some online computer and verifying that I get the same tokens generated).<p>I just reused whatever 2FA&#x2F;TOTP Java library I found and wrapped that in a little CLI utility.<p>My secrets were unlocked by entering a password when I&#x27;d start the app.
评论 #39506527 未加载
timenova大约 1 年前
For people storing One-Time Passwords in 1Password, you can access them in the terminal too:<p><pre><code> op item get &lt;item_name&gt; --otp </code></pre> To copy to clipboard just use pbcopy or xclip:<p><pre><code> op item get &lt;item_name&gt; --otp | pbcopy # MacOS op item get &lt;item_name&gt; --otp | xclip -sel c # Linux</code></pre>
评论 #39506873 未加载
4hg4ufxhy大约 1 年前
Implementing TOTP is a fun exercise to learn crypto. But key storage is a bit more interesting as it has so many different approaches and trade offs.
评论 #39506411 未加载
normaler大约 1 年前
I use aegis (previously i used andotp) and backup to a folder shared via syncthing. This allows me to usw OT via andotp -cli in emergency vor to use it in a new phone. For some i also use keepassxc (my credential&#x2F;information store.) but the important ones. I prefer yubikeys, but keep totp AS a backup mechanism when i can add two methods.
forgetm3大约 1 年前
I don&#x27;t like having TOTP codes available on any connected devices so I got one of these little offline authenticators.<p><a href="https:&#x2F;&#x2F;shop.reiner-sct.com&#x2F;authenticator&#x2F;reiner-sct-authenticator-mini" rel="nofollow">https:&#x2F;&#x2F;shop.reiner-sct.com&#x2F;authenticator&#x2F;reiner-sct-authent...</a>
lloeki大约 1 年前
A few years back, on a limb, as a quick experiment a coworker of mine (github.com&#x2F;jkirsteins) wrote `twofa`.<p>Surprisingly usable for a few day&#x27;s worth of hacking around!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;sqreen&#x2F;twofa">https:&#x2F;&#x2F;github.com&#x2F;sqreen&#x2F;twofa</a>
iamawacko大约 1 年前
rbw (a terminal client for Bitwarden) can also generate totp codes.
评论 #39506298 未加载
评论 #39506406 未加载
macropin大约 1 年前
YubiKeys support cli access with the benefit of being hardware backed, and optionally requiring a physical touch:<p><pre><code> $ ykman oath accounts code &lt;slot&gt; Touch your YubiKey...</code></pre>
markuman123大约 1 年前
I store my TOTP secrets in the Gnome Keyring<p><pre><code> totp() { TOKEN=$(keyring get totp $1) oathtool -b --totp $TOKEN | xclip } </code></pre> and my TOTP secrets are saved via ansible-vault<p><pre><code> - name: set TOTP in keyring with_items: &quot;{{ TOTP }}&quot; community.general.keyring: service: totp username: &quot;{{ item }}&quot; password: &quot;{{ TOTP[item] }}&quot; keyring_password: &quot;{{ keyring_password }}&quot;</code></pre>
评论 #39508864 未加载
tyingq大约 1 年前
Python includes libraries that match up with the needs well, so a python TOTP generator can be pretty small, 30 lines in this case...and not too golfed:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;susam&#x2F;mintotp&#x2F;blob&#x2F;main&#x2F;mintotp.py">https:&#x2F;&#x2F;github.com&#x2F;susam&#x2F;mintotp&#x2F;blob&#x2F;main&#x2F;mintotp.py</a>
granddave大约 1 年前
I&#x27;ve written a similar tool for the Aegis backup file that lets you fuzzy find entries, auto generation of codes and includes clipboard support.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Granddave&#x2F;aegis-rs">https:&#x2F;&#x2F;github.com&#x2F;Granddave&#x2F;aegis-rs</a>
phyzome大约 1 年前
Frankly, I&#x27;m glad Authy Desktop is dead. It didn&#x27;t allow exporting of TOTP secrets, so migrating off of it was a pain. I&#x27;ve been much, much happier with a tiny shell alias to oathtool and gpg.<p>For extra benefit, bind a keyboard shortcut and use xsel (Linux) or pbcopy (Mac) to drop the TOTP code into the clipboard. Now entering a frequent TOTP code is as simple as two keyboard chords.<p>(I only do this because my employer offers very limited options for MFA and I don&#x27;t have a smartphone. I&#x27;d much rather use the Yubikeys I already have...)
评论 #39509191 未加载
jeffrallen大约 1 年前
Users of 1Password with Dropbox sync can get TOTP in a terminal window with GitHub.com&#x2F;jeffallen&#x2F;1pw<p>It is a crude hack, but it works for me.
Sarkie大约 1 年前
Sadly nothing to do with Top Of The Pops
评论 #39508808 未加载
BiteCode_dev大约 1 年前
tetripin does that too, but you have to pip install it.