cmd

package
v0.0.0-...-df68cab Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright © 2020 Abhay Bhargav

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeTokenInCred

func ChangeTokenInCred(token string)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func IsConfigured

func IsConfigured() bool

func MakeRequest

func MakeRequest(url string, method string, configValue ConfigObj, request []byte) *http.Response

MakeRequest - Generic Function to create an HTTP request

Types

type AbuseCaseParams

type AbuseCaseParams struct {
	UseCase     string
	AbuserStory string
	Mode        string
	// contains filtered or unexported fields
}

type AbuseRequest

type AbuseRequest struct {
	Name            string                  `json:"short_name"`
	Description     string                  `json:"description"`
	UserStory       string                  `json:"feature"`
	ThreatScenarios []ThreatScenarioRequest `json:"scenarios"`
}

type AbuserStory

type AbuserStory struct {
	Name             string           `yaml:"name"`
	Description      string           `yaml:"description"`
	Threat_scenarios []ThreatScenario `yaml:"threat_scenarios"`
}

type AbuserStoryCreate

type AbuserStoryCreate struct {
	Name            string
	Created         bool
	Feature         string
	ThreatScenarios []ThreatScenario
}

type AbuserStoryGetResponse

type AbuserStoryGetResponse struct {
	Data []struct {
		ShortName   string `json:"short_name"`
		Description string `json:"description"`
	} `json:"data"`
}

func GetAbuserStory

func GetAbuserStory(params AbuseCaseParams) AbuserStoryGetResponse

GetAbuserStory - Generic Function to get abuser stories for a user story or a specific abuser story

type CascadingFeatureObject

type CascadingFeatureObject struct {
	Name        string         `json:"short_name"`
	Description string         `json:"description"`
	AbuseCases  []AbuseRequest `json:"abuse_cases"`
}

type ChangePassword

type ChangePassword struct {
	// contains filtered or unexported fields
}

type ConfigObj

type ConfigObj struct {
	// contains filtered or unexported fields
}

func GetJsonConfiguration

func GetJsonConfiguration() ConfigObj

type Feature

type Feature struct {
	ObjectType  string        `yaml:"objectType"`
	Name        string        `yaml:"name"`
	Description string        `yaml:"description"`
	Abuse_cases []AbuserStory `yaml:"abuse_cases"`
}

type FeatureRequest

type FeatureRequest struct {
	Name        string `json:"short_name"`
	Description string `json:"description"`
	Project     string `json:"project"`
}

type GetUserStoryRequest

type GetUserStoryRequest struct {
	ShortName   string `json:"short_name"`
	Project     string `json:"project"`
	Description string `json:"description"`
}

type JSONConfig

type JSONConfig struct {
	Host  string `json:"host"`
	Port  int32  `json:"port"`
	Email string `json:"email"`
	Token string `json:"token"`
}

Note, when you want to export a struct and use it to write, you need to capitalize the attributes

type LoginResponse

type LoginResponse struct {
	Success bool `json:"success"`
	Error   bool `json:"error"`
	Message bool `json:"message"`
	Data    struct {
		Token string `json:"token"`
	} `json:"data"`
}

type ProjectRequest

type ProjectRequest struct {
	Name string `json:"name"`
}

type ProjectResponse

type ProjectResponse struct {
	Success bool `json:"success"`
	Error   bool `json:"error"`
	Data    struct {
		Name string `json:"name"`
	} `json:"data"`
}

type ScenarioReference

type ScenarioReference struct {
	Name     string `yaml:"name"`
	Severity int    `yaml:"severity"`
}

type SecurityTestCase

type SecurityTestCase struct {
	Name      string `yaml:"name"`
	Test      string `yaml:"test"`
	Test_type string `yaml:"type"`
	Tools     string `yaml:"tools"`
}

type TestCaseCreate

type TestCaseCreate struct {
	Name    string //test-case name
	Created bool   //whether the test case was successfully created or not
}

type TestCaseGetResponse

type TestCaseGetResponse struct {
	Data []TestCaseRequest `json:"data"`
}

func GetTestCase

func GetTestCase(scenario string, config ConfigObj) TestCaseGetResponse

GetTestCase - Generic Function to get TestCases for a given scenario or a specific Test Case

type TestCaseRequest

type TestCaseRequest struct {
	Name           string   `json:"name"`
	TestCase       string   `json:"test_case"`
	ThreatScenario string   `json:"threat_scenario"`
	Tools          []string `json:"tools"`
	TestType       string   `json:"test_type"`
}

type ThreatScenario

type ThreatScenario struct {
	Name         string             `yaml:"name"`
	ScenarioType string             `yaml:"type"`
	Description  string             `yaml:"description"`
	Vul_name     string             `yaml:"vul_name"`
	Severity     int                `yaml:"severity"`
	Cwe          int32              `yaml:"cwe"`
	Reference    ScenarioReference  `yaml:"reference"`
	Test_cases   []SecurityTestCase `yaml:"test-cases"`
}

type ThreatScenarioCreate

type ThreatScenarioCreate struct {
	Name      string             //Threat Scenario name
	Created   bool               //Whether it was successfully created or not
	TestCases []SecurityTestCase //List of test cases, if its an inline object
}

type ThreatScenarioGetResponse

type ThreatScenarioGetResponse struct {
	Data []ThreatScenarioRequest `json:"data"`
}

func GetThreatScenario

func GetThreatScenario(abuse_case string, config ConfigObj) ThreatScenarioGetResponse

GetThreatScenario - Generic function to get ThreatScenarios for an Abuser Story or a Specific Threat Scenario

type ThreatScenarioRequest

type ThreatScenarioRequest struct {
	Name         string            `json:"name"`
	Feature      string            `json:"feature"`
	AbuserStory  string            `json:"abuser_story"`
	Description  string            `json:"description"`
	ScenarioType string            `json:"type"`
	RepoName     string            `json:"repo_name"`
	VulName      string            `json:"vul_name"`
	Cwe          int32             `json:"cwe"`
	Severity     int               `json:"severity"`
	TestCases    []TestCaseRequest `json:"test_cases"`
	Categories   []string          `json:"categories"`
}

type UserStoryResponse

type UserStoryResponse struct {
	Data struct {
		GetUserStoryRequest
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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