-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from projectdiscovery/dev
v2.1.1
- Loading branch information
Showing
28 changed files
with
583 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
FROM golang:1.18.4-alpine AS builder | ||
FROM golang:1.19.2-alpine AS builder | ||
RUN apk add build-base libpcap-dev | ||
RUN go install -v github.com/projectdiscovery/naabu/v2/cmd/naabu@latest | ||
|
||
FROM alpine:3.16.1 | ||
FROM alpine:3.16.2 | ||
RUN apk add nmap libpcap-dev bind-tools ca-certificates nmap-scripts | ||
COPY --from=builder /go/bin/naabu /usr/local/bin/naabu | ||
ENTRYPOINT ["naabu"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
echo "::group::Build naabu" | ||
rm integration-test naabu 2>/dev/null | ||
cd ../v2/cmd/naabu | ||
go build | ||
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 | ||
echo "::endgroup::" | ||
|
||
./integration-test | ||
if [ $? -eq 0 ] | ||
then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
import ( | ||
"bufio" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
|
||
"github.com/logrusorgru/aurora" | ||
"github.com/pkg/errors" | ||
"github.com/logrusorgru/aurora" | ||
"github.com/pkg/errors" | ||
|
||
"github.com/projectdiscovery/naabu/v2/cmd/internal/testutils" | ||
) | ||
"github.com/projectdiscovery/naabu/v2/internal/testutils" | ||
) | ||
|
||
var ( | ||
debug = os.Getenv("DEBUG") == "true" | ||
success = aurora.Green("[✓]").String() | ||
failed = aurora.Red("[✘]").String() | ||
errored = false | ||
var ( | ||
debug = os.Getenv("DEBUG") == "true" | ||
success = aurora.Green("[✓]").String() | ||
failed = aurora.Red("[✘]").String() | ||
errored = false | ||
|
||
mainNaabuBinary = flag.String("main", "", "Main Branch Naabu Binary") | ||
devNaabuBinary = flag.String("dev", "", "Dev Branch Naabu Binary") | ||
testcases = flag.String("testcases", "", "Test cases file for Naabu functional tests") | ||
) | ||
mainNaabuBinary = flag.String("main", "", "Main Branch Naabu Binary") | ||
devNaabuBinary = flag.String("dev", "", "Dev Branch Naabu Binary") | ||
testcases = flag.String("testcases", "", "Test cases file for Naabu functional tests") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
func main() { | ||
flag.Parse() | ||
|
||
if err := runFunctionalTests(); err != nil { | ||
log.Fatalf("Could not run functional tests: %s\n", err) | ||
} | ||
if errored { | ||
os.Exit(1) | ||
} | ||
} | ||
if err := runFunctionalTests(); err != nil { | ||
log.Fatalf("Could not run functional tests: %s\n", err) | ||
} | ||
if errored { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func runFunctionalTests() error { | ||
file, err := os.Open(*testcases) | ||
if err != nil { | ||
return errors.Wrap(err, "could not open test cases") | ||
} | ||
defer file.Close() | ||
func runFunctionalTests() error { | ||
file, err := os.Open(*testcases) | ||
if err != nil { | ||
return errors.Wrap(err, "could not open test cases") | ||
} | ||
defer file.Close() | ||
|
||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
text := strings.TrimSpace(scanner.Text()) | ||
if text == "" { | ||
continue | ||
} | ||
if err := runIndividualTestCase(text); err != nil { | ||
errored = true | ||
fmt.Fprintf(os.Stderr, "%s Test \"%s\" failed: %s\n", failed, text, err) | ||
} else { | ||
fmt.Printf("%s Test \"%s\" passed!\n", success, text) | ||
} | ||
} | ||
return nil | ||
} | ||
scanner := bufio.NewScanner(file) | ||
for scanner.Scan() { | ||
text := strings.TrimSpace(scanner.Text()) | ||
if text == "" { | ||
continue | ||
} | ||
if err := runIndividualTestCase(text); err != nil { | ||
errored = true | ||
fmt.Fprintf(os.Stderr, "%s Test \"%s\" failed: %s\n", failed, text, err) | ||
} else { | ||
fmt.Printf("%s Test \"%s\" passed!\n", success, text) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func runIndividualTestCase(testcase string) error { | ||
parts := strings.Fields(testcase) | ||
func runIndividualTestCase(testcase string) error { | ||
parts := strings.Fields(testcase) | ||
|
||
var finalArgs []string | ||
var target string | ||
if len(parts) > 1 { | ||
finalArgs = parts[2:] | ||
target = parts[0] | ||
} | ||
mainOutput, err := testutils.RunNaabuBinaryAndGetResults(target, *mainNaabuBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run naabu main test") | ||
} | ||
devOutput, err := testutils.RunNaabuBinaryAndGetResults(target, *devNaabuBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run naabu dev test") | ||
} | ||
if len(mainOutput) == len(devOutput) { | ||
return nil | ||
} | ||
return fmt.Errorf("%s main is not equal to %s dev", mainOutput, devOutput) | ||
} | ||
var finalArgs []string | ||
var target string | ||
if len(parts) > 1 { | ||
finalArgs = parts[2:] | ||
target = parts[0] | ||
} | ||
mainOutput, err := testutils.RunNaabuBinaryAndGetResults(target, *mainNaabuBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run naabu main test") | ||
} | ||
devOutput, err := testutils.RunNaabuBinaryAndGetResults(target, *devNaabuBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run naabu dev test") | ||
} | ||
if len(mainOutput) == len(devOutput) { | ||
return nil | ||
} | ||
return fmt.Errorf("%s main is not equal to %s dev", mainOutput, devOutput) | ||
} |
Oops, something went wrong.