github.com/projectdiscovery/nuclei/v2@v2.9.15/internal/runner/nucleicloud/types.go (about) 1 package nucleicloud 2 3 import ( 4 "encoding/json" 5 "time" 6 7 "github.com/projectdiscovery/nuclei/v2/pkg/model/types/severity" 8 "github.com/projectdiscovery/nuclei/v2/pkg/templates/types" 9 ) 10 11 // AddScanRequest is a nuclei scan input item. 12 type AddScanRequest struct { 13 // RawTargets is a list of raw target URLs for the scan. 14 RawTargets []string `json:"raw_targets,omitempty"` 15 // PublicTemplates is a list of public templates for the scan 16 PublicTemplates []string `json:"public_templates,omitempty"` 17 // PrivateTemplates is a map of template-name->contents that 18 // are private to the user executing the scan. (TODO: TBD) 19 PrivateTemplates map[string]string `json:"private_templates,omitempty"` 20 // CloudTargets is a list of cloud targets for the scan 21 CloudTargets []string `json:"cloud_targets,omitempty"` 22 // CloudTemplates is a list of cloud templates for the scan 23 CloudTemplates []string `json:"cloud_templates,omitempty"` 24 // Filtering contains optional filtering options for scan additions 25 Filtering *AddScanRequestConfiguration `json:"filtering"` 26 27 IsTemporary bool `json:"is_temporary"` 28 } 29 30 // AddScanRequestConfiguration contains filtering options for scan addition 31 type AddScanRequestConfiguration struct { 32 Authors []string `json:"author,omitempty"` 33 Tags []string `json:"tags,omitempty"` 34 ExcludeTags []string `json:"exclude-tags,omitempty"` 35 IncludeTags []string `json:"include-tags,omitempty"` 36 IncludeIds []string `json:"include-ids,omitempty"` 37 ExcludeIds []string `json:"exclude-ids,omitempty"` 38 IncludeTemplates []string `json:"include-templates,omitempty"` 39 ExcludedTemplates []string `json:"exclude-templates,omitempty"` 40 ExcludeMatchers []string `json:"exclude-matchers,omitempty"` 41 Severities severity.Severities `json:"severities,omitempty"` 42 ExcludeSeverities severity.Severities `json:"exclude-severities,omitempty"` 43 Protocols types.ProtocolTypes `json:"protocols,omitempty"` 44 ExcludeProtocols types.ProtocolTypes `json:"exclude-protocols,omitempty"` 45 IncludeConditions []string `json:"include-conditions,omitempty"` 46 } 47 48 type GetResultsResponse struct { 49 Finished bool `json:"finished"` 50 Items []GetResultsResponseItem `json:"items"` 51 } 52 53 type GetScanRequest struct { 54 Id int64 `json:"id"` 55 Total int32 `json:"total"` 56 Current int32 `json:"current"` 57 Finished bool `json:"finished"` 58 CreatedAt time.Time `json:"created_at"` 59 FinishedAt time.Time `json:"finished_at"` 60 Targets int32 `json:"targets"` 61 Templates int32 `json:"templates"` 62 Matches int64 `json:"matches"` 63 } 64 65 // AddDataSourceResponse is a add data source response item. 66 type AddDataSourceResponse struct { 67 ID int64 `json:"id"` 68 Hash string `json:"hash"` 69 Secret string `json:"secret,omitempty"` 70 } 71 72 type GetResultsResponseItem struct { 73 ID int64 `json:"id"` 74 Raw string `json:"raw"` 75 } 76 77 type DeleteScanResults struct { 78 OK bool `json:"ok"` 79 } 80 81 // StatusDataSourceRequest is a add data source request item. 82 type StatusDataSourceRequest struct { 83 Repo string `json:"repo"` 84 Token string `json:"token"` 85 } 86 87 // StatusDataSourceResponse is a add data source response item. 88 type StatusDataSourceResponse struct { 89 ID int64 `json:"id"` 90 } 91 92 // AddDataSourceRequest is a add data source request item. 93 type AddDataSourceRequest struct { 94 Type string `json:"type"` 95 Repo string `json:"repo"` 96 Token string `json:"token"` 97 Sync bool `json:"sync"` 98 } 99 100 // ExistsDataSourceItemRequest is a request to identify whether a data 101 // source item exists. 102 type ExistsDataSourceItemRequest struct { 103 Type string `json:"type"` 104 Contents string `json:"contents"` 105 } 106 107 // GetDataSourceResponse is response for a get data source request 108 type GetDataSourceResponse struct { 109 ID int64 `json:"id"` 110 Hash string `json:"hash"` 111 Type string `json:"type"` 112 Path string `json:"path"` 113 Repo string `json:"repo"` 114 Updatedat time.Time `json:"updated_at"` 115 } 116 117 // GetTargetResponse is the response for a get target request 118 type GetTargetResponse struct { 119 ID int64 `json:"id"` 120 DataSource int64 `json:"data_source"` 121 Name string `json:"name"` 122 Reference string `json:"reference"` 123 Count int64 `json:"count"` 124 Hash string `json:"hash"` 125 Type string `json:"type"` 126 } 127 128 // GetTemplatesResponse is the response for a get templates request 129 type GetTemplatesResponse struct { 130 ID int64 `json:"id,omitempty"` 131 DataSource int64 `json:"data_source,omitempty"` 132 Name string `json:"name,omitempty"` 133 Reference string `json:"reference,omitempty"` 134 Hash string `json:"hash,omitempty"` 135 Type string `json:"type,omitempty"` 136 } 137 138 type GetReportingSourceResponse struct { 139 ID int64 `json:"id"` 140 Type string `json:"type"` 141 ProjectName string `json:"project_name"` 142 Enabled bool `json:"enabled"` 143 Updatedat time.Time `json:"updated_at"` 144 } 145 146 type ReportingSourceStatus struct { 147 Enabled bool `json:"enabled"` 148 } 149 150 // AddItemResponse is the response to add item request 151 type AddItemResponse struct { 152 Ok string `json:"ok"` 153 } 154 155 type ListScanOutput struct { 156 Timestamp string `json:"timestamp"` 157 ScanID int64 `json:"scan_id"` 158 ScanTime string `json:"scan_time"` 159 ScanResult int `json:"scan_result"` 160 ScanStatus string `json:"scan_status"` 161 Target int `json:"target"` 162 Template int `json:"template"` 163 } 164 165 type ExistsInputResponse struct { 166 Reference string `json:"reference"` 167 } 168 169 // AddReportingSourceRequest is a add reporting source request item. 170 type AddReportingSourceRequest struct { 171 Type string `json:"type"` 172 Payload json.RawMessage `json:"payload"` 173 } 174 175 // AddReportingSourceResponse is a add reporting source response item. 176 type AddReportingSourceResponse struct { 177 Ok string `json:"ok"` 178 }