久々に叩くとオプションが増えてる
$ htpasswd --help Usage: htpasswd [-cimBdpsDv] [-C cost] passwordfile username htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password htpasswd -n[imBdps] [-C cost] username htpasswd -nb[mBdps] [-C cost] username password -c Create a new file. -n Don't update file; display results on stdout. -b Use the password from the command line rather than prompting for it. -i Read password from stdin without verification (for script usage). -m Force MD5 encryption of the password (default). -B Force bcrypt encryption of the password (very secure). -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31). -d Force CRYPT encryption of the password (8 chars max, insecure). -s Force SHA encryption of the password (insecure). -p Do not encrypt the password (plaintext, insecure). -D Delete the specified user. -v Verify password for the specified user. On other systems than Windows and NetWare the '-p' flag will probably not work. The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
shaがinsecure?と思ったら
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
なるほど
ということは -B -C 31
とかが一番硬い?
しかし失敗?
$ sudo -u www-data htpasswd -c -B -C 31 ./.htpasswd user New password: Re-type new password: htpasswd: Unable to encode with bcrypt: Invalid argument
17までぽい?
$ sudo -u www-data htpasswd -c -B -C 18 ./.htpasswd user New password: Re-type new password: htpasswd: Unable to encode with bcrypt: Invalid argument $ sudo -u www-data htpasswd -c -B -C 17 .htpasswd user New password: Re-type new password: Adding password for user user
$ dpkg -S `which htpasswd` apache2-utils: /usr/bin/htpasswd $ dpkg-query -W apache2-utils apache2-utils 2.4.38-3 $ lsb_release -dr Description: Debian GNU/Linux 10 (buster) Release: 10 $ uname -m x86_64
この辺のファイルがそれっぽい
$ ls -l ~/.local/share/qutebrowser/history.sqlite* -rw-r--r-- 1 matoken matoken 17219584 Aug 16 12:19 /home/matoken/.local/share/qutebrowser/history.sqlite -rw-r--r-- 1 matoken matoken 32768 Aug 18 17:33 /home/matoken/.local/share/qutebrowser/history.sqlite-shm -rw-r--r-- 1 matoken matoken 4132392 Aug 18 17:21 /home/matoken/.local/share/qutebrowser/history.sqlite-wal $ file ~/.local/share/qutebrowser/history.sqlite* /home/matoken/.local/share/qutebrowser/history.sqlite: SQLite 3.x database, user version 2, last written using SQLite version 3029000 /home/matoken/.local/share/qutebrowser/history.sqlite-shm: data /home/matoken/.local/share/qutebrowser/history.sqlite-wal: SQLite Write-Ahead Log, version 3007000
壊すといけないので手元に持ってくる
$ cp ~/.local/share/qutebrowser/history.sqlite* .
当たりぽい
$ sqlite3 ./history.sqlite sqlite> .schema CREATE TABLE History (url NOT NULL, title NOT NULL, atime NOT NULL, redirect NOT NULL); CREATE TABLE CompletionHistory (url PRIMARY KEY, title NOT NULL, last_atime NOT NULL); CREATE INDEX CompletionHistoryAtimeIndex ON CompletionHistory (last_atime); CREATE TABLE CompletionMetaInfo (key PRIMARY KEY, value ); CREATE INDEX HistoryIndex ON History (url); CREATE INDEX HistoryAtimeIndex ON History (atime);
OKぽい
$ sqlite3 -header ./history.sqlite 'SELECT * from History' | head url|title|atime|redirect https://start.duckduckgo.com/|DuckDuckGo — Privacy, simplified.|1545516812|0 https://www.qutebrowser.org/quickstart.html|qutebrowser quickstart | qutebrowser|1545516812|0 https://www.qutebrowser.org/quickstart.html|qutebrowser quickstart | qutebrowser|1545516812|0 https://www.qutebrowser.org/quickstart.html|qutebrowser quickstart | qutebrowser|1545516814|0 https://www.qutebrowser.org/quickstart.html|qutebrowser quickstart | qutebrowser|1545516840|0 https://start.duckduckgo.com/|DuckDuckGo — Privacy, simplified.|1545516863|0 https://start.duckduckgo.com/|DuckDuckGo — Privacy, simplified.|1545516864|0 https://start.duckduckgo.com/|DuckDuckGo — Privacy, simplified.|1545516866|0 https://start.duckduckgo.com/|DuckDuckGo — Privacy, simplified.|1545516866|0
これはArchiveBoxのGoogle Chrome, Chromium, Firefox履歴書き出しscript 出力形式はこれ真似すれば良さそう
$ grep sqlite3 archivebox-export-browser-history sqlite3 "$REPO_DIR/output/sources/chrome_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', last_visit_time, 'description', title, 'href', url)) || \"]\" FROM urls;" > "$REPO_DIR/output/sources/chrome_history.json" sqlite3 "$REPO_DIR/output/sources/firefox_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', last_visit_date, 'description', title, 'href', url)) || \"]\" FROM moz_places;" > "$REPO_DIR/output/sources/firefox_history.json"
そのまま真似して……出来たぽい
$ sqlite3 "./history.sqlite" "SELECT \"[\" || group_concat(json_object('timestamp', atime, 'description', title, 'href', url)) || \"]\" from History;" | jq . | head [ { "timestamp": 1545516812, "description": "DuckDuckGo — Privacy, simplified.", "href": "https://start.duckduckgo.com/" }, { "timestamp": 1545516812, "description": "qutebrowser quickstart | qutebrowser", "href": "https://www.qutebrowser.org/quickstart.html"
$ tweeper https://twitter.com/matoken | xmllint --xpath "/rss/channel/item/title" - | nkf --numchar-input
コメント