local bit = require "bit" local nmap = require "nmap" local stdnse = require "stdnse" local string = require "string" local table = require "table" _ENV = stdnse.module("exploit", stdnse.seeall) -- copied from ls.lua, change to suit exploit.lua local config_values = { ["maxdepth"] = 1, ["maxfiles"] = 10, ["checksum"] = false, ["errors"] = false, ["empty"] = false, ["human"] = false, } --- Convert an argument to its expected type local function convert_arg(argval, argtype) if argtype == "number" then return tonumber(argval) elseif argtype == "boolean" then if argval == "false" or argval == "no" or argval == "0" then return false else return true end end return argval end --- Update config_values using module arguments ("ls.argname", as -- opposed to script-specific arguments, "http-ls.argname") for argname, argvalue in pairs(config_values) do local argval = stdnse.get_script_args(LIBRARY_NAME .. "." .. argname) if argval ~= nil then config_values[argname] = convert_arg(argval, type(argvalue)) end end --- Get a config value from (by order or priority): -- 1. a script-specific argument (e.g., http-ls.argname) -- 2. a module argument (ls.argname) -- 3. the default value -- @param argname The name of the configuration parameter -- @return The configuration value function config(argname) local argval = stdnse.get_script_args(stdnse.getid() .. "." .. argname) if argval == nil then return config_values[argname] else return convert_arg(argval, type(config_values[argname])) end end -- generates a payload for given architectures local function generate_payload(architecture) end -- nmap shell, creates a shell to execute commands local function nshell() end local function lfi( ... ) -- body end return _ENV;