-
Notifications
You must be signed in to change notification settings - Fork 0
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 #22 from surface-security/dev-126
Update to v1.2.6
- Loading branch information
Showing
51 changed files
with
3,788 additions
and
720 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 🙏🏻 Lint Test | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
name: Lint Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Run golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: latest | ||
args: --timeout 5m | ||
working-directory: . |
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,5 +1,10 @@ | ||
.vscode | ||
.idea/ | ||
.vscode/ | ||
cmd/httpx/httpx | ||
/test/output | ||
integration_tests/httpx | ||
integration_tests/integration-test | ||
cmd/functional-test/httpx_dev | ||
cmd/functional-test/functional-test | ||
cmd/functional-test/httpx | ||
cmd/functional-test/*.cfg |
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package main | ||
|
||
import ( | ||
"bufio" | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
|
||
"github.com/logrusorgru/aurora" | ||
"github.com/pkg/errors" | ||
|
||
"github.com/projectdiscovery/httpx/internal/testutils" | ||
) | ||
|
||
var ( | ||
debug = os.Getenv("DEBUG") == "true" | ||
success = aurora.Green("[✓]").String() | ||
failed = aurora.Red("[✘]").String() | ||
errored = false | ||
|
||
mainHttpxBinary = flag.String("main", "", "Main Branch Httpx Binary") | ||
devHttpxBinary = flag.String("dev", "", "Dev Branch Httpx Binary") | ||
testcases = flag.String("testcases", "", "Test cases file for Httpx functional tests") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
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() | ||
|
||
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) | ||
|
||
var finalArgs []string | ||
var target string | ||
if len(parts) > 1 { | ||
finalArgs = parts[2:] | ||
target = parts[0] | ||
} | ||
mainOutput, err := testutils.RunHttpxBinaryAndGetResults(target, *mainHttpxBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run httpx main test") | ||
} | ||
devOutput, err := testutils.RunHttpxBinaryAndGetResults(target, *devHttpxBinary, debug, finalArgs) | ||
if err != nil { | ||
return errors.Wrap(err, "could not run httpx dev test") | ||
} | ||
if len(mainOutput) == len(devOutput) { | ||
return nil | ||
} | ||
return fmt.Errorf("%s main is not equal to %s dev", mainOutput, devOutput) | ||
} |
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 | ||
|
||
# reading os type from arguments | ||
CURRENT_OS=$1 | ||
|
||
if [ "${CURRENT_OS}" == "windows-latest" ];then | ||
extension=.exe | ||
fi | ||
|
||
echo "::group::Building functional-test binary" | ||
go build -o functional-test$extension | ||
echo "::endgroup::" | ||
|
||
echo "::group::Building httpx binary from current branch" | ||
go build -o httpx_dev$extension ../httpx | ||
echo "::endgroup::" | ||
|
||
echo "::group::Building latest release of httpx" | ||
go build -o httpx$extension -v github.com/projectdiscovery/httpx/cmd/httpx | ||
echo "::endgroup::" | ||
|
||
echo 'Starting httpx functional test' | ||
./functional-test$extension -main ./httpx$extension -dev ./httpx_dev$extension -testcases testcases.txt |
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 @@ | ||
GET /search?q=test HTTP/2 |
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 @@ | ||
https://scanme.sh |
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,19 @@ | ||
scanme.sh {{binary}} -silent | ||
scanme.sh {{binary}} -silent -l test-data/request.txt | ||
scanme.sh {{binary}} -silent -request test-data/raw-request.txt | ||
scanme.sh {{binary}} -silent -title | ||
scanme.sh {{binary}} -silent -sc | ||
scanme.sh {{binary}} -silent -td | ||
scanme.sh {{binary}} -silent -probe | ||
scanme.sh {{binary}} -silent -no-fallback | ||
scanme.sh {{binary}} -silent -cl | ||
scanme.sh {{binary}} -silent -server | ||
scanme.sh {{binary}} -silent -ip | ||
scanme.sh {{binary}} -silent -tls-grab | ||
scanme.sh {{binary}} -silent -unsafe | ||
scanme.sh {{binary}} -silent -x all | ||
scanme.sh {{binary}} -silent -body 'a=b' | ||
scanme.sh {{binary}} -silent -exclude-cdn | ||
scanme.sh {{binary}} -silent -ports https:443 | ||
scanme.sh {{binary}} -silent -ztls | ||
https://scanme.sh?a=1*1 {{binary}} -silent |
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
Oops, something went wrong.