1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 20:09:02 +00:00

Change more bin lib to string packing/fromhex. Closes #755. Closes #769

This commit is contained in:
dmiller
2017-03-25 13:39:44 +00:00
parent d66dd69df2
commit 0e7f11673c
24 changed files with 50 additions and 50 deletions

View File

@@ -74,7 +74,7 @@ function action(host,port)
-- In order to discover what protocol to use (SSL/TCP) we need to send a
-- few bytes to the server. An anonymous bind should do it
local anon_bind = bin.pack("H", "300c020101600702010304008000" )
local anon_bind = stdnse.fromhex( "300c020101600702010304008000" )
local socket, _, opt = comm.tryssl( host, port, anon_bind, nil )
if ( not(socket) ) then
return fail("Failed to connect to LDAP server")
@@ -98,13 +98,13 @@ function action(host,port)
-- The following section could do with more documentation
-- It's based on packet dumps from the getpass utility available from Novell Cool Solutions
-- encode the account name as a sequence
data = ldap.encode( { _ldaptype = '30', bin.pack("H", "020101") .. data } )
data = ldap.encode( { _ldaptype = '30', stdnse.fromhex( "020101") .. data } )
data = ldap.encode( { _ldaptype = '81', data } )
data = ldap.encode( { _ldaptype = '80', NMASLDAP_GET_PASSWORD_REQUEST } ) .. data
data = ldap.encode( { _ldaptype = '77', data } )
-- encode the whole extended request as a sequence
data = ldap.encode( { _ldaptype = '30', bin.pack("H", "020102") .. data } )
data = ldap.encode( { _ldaptype = '30', stdnse.fromhex( "020102") .. data } )
status = socket:send(data)
if ( not(status) ) then return fail("Failed to send request") end