diff --git a/nselib/asn1.lua b/nselib/asn1.lua index 15874fd8b..2620024ef 100644 --- a/nselib/asn1.lua +++ b/nselib/asn1.lua @@ -454,7 +454,7 @@ function BERtoInt(class, constructed, number) local asn1_type = class + number - if constructed == true then + if constructed then asn1_type = asn1_type + 32 end diff --git a/nselib/brute.lua b/nselib/brute.lua index 2c48f2eed..aad0c62e7 100644 --- a/nselib/brute.lua +++ b/nselib/brute.lua @@ -1145,7 +1145,7 @@ Engine = { end end - if stagnated == true then + if stagnated then stagnation_count = stagnation_count + 1 -- If we get inside `if` below, then we are not making any diff --git a/nselib/ipOps.lua b/nselib/ipOps.lua index dbfd54622..35312886c 100644 --- a/nselib/ipOps.lua +++ b/nselib/ipOps.lua @@ -56,7 +56,7 @@ isPrivate = function( ip ) for _, range in ipairs( ipv6_private ) do is_private, err = ip_in_range( ip, range ) - if is_private == true then + if is_private then return true, range end if err then @@ -79,7 +79,7 @@ isPrivate = function( ip ) elseif ip:sub(1,4) == '172.' then local p, e = ip_in_range(ip, '172.16/12') - if p == true then + if p then return true, '172.16/12' else return p, e diff --git a/nselib/msrpc.lua b/nselib/msrpc.lua index cfad707de..f6bdffd88 100644 --- a/nselib/msrpc.lua +++ b/nselib/msrpc.lua @@ -473,7 +473,7 @@ function call_function(smbstate, opnum, arguments) -- No longer the 'first' first = false - until is_last == true + until is_last result['arguments'] = arguments @@ -4148,13 +4148,13 @@ function lsa_enum_users(host) -- Get the server's name from nbstat local result, server_name = netbios.get_server_name(host.ip) - if(result == true) then + if result then names[#names + 1] = server_name end -- Get the logged in user from nbstat local result, user_name = netbios.get_user_name(host.ip) - if(result == true) then + if result then names[#names + 1] = user_name end diff --git a/nselib/msrpctypes.lua b/nselib/msrpctypes.lua index 31e56f466..9c5a60cd6 100644 --- a/nselib/msrpctypes.lua +++ b/nselib/msrpctypes.lua @@ -149,7 +149,7 @@ function string_to_unicode(string, do_null) local result = unicode.utf8to16(string) -- Add a null, if the caller requested it - if(do_null == true) then + if do_null then result = result .. "\0\0" end @@ -338,7 +338,7 @@ local function unmarshall_ptr(location, data, pos, func, args, result) end if(location == BODY or location == ALL) then - if(result == true) then + if result then pos, result = func(data, pos, table.unpack(args)) else result = nil @@ -866,6 +866,7 @@ end --@param pad [optional] If set, will remove extra bytes to align the packet, Default: true --@return (pos, int16) The new position, and the value. function unmarshall_int16(data, pos, pad) + if pad == nil then pad = true end local value stdnse.debug4("MSRPC: Entering unmarshall_int16()") @@ -877,7 +878,7 @@ function unmarshall_int16(data, pos, pad) end value, pos = string.unpack("