Skip to content

Super lightweight version of nmap πŸ”Ž running in docker 🐳

Notifications You must be signed in to change notification settings

koensmink/containerized-nmap-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Containerized Nmap API

Een compacte containerized API bovenop nmap.
De service biedt een eenvoudige HTTP-endpoint die een nmap-scan uitvoert en het resultaat als JSON retourneert.


Repositorystructuur

.
β”œβ”€ docker-compose.yml                 # Minimalistische stack: alleen de portscan-service
β”œβ”€ portscan-service/
β”‚  β”œβ”€ Dockerfile                      # Node 18 + nmap + API
β”‚  β”œβ”€ index.js                        # Express API + nmap-wrapper
β”‚  └─ package.json                    # Node-afhankelijkheden

portscan-service

Overzicht

  • Base image: node:18-alpine
  • Installeert nmap via apk
  • Exposeert poort 8080 in de container
  • Dependencies: express, xml2js
  • De API voert nmap uit, parseert XML-output en retourneert open poorten plus ruwe data

Dockerfile

FROM node:18-alpine
RUN apk add --no-cache nmap
WORKDIR /app
COPY package.json .
RUN npm install --omit=dev
COPY index.js .
EXPOSE 8080

Stand-alone deployment

docker-compose.yml start alleen de API:

services:
  portscan-service:
    build: ./portscan-service
    ports:
      - "${PORTS}:8080"
    cap_add:
      - NET_RAW
    restart: unless-stopped

Vereiste variabelen

Maak een .env aan:

PORTS=8080

Start:

docker compose up -d

API-endpoints:

  • GET /v1/health
  • POST /v1/scan

API-documentatie

Health check

GET /v1/health

Response:

{ "ok": true }

Portscan uitvoeren

POST /v1/scan
Content-Type: application/json

Voorbeeldrequest:

{
  "host": "scanme.nmap.org",
  "ports": "22,80,443",
  "flags": "-T4"
}

About

Super lightweight version of nmap πŸ”Ž running in docker 🐳

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published