mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-26 16:41:53 +08:00
feat: complete basic functions
Support http,dns and mysql connection. Support custom http, dns response. Support dns rebinding. Support mysql load local files and jdbc deserialize exploit.
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package newdns
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSetValidate(t *testing.T) {
|
||||
table := []struct {
|
||||
set Set
|
||||
err string
|
||||
}{
|
||||
{
|
||||
set: Set{
|
||||
Name: "foo",
|
||||
},
|
||||
err: "invalid name: foo",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
},
|
||||
err: "invalid type: 0",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
Type: A,
|
||||
},
|
||||
err: "missing records",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
Type: A,
|
||||
Records: []Record{
|
||||
{Address: "foo"},
|
||||
},
|
||||
},
|
||||
err: "invalid record: invalid IPv4 address: foo",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
Type: TXT,
|
||||
Records: []Record{
|
||||
{},
|
||||
},
|
||||
},
|
||||
err: "invalid record: missing data",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
Type: CNAME,
|
||||
Records: []Record{
|
||||
{},
|
||||
{},
|
||||
},
|
||||
},
|
||||
err: "multiple CNAME records",
|
||||
},
|
||||
{
|
||||
set: Set{
|
||||
Name: "example.com.",
|
||||
Type: A,
|
||||
Records: []Record{
|
||||
{Address: "1.2.3.4"},
|
||||
{Address: "1.2.3.4"},
|
||||
},
|
||||
},
|
||||
err: "duplicate address: 1.2.3.4",
|
||||
},
|
||||
}
|
||||
|
||||
for i, item := range table {
|
||||
err := item.set.Validate()
|
||||
if err != nil {
|
||||
assert.Equal(t, item.err, err.Error(), i)
|
||||
} else {
|
||||
assert.Equal(t, item.err, "", item)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user