Skip to content

Commit 9114383

Browse files
discovery, auth
1 parent cef6cf0 commit 9114383

35 files changed

Lines changed: 6563 additions & 918 deletions

File tree

cmd/root.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"fmt"
66
"os"
77

8+
"github.com/CodeMonkeyCybersecurity/shells/internal/config"
9+
"github.com/CodeMonkeyCybersecurity/shells/internal/logger"
810
"github.com/spf13/cobra"
911
"github.com/spf13/viper"
10-
"github.com/yourusername/shells/internal/config"
11-
"github.com/yourusername/shells/internal/logger"
1212
)
1313

1414
var (
@@ -27,13 +27,13 @@ a unified interface for distributed scanning with result aggregation.`,
2727
if err := initConfig(); err != nil {
2828
return fmt.Errorf("failed to initialize config: %w", err)
2929
}
30-
30+
3131
var err error
3232
log, err = logger.New(cfg.Logger)
3333
if err != nil {
3434
return fmt.Errorf("failed to initialize logger: %w", err)
3535
}
36-
36+
3737
return nil
3838
},
3939
PersistentPostRun: func(cmd *cobra.Command, args []string) {
@@ -58,7 +58,7 @@ func init() {
5858
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.shells.yaml)")
5959
rootCmd.PersistentFlags().String("log-level", "info", "log level (debug, info, warn, error)")
6060
rootCmd.PersistentFlags().String("log-format", "json", "log format (json, console)")
61-
61+
6262
viper.BindPFlag("log.level", rootCmd.PersistentFlags().Lookup("log-level"))
6363
viper.BindPFlag("log.format", rootCmd.PersistentFlags().Lookup("log-format"))
6464
}
@@ -103,4 +103,4 @@ func GetLogger() *logger.Logger {
103103

104104
func GetContext() context.Context {
105105
return context.Background()
106-
}
106+
}

cmd/scan.go

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/CodeMonkeyCybersecurity/shells/pkg/types"
67
"github.com/spf13/cobra"
7-
"github.com/yourusername/shells/pkg/types"
88
)
99

1010
var scanCmd = &cobra.Command{
@@ -15,7 +15,7 @@ var scanCmd = &cobra.Command{
1515

1616
func 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

262262
func 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

287287
func 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+
}

cmd/workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"fmt"
55
"strings"
66

7+
"github.com/CodeMonkeyCybersecurity/shells/internal/workflow"
78
"github.com/spf13/cobra"
8-
"github.com/yourusername/shells/internal/workflow"
99
)
1010

1111
var workflowCmd = &cobra.Command{
@@ -91,7 +91,7 @@ var workflowListCmd = &cobra.Command{
9191
fmt.Printf(" Parallel: true\n")
9292
}
9393
}
94-
fmt.Printf("\n" + strings.Repeat("=", 50) + "\n\n")
94+
fmt.Printf("\n%s\n\n", strings.Repeat("=", 50))
9595
}
9696

9797
return nil

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
module github.com/yourusername/shells
1+
module github.com/CodeMonkeyCybersecurity/shells
22

3-
go 1.21
3+
go 1.24
44

55
require (
66
github.com/chromedp/cdproto v0.0.0-20231011050154-1d073bb38998
77
github.com/chromedp/chromedp v0.9.3
8-
github.com/google/gofuzz v1.2.0
98
github.com/google/uuid v1.5.0
109
github.com/jmoiron/sqlx v1.3.5
1110
github.com/lib/pq v1.10.9

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO
126126
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
127127
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
128128
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
129-
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
130-
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
131129
github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ=
132130
github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
133131
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=

internal/core/interfaces.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"io"
66

7-
"github.com/yourusername/shells/pkg/types"
7+
"github.com/CodeMonkeyCybersecurity/shells/pkg/types"
88
)
99

1010
type Scanner interface {
@@ -30,11 +30,11 @@ type ResultStore interface {
3030
UpdateScan(ctx context.Context, scan *types.ScanRequest) error
3131
GetScan(ctx context.Context, scanID string) (*types.ScanRequest, error)
3232
ListScans(ctx context.Context, filter ScanFilter) ([]*types.ScanRequest, error)
33-
33+
3434
SaveFindings(ctx context.Context, findings []types.Finding) error
3535
GetFindings(ctx context.Context, scanID string) ([]types.Finding, error)
3636
GetFindingsBySeverity(ctx context.Context, severity types.Severity) ([]types.Finding, error)
37-
37+
3838
GetSummary(ctx context.Context, scanID string) (*types.Summary, error)
3939
Close() error
4040
}
@@ -92,4 +92,4 @@ type Telemetry interface {
9292
RecordFinding(severity types.Severity)
9393
RecordWorkerMetrics(status *types.WorkerStatus)
9494
Close() error
95-
}
95+
}

internal/database/store.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
_ "github.com/lib/pq"
1111
_ "github.com/mattn/go-sqlite3"
1212

13-
"github.com/yourusername/shells/internal/config"
14-
"github.com/yourusername/shells/internal/core"
15-
"github.com/yourusername/shells/pkg/types"
13+
"github.com/CodeMonkeyCybersecurity/shells/internal/config"
14+
"github.com/CodeMonkeyCybersecurity/shells/internal/core"
15+
"github.com/CodeMonkeyCybersecurity/shells/pkg/types"
1616
)
1717

1818
type sqlStore struct {

0 commit comments

Comments
 (0)