Repository navigation
Add Meta Generator collection and JSON/JSONL output #2709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ func (m *mysqlDatabase) EnsureSchema(ctx context.Context) error { | |
| content_length INT, | ||
| content_type VARCHAR(255), | ||
| title TEXT, | ||
| generator TEXT, | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| webserver VARCHAR(255), | ||
| response_time VARCHAR(50), | ||
| location TEXT, | ||
|
|
@@ -216,7 +217,7 @@ func (m *mysqlDatabase) InsertBatch(ctx context.Context, results []runner.Result | |
| query := fmt.Sprintf(` | ||
| INSERT INTO %s ( | ||
| timestamp, url, input, host, port, scheme, path, method, final_url, | ||
| status_code, content_length, content_type, title, webserver, response_time, | ||
| status_code, content_length, content_type, title, generator, webserver, response_time, | ||
| location, body, body_preview, raw_header, request, | ||
| host_ip, a, aaaa, cname, resolvers, body_fqdn, body_domains, sni, | ||
| tech, hash, favicon, favicon_md5, favicon_path, favicon_url, jarm_hash, | ||
|
|
@@ -229,7 +230,7 @@ func (m *mysqlDatabase) InsertBatch(ctx context.Context, results []runner.Result | |
| cpe | ||
| ) VALUES ( | ||
| ?, ?, ?, ?, ?, ?, ?, ?, ?, | ||
| ?, ?, ?, ?, ?, ?, | ||
| ?, ?, ?, ?, ?, ?, ?, | ||
| ?, ?, ?, ?, ?, | ||
| ?, ?, ?, ?, ?, ?, ?, ?, | ||
| ?, ?, ?, ?, ?, ?, ?, | ||
|
|
@@ -274,7 +275,7 @@ func (m *mysqlDatabase) InsertBatch(ctx context.Context, results []runner.Result | |
|
|
||
| _, err = stmt.ExecContext(ctx, | ||
| r.Timestamp, r.URL, r.Input, r.Host, r.Port, r.Scheme, r.Path, r.Method, r.FinalURL, | ||
| r.StatusCode, r.ContentLength, r.ContentType, r.Title, r.WebServer, r.ResponseTime, | ||
| r.StatusCode, r.ContentLength, r.ContentType, r.Title, r.Generator, r.WebServer, r.ResponseTime, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle generator values larger than A scanned page can supply a generator value larger than 65,535 bytes. With strict SQL mode, MySQL rejects it, rolls back the entire batch, and the writer drops that batch. Use a sufficiently large column or bound the value before insertion. (dev.mysql.com)
|
||
| r.Location, r.ResponseBody, r.BodyPreview, r.RawHeaders, r.Request, | ||
| r.HostIP, aJSON, aaaaJSON, cnameJSON, resolversJSON, fqdnJSON, domainsJSON, r.SNI, | ||
| techJSON, hashJSON, r.FavIconMMH3, r.FavIconMD5, r.FaviconPath, r.FaviconURL, r.JarmHash, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,7 @@ func (p *postgresDatabase) EnsureSchema(ctx context.Context) error { | |
| content_length INTEGER, | ||
| content_type TEXT, | ||
| title TEXT, | ||
| generator TEXT, | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| webserver TEXT, | ||
| response_time TEXT, | ||
| location TEXT, | ||
|
|
@@ -204,7 +205,7 @@ func (p *postgresDatabase) InsertBatch(ctx context.Context, results []runner.Res | |
| query := fmt.Sprintf(` | ||
| INSERT INTO %s ( | ||
| timestamp, url, input, host, port, scheme, path, method, final_url, | ||
| status_code, content_length, content_type, title, webserver, response_time, | ||
| status_code, content_length, content_type, title, generator, webserver, response_time, | ||
| location, body, body_preview, raw_header, request, | ||
| host_ip, a, aaaa, cname, resolvers, body_fqdn, body_domains, sni, | ||
| tech, hash, favicon, favicon_md5, favicon_path, favicon_url, jarm_hash, | ||
|
|
@@ -217,17 +218,17 @@ func (p *postgresDatabase) InsertBatch(ctx context.Context, results []runner.Res | |
| cpe | ||
| ) VALUES ( | ||
| $1, $2, $3, $4, $5, $6, $7, $8, $9, | ||
| $10, $11, $12, $13, $14, $15, | ||
| $16, $17, $18, $19, $20, | ||
| $21, $22, $23, $24, $25, $26, $27, $28, | ||
| $29, $30, $31, $32, $33, $34, $35, | ||
| $36, $37, $38, $39, $40, $41, | ||
| $42, $43, $44, $45, $46, $47, | ||
| $48, $49, $50, $51, $52, | ||
| $53, $54, | ||
| $55, $56, $57, $58, $59, | ||
| $60, $61, $62, | ||
| $63 | ||
| $10, $11, $12, $13, $14, $15, $16, | ||
| $17, $18, $19, $20, $21, | ||
| $22, $23, $24, $25, $26, $27, $28, $29, | ||
| $30, $31, $32, $33, $34, $35, $36, | ||
| $37, $38, $39, $40, $41, $42, | ||
| $43, $44, $45, $46, $47, $48, | ||
| $49, $50, $51, $52, $53, | ||
| $54, $55, | ||
| $56, $57, $58, $59, $60, | ||
| $61, $62, $63, | ||
| $64 | ||
| )`, tableName) | ||
|
|
||
| stmt, err := tx.PrepareContext(ctx, query) | ||
|
|
@@ -253,7 +254,7 @@ func (p *postgresDatabase) InsertBatch(ctx context.Context, results []runner.Res | |
|
|
||
| _, err = stmt.ExecContext(ctx, | ||
| r.Timestamp, r.URL, r.Input, r.Host, r.Port, r.Scheme, r.Path, r.Method, r.FinalURL, | ||
| r.StatusCode, r.ContentLength, r.ContentType, r.Title, r.WebServer, r.ResponseTime, | ||
| r.StatusCode, r.ContentLength, r.ContentType, r.Title, r.Generator, r.WebServer, r.ResponseTime, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove NUL characters before inserting the generator. A response can contain a NUL inside the generator attribute. The extractor passes it through, but PostgreSQL
|
||
| r.Location, r.ResponseBody, r.BodyPreview, r.RawHeaders, r.Request, | ||
| r.HostIP, pq.Array(r.A), pq.Array(r.AAAA), pq.Array(r.CNAMEs), pq.Array(r.Resolvers), pq.Array(r.Fqdns), pq.Array(r.Domains), r.SNI, | ||
| pq.Array(r.Technologies), hashJSON, r.FavIconMMH3, r.FavIconMD5, r.FaviconPath, r.FaviconURL, r.JarmHash, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ type Result struct { | |
| Input string `json:"input,omitempty" csv:"input" md:"input" mapstructure:"input"` | ||
| Location string `json:"location,omitempty" csv:"location" md:"location" mapstructure:"location"` | ||
| Title string `json:"title,omitempty" csv:"title" md:"title" mapstructure:"title"` | ||
| Generator string `json:"generator,omitempty" csv:"generator" md:"generator" mapstructure:"generator"` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the CSV schema when resuming an older scan. When a scan resumes after an upgrade, the CSV writer appends the new header and rows to the existing file. The old and new rows then have different column counts, so CSV readers can reject the file or misalign fields. Keep
|
||
| str string `json:"-" csv:"-" md:"-" mapstructure:"-"` | ||
| Scheme string `json:"scheme,omitempty" csv:"scheme" md:"scheme" mapstructure:"scheme"` | ||
| Error string `json:"error,omitempty" csv:"error" md:"error" mapstructure:"error"` | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.