diff --git a/nselib/smb.lua b/nselib/smb.lua index 97e374dff..a310b0669 100644 --- a/nselib/smb.lua +++ b/nselib/smb.lua @@ -117,6 +117,7 @@ -- to be the same protocol as port 445, not port 139. Since it probably isn't possible to change -- Windows' ports normally, this is mostly useful if you're bouncing through a relay or something. -- @args randomseed Set to a value to change the filenames/service names that are randomly generated. +-- @args smbnativeos Set the value of "Native OS", if not set, defaults to "Nmap". -- -- @author Ron Bowes -- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html @@ -1158,6 +1159,7 @@ local function start_session_basic(smb, log_errors, overrides) local os, lanmanager local username, domain, password, password_hash, hash_type local busy_count = 0 + local nativeos header = smb_encode_header(smb, command_codes['SMB_COM_SESSION_SETUP_ANDX'], overrides) @@ -1173,6 +1175,13 @@ local function start_session_basic(smb, log_errors, overrides) result, username, domain, password, password_hash, hash_type = smbauth.get_account(smb['host']) end + -- Get the value of Native OS or set to default + if (nmap.registry.args.smbnativeos ~= nil) then + nativeos = nmap.registry.args.smbnativeos + else + nativeos = "Nmap" + end + while result ~= false do local lanman, ntlm @@ -1199,7 +1208,7 @@ local function start_session_basic(smb, log_errors, overrides) .. string.pack("