-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Web Source #4848
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
Open
kashifkhan0771
wants to merge
19
commits into
trufflesecurity:main
Choose a base branch
from
kashifkhan0771:feature/web-source
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,770
−220
Open
Web Source #4848
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
71d3b22
basic structure for source
kashifkhan0771 ee3c447
it works end to end
kashifkhan0771 c9a95bd
some more enhancements + README.md
kashifkhan0771 d036ca5
A simple working test
kashifkhan0771 976fc15
user-agent flag
kashifkhan0771 d34aa84
made ignore-robots configurable
kashifkhan0771 b2161da
added metric
kashifkhan0771 259f6d6
detailed test cases
kashifkhan0771 37caab9
fixed some comments
kashifkhan0771 4ca9e46
updated README.md
kashifkhan0771 2403fb4
Merge branch 'main' into feature/web-source
kashifkhan0771 9288366
Added missed config in engine and rewrite timeout comment
kashifkhan0771 2a52dab
fixed lint issues
kashifkhan0771 4952315
fixed allowed domains validation
kashifkhan0771 d830d51
fixed comment
kashifkhan0771 4336d62
fixed sub-domain filter
kashifkhan0771 a8889df
Merge branch 'main' into feature/web-source
kashifkhan0771 d4b7a57
Merge branch 'main' into feature/web-source
kashifkhan0771 7564078
Merge branch 'main' into feature/web-source
kashifkhan0771 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package engine | ||
|
|
||
| import ( | ||
| "runtime" | ||
|
|
||
| "google.golang.org/protobuf/proto" | ||
| "google.golang.org/protobuf/types/known/anypb" | ||
|
|
||
| "github.com/trufflesecurity/trufflehog/v3/pkg/context" | ||
| "github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb" | ||
| "github.com/trufflesecurity/trufflehog/v3/pkg/sources" | ||
| "github.com/trufflesecurity/trufflehog/v3/pkg/sources/web" | ||
| ) | ||
|
|
||
| // ScanWeb scans a given web connection. | ||
| func (e *Engine) ScanWeb(ctx context.Context, c sources.WebConfig) (sources.JobProgressRef, error) { | ||
| connection := &sourcespb.Web{ | ||
| Urls: c.URLs, | ||
| Crawl: c.Crawl, | ||
| Depth: int64(c.Depth), | ||
| Delay: int64(c.Delay), | ||
| Timeout: int64(c.Timeout), | ||
| UserAgent: c.UserAgent, | ||
| IgnoreRobots: c.IgnoreRobots, | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| var conn anypb.Any | ||
| err := anypb.MarshalFrom(&conn, connection, proto.MarshalOptions{}) | ||
| if err != nil { | ||
| ctx.Logger().Error(err, "failed to marshal web connection") | ||
| return sources.JobProgressRef{}, err | ||
| } | ||
|
|
||
| sourceName := "trufflehog - web" | ||
| sourceID, jobID, _ := e.sourceManager.GetIDs(ctx, sourceName, web.SourceType) | ||
|
|
||
| webSource := &web.Source{} | ||
| if err := webSource.Init(ctx, sourceName, jobID, sourceID, true, &conn, runtime.NumCPU()); err != nil { | ||
| return sources.JobProgressRef{}, err | ||
| } | ||
| return e.sourceManager.EnumerateAndScan(ctx, sourceName, webSource) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.