当前位置: 技术问答>linux和unix
ldapsearch获取的值,如果有中文如何处理
来源: 互联网 发布时间:2017-01-03
本文导语: 我在linux系统下使用ldapsearch命令获取win2003搭设的AD域,如果里面包括姓名,获取的值为看起来像是base64加密的信息,而且使用c解码后,显示为乱码 linux下执行: ldapsearch -LLL -l 2 -h 172.16.1.125 -b "dc=testldap,dc=billion,...
我在linux系统下使用ldapsearch命令获取win2003搭设的AD域,如果里面包括姓名,获取的值为看起来像是base64加密的信息,而且使用c解码后,显示为乱码
linux下执行:
ldapsearch -LLL -l 2 -h 172.16.1.125 -b "dc=testldap,dc=billion,dc=com" -x -D 1 -w 1234567 objectClass=user
结果:
dn: CN=Administrator,CN=Users,DC=testldap,DC=billion,DC=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn: Administrator
description:: 566h55CG6K6h566X5py6KOWfnynnmoTlhoXnva7luJDmiLc=
distinguishedName: CN=Administrator,CN=Users,DC=testldap,DC=billion,DC=com
instanceType: 4
whenCreated: 20090223023905.0Z
whenChanged: 20090223031827.0Z
uSNCreated: 8194
memberOf: CN=Group Policy Creator Owners,CN=Users,DC=testldap,DC=billion,DC=co
m
memberOf: CN=Domain Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Enterprise Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Schema Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Administrators,CN=Builtin,DC=testldap,DC=billion,DC=com
uSNChanged: 16429
name: Administrator
objectGUID:: SAL7F7xWI0O6K5b5siGg/Q==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 128799266546833248
lastLogoff: 0
lastLogon: 128799279541919264
pwdLastSet: 128717571213682544
primaryGroupID: 513
objectSid:: AQUAAAAAAAUVAAAACzu45lMvkOh5D33u9AEAAA==
adminCount: 1
accountExpires: 9223372036854775807
logonCount: 20
sAMAccountName: Administrator
sAMAccountType: 805306368
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=testldap,DC=billion,DC
=com
isCriticalSystemObject: TRUE
dn:: Q0495p2OLENOPVVzZXJzLERDPXRlc3RsZGFwLERDPWJpbGxpb24sREM9Y29t
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn:: 5p2O
sn:: 5p2O
distinguishedName:: Q0495p2OLENOPVVzZXJzLERDPXRlc3RsZGFwLERDPWJpbGxpb24sREM9Y2
9t
instanceType: 4
whenCreated: 20090224054911.0Z
whenChanged: 20090224054911.0Z
displayName:: 5p2O
uSNCreated: 16545
uSNChanged: 16550
name:: 5p2O
objectGUID:: wn/693lxvEysyRVv47GbnQ==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 0
lastLogoff: 0
lastLogon: 0
pwdLastSet: 128799281515356928
primaryGroupID: 513
objectSid:: AQUAAAAAAAUVAAAACzu45lMvkOh5D33uagQAAA==
accountExpires: 9223372036854775807
logonCount: 0
sAMAccountName:: 5p2O
sAMAccountType: 805306368
userPrincipalName:: 5p2OQHRlc3RsZGFwLmJpbGxpb24uY29t
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=testldap,DC=billion,DC
=com
# refldap://ForestDnsZones.testldap.billion.com/DC=ForestDnsZones,DC=testldap
,DC=billion,DC=com
# refldap://DomainDnsZones.testldap.billion.com/DC=DomainDnsZones,DC=testldap
,DC=billion,DC=com
# refldap://testldap.billion.com/CN=Configuration,DC=testldap,DC=billion,DC=c
om
其中sAMAccountName:后面应该是中文,然而看起来我获得是base64加密后的编码
请问是否中文一定是用base64加密后送过来,还是其他加密方法?
另外我要把该信息用c处理,应该如何转化为utf8或者gb2312编码?
不甚感激!!!!
linux下执行:
ldapsearch -LLL -l 2 -h 172.16.1.125 -b "dc=testldap,dc=billion,dc=com" -x -D 1 -w 1234567 objectClass=user
结果:
dn: CN=Administrator,CN=Users,DC=testldap,DC=billion,DC=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn: Administrator
description:: 566h55CG6K6h566X5py6KOWfnynnmoTlhoXnva7luJDmiLc=
distinguishedName: CN=Administrator,CN=Users,DC=testldap,DC=billion,DC=com
instanceType: 4
whenCreated: 20090223023905.0Z
whenChanged: 20090223031827.0Z
uSNCreated: 8194
memberOf: CN=Group Policy Creator Owners,CN=Users,DC=testldap,DC=billion,DC=co
m
memberOf: CN=Domain Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Enterprise Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Schema Admins,CN=Users,DC=testldap,DC=billion,DC=com
memberOf: CN=Administrators,CN=Builtin,DC=testldap,DC=billion,DC=com
uSNChanged: 16429
name: Administrator
objectGUID:: SAL7F7xWI0O6K5b5siGg/Q==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 128799266546833248
lastLogoff: 0
lastLogon: 128799279541919264
pwdLastSet: 128717571213682544
primaryGroupID: 513
objectSid:: AQUAAAAAAAUVAAAACzu45lMvkOh5D33u9AEAAA==
adminCount: 1
accountExpires: 9223372036854775807
logonCount: 20
sAMAccountName: Administrator
sAMAccountType: 805306368
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=testldap,DC=billion,DC
=com
isCriticalSystemObject: TRUE
dn:: Q0495p2OLENOPVVzZXJzLERDPXRlc3RsZGFwLERDPWJpbGxpb24sREM9Y29t
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn:: 5p2O
sn:: 5p2O
distinguishedName:: Q0495p2OLENOPVVzZXJzLERDPXRlc3RsZGFwLERDPWJpbGxpb24sREM9Y2
9t
instanceType: 4
whenCreated: 20090224054911.0Z
whenChanged: 20090224054911.0Z
displayName:: 5p2O
uSNCreated: 16545
uSNChanged: 16550
name:: 5p2O
objectGUID:: wn/693lxvEysyRVv47GbnQ==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 0
lastLogoff: 0
lastLogon: 0
pwdLastSet: 128799281515356928
primaryGroupID: 513
objectSid:: AQUAAAAAAAUVAAAACzu45lMvkOh5D33uagQAAA==
accountExpires: 9223372036854775807
logonCount: 0
sAMAccountName:: 5p2O
sAMAccountType: 805306368
userPrincipalName:: 5p2OQHRlc3RsZGFwLmJpbGxpb24uY29t
objectCategory: CN=Person,CN=Schema,CN=Configuration,DC=testldap,DC=billion,DC
=com
# refldap://ForestDnsZones.testldap.billion.com/DC=ForestDnsZones,DC=testldap
,DC=billion,DC=com
# refldap://DomainDnsZones.testldap.billion.com/DC=DomainDnsZones,DC=testldap
,DC=billion,DC=com
# refldap://testldap.billion.com/CN=Configuration,DC=testldap,DC=billion,DC=c
om
其中sAMAccountName:后面应该是中文,然而看起来我获得是base64加密后的编码
请问是否中文一定是用base64加密后送过来,还是其他加密方法?
另外我要把该信息用c处理,应该如何转化为utf8或者gb2312编码?
不甚感激!!!!
|
显示的结果:中文字符转换为utf8再用base64
iconv命令和函数可以处理
可以用ldap其他工具找出具体中文,然后用iconv -f gb2312 -t utf8 file.txt >b.txt
然后再找个base64在线转换b.txt的查看下,是否跟ldapsearch显示结果一致
iconv命令和函数可以处理
可以用ldap其他工具找出具体中文,然后用iconv -f gb2312 -t utf8 file.txt >b.txt
然后再找个base64在线转换b.txt的查看下,是否跟ldapsearch显示结果一致
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。