Nmap NSE 库分析 >>> base64

时间:2022-07-23
本文章向大家介绍Nmap NSE 库分析 >>> base64,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

0x00 简介

base64 这个库就两个函数方法,一个加密一个解密很好理解

0x01 方法实战

  • enc

enc 函数只有一个参数 p,为要编码的数据

---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by root.
--- DateTime: 2020/1/2 上午9:39
---

local url = require "url"
local stdnse = require "stdnse"
local base64 = require "base64"

description = [[
This is a test for http.lua's functions
]]

author = "test94"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"default"}

prerule = function()
    print("functest running")
end
portrule = function () return true end --shortport.http

action = function(host, port)
    local output = stdnse.output_table()
    local demo = "abc123"
    local result = base64.enc(demo)
    output.result = result
    return output
end

测试一下

  • dec

只有一个参数,要被解密的数据

---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by root.
--- DateTime: 2020/1/2 上午9:39
---

local url = require "url"
local stdnse = require "stdnse"
local base64 = require "base64"

description = [[
This is a test for http.lua's functions
]]

author = "test94"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"default"}

prerule = function()
    print("functest running")
end
portrule = function () return true end --shortport.http

action = function(host, port)
    local output = stdnse.output_table()
    local demo = "YWJjMTIz"
    local result = base64.dec(demo)
    output.result = result
    return output
end

测试一下