Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin'
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsandeep committed Nov 28, 2024
2 parents 5e3bf29 + 10b4f8b commit 5ea295b
Show file tree
Hide file tree
Showing 83 changed files with 128 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:

# Maintain dependencies for go modules
- package-ecosystem: "gomod"
directory: "v2/"
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:

- name: Build
run: go build .
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/

- name: Test
run: go test -race ./...
working-directory: v2/

- name: Integration Tests
env:
Expand All @@ -42,12 +41,12 @@ jobs:
- name: Race Condition Tests - Standard User
run: |
go run -race . -host scanme.sh
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/

- name: Race Condition Tests - Root User
run: |
sudo go run -race . -host scanme.sh -Pn
working-directory: v2/cmd/naabu/
sudo go run -race . -host scanme.sh
working-directory: cmd/naabu/

build-mac:
runs-on: macos-latest
Expand All @@ -68,11 +67,10 @@ jobs:

- name: Build
run: go build .
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/

- name: Test
run: go test -race ./...
working-directory: v2/

- name: Integration Tests
env:
Expand All @@ -83,12 +81,12 @@ jobs:
- name: Race Condition Tests - Standard User
run: |
go run -race . -host scanme.sh
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/

- name: Race Condition Tests - Root User
run: |
sudo go run -race . -host scanme.sh -Pn
working-directory: v2/cmd/naabu/
sudo go run -race . -host scanme.sh
working-directory: cmd/naabu/

build-windows:
runs-on: windows-latest
Expand All @@ -103,15 +101,14 @@ jobs:

- name: Build
run: go build .
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/

- name: Test
run: go test -race ./...
working-directory: v2/

- name: Race Condition Tests
# Known issue: https://github.com/golang/go/issues/46099
run: |
# go run -race . -host scanme.sh
# sudo go run -race . -host scanme.sh
working-directory: v2/cmd/naabu/
working-directory: cmd/naabu/
2 changes: 1 addition & 1 deletion .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
run: |
chmod +x run.sh
bash run.sh
working-directory: v2/cmd/functional-test
working-directory: cmd/functional-test
3 changes: 1 addition & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ jobs:
uses: golangci/[email protected]
with:
version: latest
args: --timeout 5m
working-directory: v2/
args: --timeout 5m
6 changes: 3 additions & 3 deletions .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
version: latest
args: release -f .goreleaser/mac.yml --clean
workdir: v2
workdir: /
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -48,7 +48,7 @@ jobs:
with:
version: latest
args: release -f .goreleaser/linux.yml --clean
workdir: v2
workdir: /
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
Expand All @@ -71,6 +71,6 @@ jobs:
with:
version: latest
args: release -f .goreleaser/windows.yml --clean
workdir: v2
workdir: /
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 1 addition & 4 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
with:
args: "release --clean --snapshot -f .goreleaser/mac.yml"
version: latest
workdir: v2

release-test-linux:
runs-on: ubuntu-latest-16-cores
Expand All @@ -53,7 +52,6 @@ jobs:
with:
args: "release --clean --snapshot -f .goreleaser/linux.yml"
version: latest
workdir: v2

release-test-windows:
runs-on: windows-latest-8-cores
Expand All @@ -72,5 +70,4 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
args: "release --clean --snapshot -f .goreleaser/windows.yml"
version: latest
workdir: v2
version: latest
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
cmd/naabu/naabu*
v2/cmd/naabu/naabu*
vendor
integration_tests/naabu
integration_tests/integration-test
v2/cmd/functional-test/naabu_dev
v2/cmd/functional-test/functional-test
v2/cmd/functional-test/naabu
v2/cmd/functional-test/*.cfg
cmd/functional-test/naabu_dev
cmd/functional-test/functional-test
cmd/functional-test/naabu
cmd/functional-test/*.cfg
.vscode
dist
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Build
FROM golang:1.23.2-alpine AS builder
FROM golang:1.23.3-alpine AS build-env
RUN apk add --no-cache build-base libpcap-dev
WORKDIR /app
COPY . /app
WORKDIR /app/v2
RUN go mod download
RUN go build ./cmd/naabu

# Release
FROM alpine:3.20.3
RUN apk add --no-cache nmap libpcap-dev bind-tools ca-certificates nmap-scripts
COPY --from=builder /app/v2/naabu /usr/local/bin/
ENTRYPOINT ["naabu"]
RUN apk upgrade --no-cache \
&& apk add --no-cache nmap libpcap-dev bind-tools ca-certificates nmap-scripts
COPY --from=build-env /app/naabu /usr/local/bin/
ENTRYPOINT ["naabu"]
File renamed without changes.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ This will display help for the tool. Here are all the switches it supports.

```yaml
Usage:
./naabu [flags]
naabu [flags]

Flags:
INPUT:
-host string[] hosts to scan ports for (comma-separated)
-list, -l string list of hosts to scan ports (file)
Expand Down Expand Up @@ -88,8 +89,8 @@ CONFIGURATION:
-config string path to the naabu configuration file (default $HOME/.config/naabu/config.yaml)
-scan-all-ips, -sa scan all the IP's associated with DNS record
-ip-version, -iv string[] ip version to scan of hostname (4,6) - (default 4) (default ["4"])
-scan-type, -s string type of port scan (SYN/CONNECT) (default "s")
-source-ip string source ip and port (x.x.x.x:yyy)
-scan-type, -s string type of port scan (SYN/CONNECT) (default "c")
-source-ip string source ip and port (x.x.x.x:yyy - might not work on OSX)
-interface-list, -il list available interfaces and public ip
-interface, -i string network Interface to use for port scan
-nmap invoke nmap scan on targets (nmap must be installed) - Deprecated
Expand All @@ -105,7 +106,8 @@ CONFIGURATION:

HOST-DISCOVERY:
-sn, -host-discovery Perform Only Host Discovery
-Pn, -skip-host-discovery Skip Host discovery
-Pn, -skip-host-discovery Skip Host discovery (Deprecated: use -wn/-with-host-discovery instead)
-wn, -with-host-discovery Enable Host discovery
-ps, -probe-tcp-syn string[] TCP SYN Ping (host discovery needs to be enabled)
-pa, -probe-tcp-ack string[] TCP ACK Ping (host discovery needs to be enabled)
-pe, -probe-icmp-echo ICMP echo request Ping (host discovery needs to be enabled)
Expand Down Expand Up @@ -291,7 +293,7 @@ hackerone.com:80

# Host Discovery

Naabu optionally supports multiple options to perform host discovery, as outlined below. Host discovery is completed automatically before beginning a connect/syn scan if the process has enough privileges. `-sn` flag instructs the toll to perform host discovery only. `-Pn` flag skips the host discovery phase. Host discovery is completed using multiple internal methods; one can specify the desired approach to perform host discovery by setting available options.
Naabu optionally supports multiple options to perform host discovery. Host discovery is optional and can be enabled with the `-wn` flag. `-sn` flag instructs the tool to perform host discovery only.

Available options to perform host discovery:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
127.0.0.1 {{binary}} -tp 100
127.0.0.1 {{binary}} -ep 80 -p 8000
127.0.0.1 {{binary}} -c 25 -p 8000
127.0.0.1 {{binary}} -nmap-cli '-Pn -sT' -p 8000
127.0.0.1 {{binary}} -nmap-cli '-sT' -p 8000
127.0.0.1 {{binary}} -json
127.0.0.1 {{binary}} -nmap-cli '-sT'
scanme.sh {{binary}} -stream -passive
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ func (h *naabuPassiveSingleLibrary) Execute() error {
defer os.RemoveAll(testFile)

options := runner.Options{
HostsFile: testFile,
Ports: "80",
Passive: true,
SkipHostDiscovery: true,
OnResult: func(hr *result.HostResult) {},
HostsFile: testFile,
Ports: "80",
Passive: true,
OnResult: func(hr *result.HostResult) {},
}

naabuRunner, err := runner.NewRunner(&options)
Expand Down Expand Up @@ -68,10 +67,9 @@ func (h *naabuSingleLibrary) Execute() error {
var got bool

options := runner.Options{
HostsFile: testFile,
Ports: "80",
SkipHostDiscovery: true,
ScanType: h.scanType,
HostsFile: testFile,
Ports: "80",
ScanType: h.scanType,
OnResult: func(hr *result.HostResult) {
got = true
},
Expand Down Expand Up @@ -114,10 +112,9 @@ func (h *naabuMultipleExecLibrary) Execute() error {
var got bool

options := runner.Options{
HostsFile: testFile,
Ports: "80",
ScanType: h.scanType,
SkipHostDiscovery: true,
HostsFile: testFile,
Ports: "80",
ScanType: h.scanType,
OnResult: func(hr *result.HostResult) {
got = true
},
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions v2/go.mod → go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ require (
github.com/projectdiscovery/dnsx v1.2.1
github.com/projectdiscovery/fdmax v0.0.4
github.com/projectdiscovery/freeport v0.0.7
github.com/projectdiscovery/goflags v0.1.64
github.com/projectdiscovery/gologger v1.1.28
github.com/projectdiscovery/goflags v0.1.65
github.com/projectdiscovery/gologger v1.1.33
github.com/projectdiscovery/ipranger v0.0.53
github.com/projectdiscovery/mapcidr v1.1.34
github.com/projectdiscovery/networkpolicy v0.0.9
github.com/projectdiscovery/ratelimit v0.0.61
github.com/projectdiscovery/retryablehttp-go v1.0.84
github.com/projectdiscovery/ratelimit v0.0.63
github.com/projectdiscovery/retryablehttp-go v1.0.88
github.com/projectdiscovery/uncover v1.0.9
github.com/projectdiscovery/utils v0.2.16
github.com/projectdiscovery/utils v0.2.21
github.com/remeh/sizedwaitgroup v1.0.0
github.com/stretchr/testify v1.9.0
go.uber.org/multierr v1.11.0
Expand Down Expand Up @@ -84,10 +84,10 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/projectdiscovery/asnmap v1.1.1 // indirect
github.com/projectdiscovery/fastdialer v0.2.9 // indirect
github.com/projectdiscovery/hmap v0.0.64 // indirect
github.com/projectdiscovery/fastdialer v0.2.10 // indirect
github.com/projectdiscovery/hmap v0.0.68 // indirect
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 // indirect
github.com/projectdiscovery/retryabledns v1.0.82 // indirect
github.com/projectdiscovery/retryabledns v1.0.86 // indirect
github.com/refraction-networking/utls v1.6.7 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
Expand Down
32 changes: 16 additions & 16 deletions v2/go.sum → go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,18 @@ github.com/projectdiscovery/clistats v0.1.1 h1:8mwbdbwTU4aT88TJvwIzTpiNeow3XnAB7
github.com/projectdiscovery/clistats v0.1.1/go.mod h1:4LtTC9Oy//RiuT1+76MfTg8Hqs7FQp1JIGBM3nHK6a0=
github.com/projectdiscovery/dnsx v1.2.1 h1:TxslYvp1Z/YZ4CP/J0gx5RYpvXREnVmyoacmTcGu5yg=
github.com/projectdiscovery/dnsx v1.2.1/go.mod h1:6dAsMCEDu7FArZy2qjyTeUQrqpZ4ITLU11fcmUvFqt0=
github.com/projectdiscovery/fastdialer v0.2.9 h1:vDCqxVMCyUu3oVEizEK1K8K+CCcLkVDW3X2HfiWaVFA=
github.com/projectdiscovery/fastdialer v0.2.9/go.mod h1:mYv5QaNBDDSHlZO9DI0niRMw+G5hUzwIhs8QixSElUI=
github.com/projectdiscovery/fastdialer v0.2.10 h1:5iciZXMPdynbk/9iuqkJT1gqMXwzgEpFSWdoj/5CHCo=
github.com/projectdiscovery/fastdialer v0.2.10/go.mod h1:21rwXMecVsPVdSvON8Up761/GgxC4OSc9Rvx5LNH5fY=
github.com/projectdiscovery/fdmax v0.0.4 h1:K9tIl5MUZrEMzjvwn/G4drsHms2aufTn1xUdeVcmhmc=
github.com/projectdiscovery/fdmax v0.0.4/go.mod h1:oZLqbhMuJ5FmcoaalOm31B1P4Vka/CqP50nWjgtSz+I=
github.com/projectdiscovery/freeport v0.0.7 h1:Q6uXo/j8SaV/GlAHkEYQi8WQoPXyJWxyspx+aFmz9Qk=
github.com/projectdiscovery/freeport v0.0.7/go.mod h1:cOhWKvNBe9xM6dFJ3RrrLvJ5vXx2NQ36SecuwjenV2k=
github.com/projectdiscovery/goflags v0.1.64 h1:FDfwdt9N97Hi8OuhbkDlKtVttpc/CRMIWQVa08VsHsI=
github.com/projectdiscovery/goflags v0.1.64/go.mod h1:3FyHIVQtnycNOc1LE3O1jj/XR5XuMdF9QfHd0ujhnX4=
github.com/projectdiscovery/gologger v1.1.28 h1:3OYYnoEaHAYkPm2c2KgUifBDPy93JCQq1hl5ICtpJT8=
github.com/projectdiscovery/gologger v1.1.28/go.mod h1:rB7xNi4tcx/HqpQu4QgpFIopIg8SNF/VBc6cTeQLqWQ=
github.com/projectdiscovery/hmap v0.0.64 h1:lHOV/ke187za9bq1+rXvvrJdek+SN8ofiCkWw20iYeI=
github.com/projectdiscovery/hmap v0.0.64/go.mod h1:tZwyZfsERi3Tyfl3sLEwVAZkDc8ET85Pw4aKrWjVWrk=
github.com/projectdiscovery/goflags v0.1.65 h1:rjoj+5lP/FDzgeM0WILUTX9AOOnw0J0LXtl8P1SVeGE=
github.com/projectdiscovery/goflags v0.1.65/go.mod h1:cg6+yrLlaekP1hnefBc/UXbH1YGWa0fuzEW9iS1aG4g=
github.com/projectdiscovery/gologger v1.1.33 h1:wQxaQ8p/0Rx89lowBp0PnY2QSWiqf9QW1vGYAllsVJ4=
github.com/projectdiscovery/gologger v1.1.33/go.mod h1:P/WwqKstshQATJxN39V0KJ9ZuiGLOizmSqHIYrrz1T4=
github.com/projectdiscovery/hmap v0.0.68 h1:/z1Cz2wKYedTJc97UNzBBgdm744xkXi6j7125b7toqg=
github.com/projectdiscovery/hmap v0.0.68/go.mod h1:B37g7giW6i7+X1pJAeG0NPoKFpFJ7M26a18gfwfLeEc=
github.com/projectdiscovery/ipranger v0.0.53 h1:gb4yEqtC2MJl1tSdx/ycao1A1wl7sHqjHeifZidO3Z4=
github.com/projectdiscovery/ipranger v0.0.53/go.mod h1:r6R0DFKQRo4QR2zjZXqLRCp0ovbco8F/NmOI+pK4db8=
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 h1:ZScLodGSezQVwsQDtBSMFp72WDq0nNN+KE/5DHKY5QE=
Expand All @@ -212,16 +212,16 @@ github.com/projectdiscovery/mapcidr v1.1.34 h1:udr83vQ7oz3kEOwlsU6NC6o08leJzSDQt
github.com/projectdiscovery/mapcidr v1.1.34/go.mod h1:1+1R6OkKSAKtWDXE9RvxXtXPoajXTYX0eiEdkqlhQqQ=
github.com/projectdiscovery/networkpolicy v0.0.9 h1:IrlDoYZagNNO8y+7iZeHT8k5izE+nek7TdtvEBwCxqk=
github.com/projectdiscovery/networkpolicy v0.0.9/go.mod h1:XFJ2Lnv8BE/ziQCFjBHMsH1w6VmkPiQtk+NlBpdMU7M=
github.com/projectdiscovery/ratelimit v0.0.61 h1:n9PD4Z4Y6cLeT2rn9IiOAA0I/kIZE/D7z7z5X/WQds8=
github.com/projectdiscovery/ratelimit v0.0.61/go.mod h1:u7DxBBcUzFg4Cb2s5yabmtCMJs+ojulNpNrSLtftoKg=
github.com/projectdiscovery/retryabledns v1.0.82 h1:mB8Xwfo1BN4i5Emr9biBTJcYLgRv0UgLQfwtAl4sMX0=
github.com/projectdiscovery/retryabledns v1.0.82/go.mod h1:K0swjyX7/q/jPFMAN0TeB2TOn2PXA9mtVhrDfCQsgSg=
github.com/projectdiscovery/retryablehttp-go v1.0.84 h1:H0e+WhC5zBBRgewmT/rMcyXT1RvOKZrj1Yp7NGARE5Y=
github.com/projectdiscovery/retryablehttp-go v1.0.84/go.mod h1:FKBxBTQ+w9YFCZgUp/pUa1skz2nfA1YgptKooPzu7i4=
github.com/projectdiscovery/ratelimit v0.0.63 h1:lFZxO2BlUEle+mGLhsYz4s2B/WedY/RhavG4Kx115/c=
github.com/projectdiscovery/ratelimit v0.0.63/go.mod h1:+hhUPFKiDLSlvWeaz6+BI2LC0RuQOt8rBkTyKy0swMA=
github.com/projectdiscovery/retryabledns v1.0.86 h1:8YMJGJ94lFBKKN3t7NOzJfbGsZoh9qNpi49xdfJcZVc=
github.com/projectdiscovery/retryabledns v1.0.86/go.mod h1:5PhXvlLkEFmlYOt9i4wiKA1eONLrNiZ6DQE88Ph9rgU=
github.com/projectdiscovery/retryablehttp-go v1.0.88 h1:uR6T+i8Sy1isfG1KClhhsXnOqkOR6E8MAvuyOFq3T10=
github.com/projectdiscovery/retryablehttp-go v1.0.88/go.mod h1:ktjiIKyej+plUeK9vksqRf3wGicqY3E1rW84V/O7p0M=
github.com/projectdiscovery/uncover v1.0.9 h1:s5RbkD/V4r8QcPkys4gTTqMuRSgXq0JprejqLSopN9Y=
github.com/projectdiscovery/uncover v1.0.9/go.mod h1:2PUF3SpB5QNIJ8epaB2xbRzkPaxEAWRDm3Ir2ijt81U=
github.com/projectdiscovery/utils v0.2.16 h1:OAa7ED5KalTUQGLiJgA8zRJSeaxakBypbpVBoB+vRwg=
github.com/projectdiscovery/utils v0.2.16/go.mod h1:+ayI8L6qbMu9kern41QcLRDbGV3+x5GYbBVHNKWQvjc=
github.com/projectdiscovery/utils v0.2.21 h1:5YHyf+viDg0FFJnWFNEw0u608dXHj7nYdMGLUQzvwew=
github.com/projectdiscovery/utils v0.2.21/go.mod h1:LuiMbnvhvQV5qUQY44sQeGnfg4+fGEeuYFRRpxOyvwo=
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E=
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

echo "::group::Build naabu"
rm integration-test naabu 2>/dev/null
cd ../v2/cmd/naabu
cd ../cmd/naabu
go build
mv naabu ../../../integration_tests/naabu
mv naabu ../../integration_tests/naabu
echo "::endgroup::"

echo "::group::Build naabu integration-test"
cd ../integration-test
go build
mv integration-test ../../../integration_tests/integration-test
cd ../../../integration_tests
mv integration-test ../../integration_tests/integration-test
cd ../../integration_tests
echo "::endgroup::"

sudo ./integration-test
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion v2/pkg/runner/banners.go → pkg/runner/banners.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const banner = `
`

// Version is the current version of naabu
const version = `2.3.2`
const version = `2.3.3`

// showBanner is used to show the banner to the user
func showBanner() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5ea295b

Please sign in to comment.