Change explicit X==true to X
Some checks are pending
nmap multiplatform autobuilds / build (arm64, gcc, ubuntu-latest-gcc-arm64, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, freebsd-15-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, macos-15-clang, macos-15) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, macos-26-clang, macos-26) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, netbsd-10-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, openbsd-7-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, solaris-11-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, ubuntu-latest-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (egcc, openbsd-7-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, freebsd-15-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, netbsd-10-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, solaris-11-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, ubuntu-latest-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (msvc, windows-latest-msvc, windows-latest) (push) Waiting to run

This commit is contained in:
dmiller 2026-07-08 00:42:18 +00:00
parent ce2b1e6d39
commit b47e7f07ef
23 changed files with 60 additions and 59 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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("<I2", data, pos)
if(pad == nil or pad == true) then
if pad then
pos = pos + 2
end
@ -893,6 +894,7 @@ end
--@param pad [optional] If set, will remove extra bytes to align the packet, Default: true
--@return (pos, int8) The new position, and the value.
function unmarshall_int8(data, pos, pad)
if pad == nil then pad = true end
local value
stdnse.debug4("MSRPC: Entering unmarshall_int8()")
@ -904,7 +906,7 @@ function unmarshall_int8(data, pos, pad)
end
value, pos = string.unpack("<B", data, pos)
if(pad == nil or pad == true) then
if pad then
pos = pos + 3
end
@ -1064,6 +1066,7 @@ end
-- true.
--@return (pos, str) The position, and the resulting string, which cannot be nil.
function unmarshall_int8_array(data, pos, pad)
if pad == nil then pad = true end
local max, offset, actual
local str
@ -1083,7 +1086,7 @@ function unmarshall_int8_array(data, pos, pad)
str, pos = string.unpack("<c"..actual, data, pos)
-- Do the alignment (note the "- 1", it's there because of 1-based arrays)
if(pad == nil or pad == true) then
if pad then
while(((pos - 1) % 4) ~= 0) do
pos = pos + 1
end

View file

@ -91,13 +91,7 @@ end
-- @param status boolean value is given as input.
-- @return Returns 0/1 based on the given boolean input.
local function boolToNum(status)
if status == true then
return 1
else
return 0
end
return status and 1 or 0
end
-- This function converts a basic code point into a digit/integer.

View file

@ -463,7 +463,7 @@ Comm = {
pos = pos + length
data = bufcopy
until (lastfragment == true) or (retries == 0)
until lastfragment or retries == 0
if retries == 0 then
return false, "Aborted after too many retries"

View file

@ -285,7 +285,7 @@ function start(host)
nbcache_mutex "lock"
if ( not(host.registry['netbios_name']) ) then
status, result = netbios.get_server_name(host.ip)
if(status == true) then
if status then
host.registry['netbios_name'] = result
state['name'] = result
end
@ -363,11 +363,11 @@ function start_ex(host, bool_negotiate_protocol, bool_start_session, str_tree_co
end
-- Disable extended security if it was requested
if(bool_disable_extended == true) then
if bool_disable_extended then
disable_extended(smbstate)
end
if(bool_negotiate_protocol == true) then
if bool_negotiate_protocol then
-- Negotiate the protocol
status, err = negotiate_protocol(smbstate, overrides)
if not status then
@ -375,7 +375,7 @@ function start_ex(host, bool_negotiate_protocol, bool_start_session, str_tree_co
return false, err
end
if(bool_start_session == true) then
if bool_start_session then
-- Start up a session
status, err = start_session(smbstate, overrides)
if not status then
@ -523,7 +523,7 @@ function start_netbios(host, port, name)
-- Get the name of the server from NetBIOS
status, name = netbios.get_server_name(host.ip)
if(status == true) then
if status then
names[#names + 1] = name
end
@ -657,7 +657,7 @@ function smb_encode_header(smb, command, overrides)
end
if(smb['extended_security'] == true) then
if smb['extended_security'] then
flags2 = (flags2 | 0x0800) -- SMB_EXTENDED_SECURITY
end
@ -834,6 +834,7 @@ end
-- removed). If status is false, header contains an error message and parameters/
-- data are undefined.
function smb_read(smb, read_data)
if read_data == nil then read_data = true end
local pos, netbios_data, netbios_length, length, header, parameter_length, parameters, data_length, data
stdnse.debug3("SMB: Receiving SMB packet")
@ -893,7 +894,7 @@ function smb_read(smb, read_data)
data_length, pos = string.unpack("<I2", result, pos)
-- Read that many bytes of data.
if(read_data == nil or read_data == true) then
if read_data then
if (length - pos + 1) < data_length then
return false, "SMB: ERROR: data_length greater than response length"
end
@ -1019,7 +1020,7 @@ function negotiate_v1(smb, overrides)
end
-- Data section
if(smb['extended_security'] == true) then
if smb['extended_security'] then
if #data < 16 then
return false, "SMB: ERROR: not enough data for extended security"
end
@ -1151,6 +1152,7 @@ end
--- This is an internal function and should not be called externally. Use
-- the start_session() function instead.
local function start_session_basic(smb, log_errors, overrides)
if log_errors == nil then log_errors = true end
local i, err
local status, result
local header, parameters, data, domain
@ -1254,7 +1256,7 @@ local function start_session_basic(smb, log_errors, overrides)
end
-- Check if they were logged in as a guest
if(log_errors == nil or log_errors == true) then
if log_errors then
if(smb['is_guest'] == 1) then
stdnse.debug1("SMB: Login as %s\\%s failed, but was given guest access (username may be wrong, or system may only allow guest)", domain, stdnse.string_or_blank(username))
else
@ -1281,7 +1283,7 @@ local function start_session_basic(smb, log_errors, overrides)
stdnse.sleep(backoff)
else
-- This username failed, print a warning and keep going
if(log_errors == nil or log_errors == true) then
if log_errors then
stdnse.debug1("SMB: Login as %s\\%s failed (%s)", domain, stdnse.string_or_blank(username), get_status_name(status))
end
@ -1310,6 +1312,7 @@ end
--- This is an internal function and should not be called externally. Use
-- the start_session() function instead.
local function start_session_extended(smb, log_errors, overrides)
if log_errors == nil then log_errors = true end
local i
local status, status_name, result, err
local header, parameters, data
@ -1493,7 +1496,7 @@ local function start_session_extended(smb, log_errors, overrides)
end
-- Check if they were logged in as a guest
if(log_errors == nil or log_errors == true) then
if log_errors then
if(smb['is_guest'] == 1) then
stdnse.debug1("SMB: Extended login to %s as %s\\%s failed, but was given guest access (username may be wrong, or system may only allow guest)", smb['ip'], domain, stdnse.string_or_blank(username))
else
@ -1522,7 +1525,7 @@ local function start_session_extended(smb, log_errors, overrides)
stdnse.sleep(backoff)
else
-- Display a message to the user, and try the next account
if(log_errors == nil or log_errors == true) then
if log_errors then
stdnse.debug1("SMB: Extended login to %s as %s\\%s failed (%s)", smb['ip'], domain, stdnse.string_or_blank(username), status_name)
end
@ -1543,7 +1546,7 @@ local function start_session_extended(smb, log_errors, overrides)
end -- Loop over the accounts
if(log_errors == nil or log_errors == true) then
if log_errors then
stdnse.debug1("SMB: ERROR: All logins failed, sorry it didn't work out!")
end
@ -1580,7 +1583,7 @@ function start_session(smb, overrides, log_errors)
smb_auth_mutex( "lock" )
local status, result
if(smb['extended_security'] == true) then
if smb['extended_security'] then
status, result = start_session_extended(smb, log_errors, overrides)
else
status, result = start_session_basic(smb, log_errors, overrides)
@ -3196,7 +3199,7 @@ function share_get_details(host, share)
-- Check if the anonymous reader can read the share
stdnse.debug1("SMB: Checking if share %s can be read by the anonymous user", share)
status, result = share_anonymous_can_read(host, share)
if(status == true) then
if status then
details['anonymous_can_read'] = result
end
@ -3217,7 +3220,7 @@ function share_get_details(host, share)
status, result = share_anonymous_can_write(host, share)
if not status and result == "NT_STATUS_OBJECT_NAME_NOT_FOUND" then
details['anonymous_can_write'] = "NT_STATUS_OBJECT_NAME_NOT_FOUND"
elseif( status == true ) then
elseif status then
details['anonymous_can_write'] = result
end
@ -3339,7 +3342,7 @@ function share_find_writable(host)
end
for i = 1, #shares, 1 do
if(shares[i]['user_can_write'] == true) then
if shares[i]['user_can_write'] then
if(main_name == nil) then
main_name = shares[i]['name']
@ -3429,7 +3432,7 @@ function get_os(host)
-- Start another session with extended security. This will allow us to get
-- additional information about the target.
status, smbstate = start_ex(host, true, true, nil, nil, false)
if(status == true) then
if status then
-- See if we actually got something
if (smbstate['fqdn'] or smbstate['domain_dns'] or smbstate['forest_dns']) then
response['fqdn'] = smbstate['fqdn']

View file

@ -174,6 +174,7 @@ end
---
function smb2_read(smb, read_data)
stdnse.debug3("SMB2: Receiving SMB2 packet")
if read_data == nil then read_data = true end
-- Receive the response -- we make sure to receive at least 4 bytes, the length of the NetBIOS length
smb['socket']:set_timeout(TIMEOUT)
@ -217,7 +218,7 @@ function smb2_read(smb, read_data)
-- Read the data section or skip it if read_data is false.
local data
if(read_data == nil or read_data == true) then
if read_data then
data = result:sub(pos)
end

View file

@ -298,7 +298,7 @@ fetch_host_key = function( host, port, key_type )
-- end
local payload
if kexdh_gex_used == true then
if kexdh_gex_used then
payload = transport.kexdh_gex_init( e )
else
payload = transport.kexdh_init( e )

View file

@ -634,7 +634,7 @@ end
local filter_vulns = function(filters_db, vuln_table)
local FIDS = {}
for fid, callback in ipairs(filters_db) do
if callback(vuln_table) == true then
if callback(vuln_table) then
FIDS[#FIDS + 1] = fid
end
end

View file

@ -261,7 +261,7 @@ local ospfReplyDBDesc = function(interface, mac_dst, db_desc_in)
local db_desc_out = ospf.OSPF.DBDescription:new()
db_desc_out = ospfSetHeader(db_desc_in, db_desc_out)
if db_desc_in.init == true then
if db_desc_in.init then
db_desc_out.init = false
db_desc_out.more = db_desc_in.more
db_desc_out.master = false

View file

@ -170,7 +170,7 @@ action = function()
local results = { ["name"] = ("Available authentication methods with identity=\"%s\" on interface %s"):format(identity.name, iface.device) }
for i,v in pairs(identity.auth) do
if v== true then
if v then
table.insert(results, 1, ("%-8s %s"):format(tostring(v), eap.eap_str[i] or "unassigned" ))
else
table.insert(results, ("%-8s %s"):format(tostring(v), eap.eap_str[i] or "unassigned" ))

View file

@ -76,7 +76,7 @@ local callback_url = function(host, port, target, callback_variable)
local status, func
status, func = checkjson(response.body)
if status == true then
if status then
if func == value then
report = "Completely controllable from URL"
else
@ -102,7 +102,7 @@ local callback_bruteforce = function(host, port, target)
local status, func
status, func = checkjson(response.body)
if status == true then
if status then
report = callback_url(host, port, target, p)
if report ~= nil then
report = string.format("%s\t%s", target, report)
@ -152,7 +152,7 @@ action = function(host, port)
local status, func, report
status, func = checkjson(r.response.body)
if status == true then
if status then
--We have found JSONP endpoint
--Put it inside a returnable table.
output_str = string.format("%s\n%s", output_str, target)

View file

@ -612,7 +612,7 @@ action = function(host)
status, reason = conficker_check(host.ip, port, "tcp")
checks = checks + 1
if(status == true) then
if status then
table.insert(response, string.format("Check %d (port %d/%s): INFECTED (%s)", checks, port, "tcp", reason))
count = count + 1
else
@ -627,7 +627,7 @@ action = function(host)
status, reason = conficker_check(host.ip, port, "udp")
checks = checks + 1
if(status == true) then
if status then
table.insert(response, string.format("Check %d (port %d/%s): INFECTED (%s)", checks, port, "udp", reason))
count = count + 1
else

View file

@ -315,7 +315,7 @@ local function check_login(hostinfo, username, password, logintype)
status, err = smb.start_session(smbstate, smb.get_overrides(username, domain, password, nil, logintype), false)
end
if(status == true) then
if status then
if(smbstate['is_guest'] == 1) then
result = results.GUEST_ACCESS
else

View file

@ -147,7 +147,7 @@ local function winreg_enum_rids(host)
repeat
local status, enumkey_result = msrpc.winreg_enumkey(smbstate, openhku_result['handle'], i, "")
if(status == true) then
if status then
local status, openkey_result
local element = {}

View file

@ -191,7 +191,7 @@ action = function(host)
local response = {}
if(result['status-os'] == true) then
if result['status-os'] then
local osdetails = {}
osdetails['name'] = "OS Details"
table.insert(osdetails, string.format("%s %s (%s %s build %s)", result['productname'], result['csdversion'], result['producttype'], result['currentversion'], result['currentbuildnumber']))
@ -228,7 +228,7 @@ action = function(host)
table.insert(response, browsers)
return stdnse.format_output(true, response)
elseif(result['status-productname'] == true) then
elseif result['status-productname'] then
local osdetails = {}
osdetails['name'] = 'OS Details'

View file

@ -122,7 +122,7 @@ function check_conficker(host)
-- Try checking a valid string to find Conficker.D
local netpathcanonicalize_result, error_result
status, netpathcanonicalize_result, error_result = msrpc.srvsvc_netpathcanonicalize(smbstate, host.ip, "\\")
if(status == true and netpathcanonicalize_result['can_path'] == 0x5c45005c) then
if status and netpathcanonicalize_result['can_path'] == 0x5c45005c then
msrpc.stop_smb(smbstate)
return true, INFECTED2
end

View file

@ -27,7 +27,7 @@ hostrule = function(host)
stdnse.debug1("is IPv4 compatible only.")
return false
end
if host.directly_connected == true and
if host.directly_connected and
host.mac_addr ~= nil and
host.mac_addr_src ~= nil and
host.interface ~= nil then
@ -70,7 +70,7 @@ do_test = function(dnet, pcap, host, test)
while status and test ~= check(layer2) do
status, length, layer2, layer3 = pcap:pcap_receive()
end
if status == true then
if status then
-- the basic idea, was to inform user about time, when we got packet
-- so that 1 would mean (0-10ms), 2=(10-40ms) and 3=(40ms-90ms)
-- but when we're running this tests on macs, first test is always 2.

View file

@ -120,7 +120,7 @@ action = function()
stdnse.debug1("Got IP addresses %s", table.concat(addresses, " "))
for _, addr in ipairs(addresses) do
if check_if_valid(addr) == true then
if check_if_valid(addr) then
if not unique_addresses[addr] then
unique_addresses[addr] = true
table.insert(all_addresses, addr)
@ -137,7 +137,7 @@ action = function()
sock:pcap_close()
end
if target.ALLOW_NEW_TARGETS == true then
if target.ALLOW_NEW_TARGETS then
if nmap.address_family() == 'inet6' then
for _,v in pairs(all_addresses) do
if v:match(':') then

View file

@ -104,7 +104,7 @@ local generate_filenames = function(host)
::next_filename::
end
if cisco == true then
if cisco then
local cisco_address_confg_filenames = generate_cisco_address_confg(host.ip)
return array_concat(default_filenames, cisco_address_confg_filenames)
end

View file

@ -146,7 +146,7 @@ function get_results(what, vers, type)
status, vulns = json.parse(response.body)
if status == true then
if status then
if vulns.result == "OK" then
return make_links(vulns)
end