403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/share/nmap/nselib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/share/nmap/nselib/outlib.lua
--- Helper functions for NSE script output
--
-- These functions are useful for ensuring output is consistently ordered
-- between scans and following conventions for output formatting.
--
-- @author Daniel Miller
-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html
-- @class module
-- @name outlib

local tableaux = require "tableaux"
local keys = tableaux.keys

local coroutine = require "coroutine"
local wrap = coroutine.wrap
local yield = coroutine.yield

local table = require "table"
local sort = table.sort
local concat = table.concat

local getmetatable = getmetatable
local setmetatable = setmetatable
local ipairs = ipairs

local _ENV = {}

--- Create a table that yields elements sorted by key when iterated over with pairs()
--
-- The returned table is like a sorted view of the original table; it should be
-- treated as read-only, and any new data should be added to the original table
-- instead.
--@param  t    The table whose data should be used
--@return out  A table that can be passed to pairs() to get sorted results
function sorted_by_key(t)
  local out = {}
  setmetatable(out, {
    __pairs = function(_)
      local order = keys(t)
      sort(order)
      return wrap(function()
        for i,k in ipairs(order) do
          yield(k, t[k])
        end
      end)
    end
  })
  return out
end

local commasep = {
  __tostring = function (t)
    return concat(t, ", ")
  end
}

--- Comma-separated list output
--
-- This adds a <code>__tostring</code> metamethod to a list (integer-indexed
-- table) so that it will be formatted as a comma-separated list when converted
-- to a string.
-- @param t The table to format
-- @param sep (Optional) list separator character, default: ", "
function list_sep(t, sep)
  -- Reuse closures and metatables as much as possible
  local oldmt = getmetatable(t)
  local newmt = sep and {
    __tostring = function(tt)
      return concat(tt, sep)
  end} or commasep
  -- Avoid clobbering old metatable or our static commasep table
  if oldmt and oldmt ~= commasep then
    oldmt.__tostring = newmt.__tostring
  else
    setmetatable(t, newmt)
  end
end

return _ENV

Youez - 2016 - github.com/yon3zu
LinuXploit