Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/input/formats/burp/burp_test.go
2070 views
1
package burp
2
3
import (
4
"os"
5
"testing"
6
7
"github.com/projectdiscovery/nuclei/v3/pkg/input/types"
8
"github.com/stretchr/testify/require"
9
)
10
11
func TestBurpParse(t *testing.T) {
12
format := New()
13
14
proxifyInputFile := "../testdata/burp.xml"
15
16
var gotMethodsToURLs []string
17
18
file, err := os.Open(proxifyInputFile)
19
require.Nilf(t, err, "error opening proxify input file: %v", err)
20
defer func() {
21
_ = file.Close()
22
}()
23
24
err = format.Parse(file, func(request *types.RequestResponse) bool {
25
gotMethodsToURLs = append(gotMethodsToURLs, request.URL.String())
26
return false
27
}, proxifyInputFile)
28
if err != nil {
29
t.Fatal(err)
30
}
31
32
if len(gotMethodsToURLs) != 2 {
33
t.Fatalf("invalid number of methods: %d", len(gotMethodsToURLs))
34
}
35
var expectedURLs = []string{
36
"http://localhost:8087/scans",
37
"http://google.com/",
38
}
39
require.ElementsMatch(t, expectedURLs, gotMethodsToURLs, "could not get burp urls")
40
}
41
42