Python script for ldapsearch base64 decode

The Python version below.

OpenLDAP 2.4: Read stored UTF-8 data http://yasu-2.blogspot.jp/2009/10/openldap-24-utf-8.html

Since it was an environment where ruby could not be installed, I made something that works with Python, which is often included by default. I wrote it while remembering Python in about 30 minutes, so I'm guessing the result. It takes longer to remember than to write ...

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 made it simple, so I reflected it. Thank you!)

Recommended Posts

Python script for ldapsearch base64 decode
AWS Layer Creation Script for python
Driver script for parametrically calculating Python scripts
[Python] Script useful for Excel / csv processing
2016-10-30 else for Python3> for:
python [for myself]
python script skeleton
Python script profiling
Base64 decode / encode
Import python script
About Python for loops
Image collection Python script for creating datasets for machine learning
Python basics ② for statement
About Python, for ~ (range)
python textbook for beginners
Refactoring tools for Python
Python Script for Hiroshima University Non-SSO Authentication Login / Logout
DynamoDB Script Memo (Python)
python for android Toolchain
OpenCV for Python beginners
Install Python (for Windows)
[Python] for statement error
Python environment for projects
Python> int ('1e3')> ValueError: invalid literal for int () with base 10: '1e3' / str (1e3)> '1000.0'
[For beginners] Script within 10 lines (4. Connection from python to sqlite3)
Create a Python script for Wake on LAN (NAT traversal Wake on LAN [5])
About Fabric's support for Python 3
Python list, for statement, dictionary
Base64 encoding images in Python 3
Python for Data Analysis Chapter 4
Modern Python for intermediate users
Learning flow for Python beginners
Python 3.6 installation procedure [for Windows]
POST json with Python3 script
BigQuery integration for Python users
Python learning plan for AI learning
Set Up for Mac (Python)
Bitcoin price monitor python script
Run illustrator script from python
Search for strings in Python
Python Tkinter notes (for myself)
OpenCV3 installation for Python3 @macOS
Python code memo for yourself
[Python] xmp tag for photos
Python environment construction For Mac
Techniques for sorting in Python
pp4 (python power for anything)
Python3 environment construction (for beginners)
Roadmap for publishing Python packages
Python 3 series installation for mac
Python #function 2 for super beginners
Python template for Codeforces-manual test-
Basic Python grammar for beginners
3 months note for starting Python
Qt for Python app self-update
Python for Data Analysis Chapter 2
100 Pandas knocks for Python beginners
Checkio's recommendation for learning Python
Keyword arguments for Python functions
[For organizing] Python development environment
[Python] Sample code for Python grammar