【发布时间】:2023-03-14 01:30:01
【问题描述】:
我想知道在synology NAS设备中有导出用户列表和密码的方法
【问题讨论】:
标签: synology
我想知道在synology NAS设备中有导出用户列表和密码的方法
【问题讨论】:
标签: synology
在Synology Forum中查看用户Greenstream的回答:
- 从 Synology 下载配置备份文件
- 将文件扩展名从 .cfg 更改为 .gzip
- 使用 7-Zip 或其他可从 gzip 存档中提取的实用程序解压缩文件
- 从http://sqlitebrowser.org/ 下载并安装 DB Browser for SQL Lite
- 在 DB Browser for SQL Lite 中打开提取的“_Syno_ConfBkp.db”文件
- 从顶部菜单栏中选择“文件”,然后选择“导出”,然后选择“导出为 csv”
- 在导出对话框中选择表 confbkp_user_tb
- 在选项中 一个。选择第一行中的列名,字段分隔符, 湾。引用字符" 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找到。
【讨论】: