3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ワンライナーでldapsearchの結果表示をいい感じに日本語表示(base64デコード)する

Last updated at Posted at 2019-12-28

#前提
・CentOS7系のOpenLDAPを使用

#コマンド
以下内容でldapsearchを実行すると、通常base64でエンコードされている内容がきれいにデコードされた状態となります。
※ldapsearchコマンドの各オプションは適宜編集してください。

ldapsearch -x -D "cn=Directory Manager,dc=hoge,dc=local" -h localhost -w hogehoge -b dc=hoge,dc=local uid=hoge | perl -MMIME::Base64 -MEncode=decode -n -00 -e 's/\n +//g;s/(?<=:: )(\S+)/decode("UTF-8",decode_base64($1))/eg;print'
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?