intruder

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoolArrayFromTextFile

func GetBoolArrayFromTextFile(filename string) ([]bool, error)

Parses an intruder .txt file into a bool array

func GetFloatArrayFromTextFile

func GetFloatArrayFromTextFile(filename string) ([]float64, error)

Parses an intruder .txt file into a float array

func GetIntArrayFromTextFile

func GetIntArrayFromTextFile(filename string) ([]int, error)

Parses an intruder .txt file into an int array

func GetStringArrayFromTextFile

func GetStringArrayFromTextFile(filename string) ([]string, error)

Parses an intruder .txt file into a string array

func RunIntruderTests

func RunIntruderTests(t *testing.T, ctx context.Context, td testdeck.TestCase, client interface{}, methodName string, req interface{}, data InputValidationTestData)

Runs a fuzz test on all parameters of this request req is a sample request struct specified in the protobuf file (e.g. pb.SayRequest) function is the function to be called dataFile is the json file where fuzzing data will come from

func TestThisField

func TestThisField(t *testing.T, ctx context.Context, tc testdeck.TestCase, client interface{}, methodName string, req interface{}, fieldName string, testDataSet InputValidationTestData)

This method generates an actual testdeck test case to fuzz the specified field req is the sample request struct fieldName is the current field to fuzz function is the fuzzing function dataFile is the json file where fuzzing data will come from

func VerifyIntruderTestResults

func VerifyIntruderTestResults(t *testdeck.TD, data JsonDataSet, res interface{}, duration time.Duration, input string, err error)

A helper function that verifies that the response matches the expected results fetched from the json test data file

Types

type ExpectedResult

type ExpectedResult struct {
	// TODO: Clarify what else needs to be checked in the response
	ErrorMessage string `json:"errorMessage"`
	TimeDelay    int    `json:"timeDelay"`
}

type InputValidationTestData

type InputValidationTestData struct {
	Strings []JsonDataSet `json:"string"`
	Ints    []JsonDataSet `json:"int"`
	Floats  []JsonDataSet `json:"float"`
	Bools   []JsonDataSet `json:"bool"`
}

data for testing input validation test data need to be separated by data type so that the fuzzer can feed the proper data type into the parameter

func ParseInputValidationTestDataFromJson

func ParseInputValidationTestDataFromJson(file string) (InputValidationTestData, error)

Parse input validation json testdata data into a struct

type JsonDataSet

type JsonDataSet struct {
	Files    []string       `json:"files"`
	Type     string         `json:"type"`
	Expected ExpectedResult `json:"expected"`
}

represents a json data set Files is the list of intruder .txt files to use Expected is the expected result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL