Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import plugin #10

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions lua/hacker-helper.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- utils
local selection_util = require("hacker-helper.selection_util")
local http_to_python = require("hacker-helper.http_to_python")

-- main module file
local module = require("hacker-helper.module")
Expand Down Expand Up @@ -284,6 +285,42 @@ vim.keymap.set("v", M.config.prefix .. M.config.keys.hash_prefix .. M.config.key
end) -- Mode: "hash", Encoding: "scrypt"
end, { noremap = true, silent = true, desc = "Scrypt Hash" })

-- Scripts/snippets are under <leader>rs
vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_body,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "raw")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (body)" }
)

vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_json,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "json")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (json)" }
)

vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_form,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "form-data")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (form-data)" }
)
-- Function to handle encoding/decoding based on selection
-- Base64 encoding and decoding utility functions
M.base64_encode = function(text)
Expand Down
42 changes: 3 additions & 39 deletions plugin/hacker-helper.lua
Original file line number Diff line number Diff line change
@@ -1,46 +1,10 @@
-- Import the HTTP to Python module
local selection_util = require("hacker-helper.selection_util")
local http_to_python = require("hacker-helper.http_to_python")
local M = require("hacker-helper")
-- local selection_util = require("hacker-helper.selection_util")
-- local http_to_python = require("hacker-helper.http_to_python")
-- local M = require("hacker-helper")

-- script_http_to_python_form = "f",
-- script_http_to_python_json = "j",
-- script_http_to_python_body = "s",

-- Key Mappings for HTTP to Python requests
-- Scripts/snippets are under <leader>rs
vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_body,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "raw")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (body)" }
)

vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_json,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "json")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (json)" }
)

vim.keymap.set(
"v",
M.config.prefix .. M.config.keys.script_prefix .. M.config.keys.script_http_to_python_form,
function()
selection_util.transform_selection(function(selection)
local request = http_to_python.parse_http_request(selection)
return http_to_python.generate_python_requests_script(request, "form-data")
end)
end,
{ noremap = true, silent = true, desc = "HTTP Burp to Python Requests (form-data)" }
)
Loading