✂️Parsing

What you can do with Our HTTP module

  • Changing the URL Query

  • Sending normal GET request

  • Sending POST Request

  • Changing the Default Connection options

  • Handling Connection Errors

Changing the URL Query

It is possible to use the HttpMessage Lua Class to get your target URL, with this class you are able to perform the following:

  • Get the target URL

-- echo "http://target.com/?is_admin=true" | lotus urls script.lua -o out.json
local target_url = HttpMessage:Url()
-- http://target.com
  • Getting all parameters in String

-- echo "http://target.com/?is_admin=true&year=2023" | lotus urls script.lua -o out.json
local params = HttpMessage:TxtParams()
-- "is_admin=true&year=2023"
  • Get iterator with all url query

-- echo "http://target.com/?is_admin=true&year=2023" | lotus urls script.lua -o out.json
local iter_params = HttpMessage:Params()

for param_name, param_value in ipairs(iter_params) do 
    -- param_name: is_admin
    -- param_value: true
end
  • Changing the value of custom Parameter

-- URL = https://target.com/users?name=Mike&age=20
local new_url = HttpMessage:setParam("age","23")
-- https://target.com/users?name=Mikehacker&age=2023
  • Changing the value of all parameters

-- URL = https://target.com/users?name=Mike&age=20
local new_params = HttpMessage:setAllParams("<h1>",true) -- true = remove the parameter value
for param_name,param_value in ipairs(new_params) do 
    -- param_name: name
    -- param_value: <h1>
    -- continue ..
end
  • Join URL Path for root path

make sure to make the global variable SCAN_TYPE value to 3 to make lotus pass the full path instead of parameters to avoid dups inputs

-- URL = https://target.com/users?name=Mike&age=20
local new_url = HttpMessage:urlJoin("/admin/login?login=true")
-- URL = https://target.com/admin/login?login=true
  • Join URL Path for current path

-- make sure that your path doesn't starts with /
local new_url = pathjoin(HttpMessage:Path(),"admin/login.php")
-- http://target.com/index.php/admin.login.php

Last updated