LoginSignup
2
1

More than 5 years have passed since last update.

ldapsearch の base64 decode 用 Python スクリプト

Last updated at Posted at 2016-03-24

下記の Python 版。

OpenLDAP 2.4: 格納したUTF-8データの読み出し
http://yasu-2.blogspot.jp/2009/10/openldap-24-utf-8.html

ruby が入れられない環境だったので、デフォルトで入っていることが多い Python で動くものを作りました。
30分くらいで Python 思い出しながら書いたので出来はお察しです。
書く時間よりも思い出す時間の方が長いという…

lsuf.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import sys, re

for line in sys.stdin:
    if re.match(r'^\w+::\s', line):
        label, b64item = line.split()
        print label, b64item.decode('base64')
    else:
        sys.stdout.write(line)

@shiracamus さんがシンプルにしてくれたので反映しました。ありがとうございます!)

2
1
3

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
2
1