はじめに

何か面白そうなソフトないかなーと思って下記を見てみた。
https://packages.ubuntu.com/ja/jammy/admin/

apg という自動パスワード生成のパッケージがあるので使ってみる。

環境

1
2
3
Windows 10 Professional
WSL2 - (Ubuntu22.04 LTS)
apg version 2.2.3 (PRNG: X9.17/SHA-1)

apgのインストール

1
sudo apt-get install apg
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  golang-1.18 golang-1.18-doc golang-1.18-go golang-1.18-src golang-doc golang-go golang-src pkg-config
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  apg
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 41.3 kB of archives.
After this operation, 117 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 apg amd64 2.2.3.dfsg.1-5build2 [41.3 kB]
Fetched 41.3 kB in 1s (46.8 kB/s)
Selecting previously unselected package apg.
(Reading database ... 101949 files and directories currently installed.)
Preparing to unpack .../apg_2.2.3.dfsg.1-5build2_amd64.deb ...
Unpacking apg (2.2.3.dfsg.1-5build2) ...
Setting up apg (2.2.3.dfsg.1-5build2) ...
Processing triggers for man-db (2.10.2-1) ...
1
2
3
4
apg -v
APG (Automated Password Generator)
version 2.2.3 (PRNG: X9.17/SHA-1)
Copyright (c) 1999, 2000, 2001, 2002, 2003 Adel I. Mirzazhanov

随分と古い気がするが…。

apgを使う

まずは help を見てみる。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
apg -help

apg   Automated Password Generator
        Copyright (c) Adel I. Mirzazhanov

apg   [-a algorithm] [-r file]
      [-M mode] [-E char_string] [-n num_of_pass] [-m min_pass_len]
      [-x max_pass_len] [-c cl_seed] [-d] [-s] [-h] [-y] [-q]

-M mode         new style password modes
-E char_string  exclude characters from password generation process
-r file         apply dictionary check against file
-b filter_file  apply bloom filter check against filter_file
                (filter_file should be created with apgbfm(1) utility)
-p substr_len   paranoid modifier for bloom filter check
-a algorithm    choose algorithm
                 1 - random password generation according to
                     password modes
                 0 - pronounceable password generation
-n num_of_pass  generate num_of_pass passwords
-m min_pass_len minimum password length
-x max_pass_len maximum password length
-s              ask user for a random seed for password
                generation
-c cl_seed      use cl_seed as a random seed for password
-d              do NOT use any delimiters between generated passwords
-l              spell generated password
-t              print pronunciation for generated pronounceable password
-y              print crypted passwords
-q              quiet mode (do not print warnings)
-h              print this help screen
-v              print version information

なんとはなしにわかったので、20文字くらいのランダムパスワードを生成してみる。

1
2
3
-n : 生成する個数
-m : 最小の文字数
-x : 最大の文字数

下記で 20文字のランダムパスワードを 10個生成してみる。

1
apg -n 10 -m 20 -x 20
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
apg -n 10 -m 20 -x 20
quasyukyanyivikOsOr5
SkohymKetushyahagFil
DryidTuAdNeibogMufmy
DatshEijecCeamimLyb=
sopDaquajongAnGhonn!
cebdonujwuWaytyeaHai
AfuspevtyekFuOphghaj
igyinArpovPedUlonAt9
avyurrAsIvociteefNit
BifyunsEpdesUboapeef

それっぽいのでてきた。

参考

おわりに

ランダムパスワードはたまに使うのだが、ローカルで試験する用には使えそう。
強力なパスワードはブラウザとか端末が生成してくれるやつに頼ろう…。