Skip to content

Instantly share code, notes, and snippets.

@inceabdullah
Last active June 5, 2024 16:20
Show Gist options
  • Save inceabdullah/bd58a08c018e52292ef93b116fd9bf57 to your computer and use it in GitHub Desktop.
Save inceabdullah/bd58a08c018e52292ef93b116fd9bf57 to your computer and use it in GitHub Desktop.
namp Proxmox NSE
description = [[
Detects Proxmox VE servers and retrieves version information.
]]
---
-- @usage
-- nmap --script proxmox -p8006 <host>
-- save under the dir /usr/share/nmap/scripts/
-- @output
-- PORT STATE SERVICE
-- 8006/tcp open https
-- | proxmox-version:
-- | Product: Proxmox Virtual Environment
-- | Version: 6.3-3
-- |_ URL: https://<host>:8006
author = "Your Name"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"default", "version"}
-- Import necessary libraries
local shortport = require "shortport"
local http = require "http"
local stdnse = require "stdnse"
portrule = shortport.port_or_service(8006, "https")
action = function(host, port)
local path = "/"
local response = http.get(host, port, path)
if not response then
return nil
end
local status = response.status
if status ~= 200 then
return nil
end
local body = response.body
if body:find("Proxmox Virtual Environment") then
local version = body:match("Proxmox Virtual Environment (%d+%.%d+%.%d+)")
return string.format("Product: Proxmox Virtual Environment\nVersion: %s\nURL: https://%s:%d", version or "unknown", host.ip, port.number)
end
return nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment