我想知道Synology NAS设备中存在导出用户列表和密码的方法
请参阅Synology Forum中Greenstream用户的答案:
- 从Synology下载配置备份文件
- 将文件扩展名从.cfg更改为.gzip
- 使用7-Zip或其他可以从gzip存档中提取的实用程序解压缩文件
- [从http://sqlitebrowser.org/下载并安装用于SQL LIte的DB浏览器
- 在数据库浏览器中打开用于SQL Lite的提取的__Syno_ConfBkp.db文件
- 从顶部菜单栏中选择文件,然后导出,然后导出为csv
- 在导出对话框中,选择表confbkp_user_tb
- 在选项中一种。在第一行中选择列名称,字段分隔符,b。引用字符“C。新行字符“ Windows:CR + LF(\ r \ n)”
- 将文件保存到桌面并在Excel中打开
基于ldap2csv.py和How to retrieve all the attributes of LDAP database,使用python-ldap确定可用属性:
#!/usr/bin/python
import ldap
host = 'ldap://[ip]:389' # [ip]: The ip/name of the NAS, using the default port
dn = 'uid=[uid],cn=[cn],dc=[dc]' # LDAP Server Settings: Authentication Information / Bind DN
pw = '[password]' # LDAP Server Settings: Password
base_dn = 'dc=[dc]' # LDAP Server Settings: Authentication Information / Base DN
filter = '(uid=*)' # Get all users
attrs = ['cn', 'uid', 'uidNumber', 'gidNumber', 'homeDirectory', 'userPassword', 'loginShell', 'gecos', 'description']
con = ldap.initialize(host)
con.simple_bind_s(dn, pw)
res = con.search_s(base_dn, ldap.SCOPE_SUBTREE, filter, attrs)
con.unbind()
print(res)
可以找到使用的端口here。