@@ -3,8 +3,8 @@ package cmd
33import (
44 "fmt"
55
6+ "github.com/CodeMonkeyCybersecurity/shells/pkg/types"
67 "github.com/spf13/cobra"
7- "github.com/yourusername/shells/pkg/types"
88)
99
1010var scanCmd = & cobra.Command {
@@ -15,7 +15,7 @@ var scanCmd = &cobra.Command{
1515
1616func init () {
1717 rootCmd .AddCommand (scanCmd )
18-
18+
1919 scanCmd .AddCommand (portScanCmd )
2020 scanCmd .AddCommand (sslScanCmd )
2121 scanCmd .AddCommand (webScanCmd )
@@ -38,14 +38,14 @@ var portScanCmd = &cobra.Command{
3838 target := args [0 ]
3939 profile , _ := cmd .Flags ().GetString ("profile" )
4040 ports , _ := cmd .Flags ().GetString ("ports" )
41-
41+
4242 log .Info ("Starting port scan" , "target" , target , "profile" , profile )
43-
43+
4444 options := map [string ]string {
4545 "profile" : profile ,
4646 "ports" : ports ,
4747 }
48-
48+
4949 return executeScan (target , types .ScanTypePort , options )
5050 },
5151}
@@ -57,13 +57,13 @@ var sslScanCmd = &cobra.Command{
5757 RunE : func (cmd * cobra.Command , args []string ) error {
5858 target := args [0 ]
5959 port , _ := cmd .Flags ().GetString ("port" )
60-
60+
6161 log .Info ("Starting SSL scan" , "target" , target )
62-
62+
6363 options := map [string ]string {
6464 "port" : port ,
6565 }
66-
66+
6767 return executeScan (target , types .ScanTypeSSL , options )
6868 },
6969}
@@ -75,13 +75,13 @@ var webScanCmd = &cobra.Command{
7575 RunE : func (cmd * cobra.Command , args []string ) error {
7676 target := args [0 ]
7777 depth , _ := cmd .Flags ().GetInt ("depth" )
78-
78+
7979 log .Info ("Starting web scan" , "target" , target )
80-
80+
8181 options := map [string ]string {
8282 "depth" : fmt .Sprintf ("%d" , depth ),
8383 }
84-
84+
8585 return executeScan (target , types .ScanTypeWeb , options )
8686 },
8787}
@@ -92,9 +92,9 @@ var vulnScanCmd = &cobra.Command{
9292 Args : cobra .ExactArgs (1 ),
9393 RunE : func (cmd * cobra.Command , args []string ) error {
9494 target := args [0 ]
95-
95+
9696 log .Info ("Starting vulnerability scan" , "target" , target )
97-
97+
9898 return executeScan (target , types .ScanTypeVuln , nil )
9999 },
100100}
@@ -105,9 +105,9 @@ var dnsScanCmd = &cobra.Command{
105105 Args : cobra .ExactArgs (1 ),
106106 RunE : func (cmd * cobra.Command , args []string ) error {
107107 domain := args [0 ]
108-
108+
109109 log .Info ("Starting DNS scan" , "domain" , domain )
110-
110+
111111 return executeScan (domain , types .ScanTypeDNS , nil )
112112 },
113113}
@@ -119,13 +119,13 @@ var dirScanCmd = &cobra.Command{
119119 RunE : func (cmd * cobra.Command , args []string ) error {
120120 target := args [0 ]
121121 wordlist , _ := cmd .Flags ().GetString ("wordlist" )
122-
122+
123123 log .Info ("Starting directory scan" , "target" , target )
124-
124+
125125 options := map [string ]string {
126126 "wordlist" : wordlist ,
127127 }
128-
128+
129129 return executeScan (target , types .ScanTypeDirectory , options )
130130 },
131131}
@@ -139,15 +139,15 @@ var oauth2ScanCmd = &cobra.Command{
139139 clientID , _ := cmd .Flags ().GetString ("client-id" )
140140 clientSecret , _ := cmd .Flags ().GetString ("client-secret" )
141141 redirectURI , _ := cmd .Flags ().GetString ("redirect-uri" )
142-
142+
143143 log .Info ("Starting OAuth2 scan" , "target" , target )
144-
144+
145145 options := map [string ]string {
146146 "client_id" : clientID ,
147147 "client_secret" : clientSecret ,
148148 "redirect_uri" : redirectURI ,
149149 }
150-
150+
151151 return executeScan (target , types .ScanType ("oauth2" ), options )
152152 },
153153}
@@ -161,15 +161,15 @@ var nucleiScanCmd = &cobra.Command{
161161 severity , _ := cmd .Flags ().GetString ("severity" )
162162 tags , _ := cmd .Flags ().GetString ("tags" )
163163 templates , _ := cmd .Flags ().GetString ("templates" )
164-
164+
165165 log .Info ("Starting nuclei scan" , "target" , target )
166-
166+
167167 options := map [string ]string {
168168 "severity" : severity ,
169169 "tags" : tags ,
170170 "templates" : templates ,
171171 }
172-
172+
173173 return executeScan (target , types .ScanType ("vulnerability" ), options )
174174 },
175175}
@@ -183,15 +183,15 @@ var httpxScanCmd = &cobra.Command{
183183 followRedirects , _ := cmd .Flags ().GetBool ("follow-redirects" )
184184 probeAllIPs , _ := cmd .Flags ().GetBool ("probe-all-ips" )
185185 ports , _ := cmd .Flags ().GetString ("ports" )
186-
186+
187187 log .Info ("Starting httpx scan" , "target" , target )
188-
188+
189189 options := map [string ]string {
190190 "follow_redirects" : fmt .Sprintf ("%t" , followRedirects ),
191- "probe_all_ips" : fmt .Sprintf ("%t" , probeAllIPs ),
192- "ports" : ports ,
191+ "probe_all_ips" : fmt .Sprintf ("%t" , probeAllIPs ),
192+ "ports" : ports ,
193193 }
194-
194+
195195 return executeScan (target , types .ScanType ("http_probe" ), options )
196196 },
197197}
@@ -202,9 +202,9 @@ var jsScanCmd = &cobra.Command{
202202 Args : cobra .ExactArgs (1 ),
203203 RunE : func (cmd * cobra.Command , args []string ) error {
204204 target := args [0 ]
205-
205+
206206 log .Info ("Starting JavaScript analysis" , "target" , target )
207-
207+
208208 return executeScan (target , types .ScanType ("javascript" ), nil )
209209 },
210210}
@@ -216,13 +216,13 @@ var graphqlScanCmd = &cobra.Command{
216216 RunE : func (cmd * cobra.Command , args []string ) error {
217217 target := args [0 ]
218218 authHeader , _ := cmd .Flags ().GetString ("auth-header" )
219-
219+
220220 log .Info ("Starting GraphQL scan" , "target" , target )
221-
221+
222222 options := map [string ]string {
223223 "auth_header" : authHeader ,
224224 }
225-
225+
226226 return executeScan (target , types .ScanType ("api" ), options )
227227 },
228228}
@@ -233,9 +233,9 @@ var fullScanCmd = &cobra.Command{
233233 Args : cobra .ExactArgs (1 ),
234234 RunE : func (cmd * cobra.Command , args []string ) error {
235235 target := args [0 ]
236-
236+
237237 log .Info ("Starting full scan" , "target" , target )
238-
238+
239239 scanTypes := []types.ScanType {
240240 types .ScanTypePort ,
241241 types .ScanTypeSSL ,
@@ -248,43 +248,43 @@ var fullScanCmd = &cobra.Command{
248248 types .ScanType ("javascript" ),
249249 types .ScanType ("api" ),
250250 }
251-
251+
252252 for _ , scanType := range scanTypes {
253253 if err := executeScan (target , scanType , nil ); err != nil {
254254 log .Error ("Scan failed" , "type" , scanType , "error" , err )
255255 }
256256 }
257-
257+
258258 return nil
259259 },
260260}
261261
262262func init () {
263263 portScanCmd .Flags ().String ("profile" , "default" , "Scan profile (default, fast, thorough)" )
264264 portScanCmd .Flags ().String ("ports" , "" , "Port range to scan (e.g., 1-1000)" )
265-
265+
266266 sslScanCmd .Flags ().String ("port" , "443" , "Port to scan for SSL/TLS" )
267-
267+
268268 webScanCmd .Flags ().Int ("depth" , 2 , "Spider depth for web scanning" )
269-
269+
270270 dirScanCmd .Flags ().String ("wordlist" , "common.txt" , "Wordlist for directory discovery" )
271-
271+
272272 oauth2ScanCmd .Flags ().String ("client-id" , "" , "OAuth2 client ID" )
273273 oauth2ScanCmd .Flags ().String ("client-secret" , "" , "OAuth2 client secret" )
274274 oauth2ScanCmd .Flags ().String ("redirect-uri" , "" , "OAuth2 redirect URI" )
275-
275+
276276 nucleiScanCmd .Flags ().String ("severity" , "critical,high,medium,low" , "Severity levels to scan for" )
277277 nucleiScanCmd .Flags ().String ("tags" , "" , "Tags to filter templates" )
278278 nucleiScanCmd .Flags ().String ("templates" , "" , "Specific templates to use" )
279-
279+
280280 httpxScanCmd .Flags ().Bool ("follow-redirects" , true , "Follow HTTP redirects" )
281281 httpxScanCmd .Flags ().Bool ("probe-all-ips" , false , "Probe all resolved IPs" )
282282 httpxScanCmd .Flags ().String ("ports" , "" , "Ports to probe" )
283-
283+
284284 graphqlScanCmd .Flags ().String ("auth-header" , "" , "Authorization header for GraphQL requests" )
285285}
286286
287287func executeScan (target string , scanType types.ScanType , options map [string ]string ) error {
288288 log .Error ("Scan execution not yet implemented" )
289289 return fmt .Errorf ("scan execution not yet implemented" )
290- }
290+ }
0 commit comments