core

package
v0.0.0-...-82180e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package core represents the core functionality of all commands

Package core represents the core functionality of all commands

Index

Constants

View Source
const TID threadID = 0

Variables

This section is empty.

Functions

func AnalyzeObject

func AnalyzeObject(ctx context.Context, sess *session.Session, change *object.Change, commit *object.Commit, filepath string, repo coreapi.Repository) bool

func AnalyzeRepositories

func AnalyzeRepositories(ctx context.Context, sess *session.Session, st *stats.Stats)

AnalyzeRepositories will clone the repos, grab their history for analysis of files and content.

Before the analysis is done we also check various conditions that can be thought of as filters and
are controlled by flags. If a directory, file, or the content pass through all of the filters then
it is scanned once per each signature which may lead to a specific secret matching multiple rules
and then generating multiple findings.

func CloneRepositoryGeneric

func CloneRepositoryGeneric(config CloneConfiguration, auth *http.BasicAuth) (repo *git.Repository, dir string, err error)

cloneRepositoryGeneric will create either an in memory clone of a given repository or clone to a temp dir.

func GatherLocalRepositories

func GatherLocalRepositories(sess *session.Session) error

GatherLocalRepositories will grab all the local repos from the user input and generate a repository object, putting dummy or generated values in where necessary.

func GatherOrgsMembers

func GatherOrgsMembers(sess *session.Session)

GatherOrgsMembers will gather all orgs members and position them in Targets

func GatherRepositories

func GatherRepositories(ctx context.Context, sess *session.Session)

GatherRepositories will gather all repositories associated with a given target during a scan session. This is done using threads, whose count is set via commandline flag. Care much be taken to avoid rate limiting associated with suspected DOS attacks.

func GatherTargets

func GatherTargets(sess *session.Session)

GatherTargets will enumerate git targets adding them to a running target list. This will set the targets based on the scan type set within the cmd package.

func GatherUserOrOrg

func GatherUserOrOrg(s *session.Session, targetList []string)

GatherUsers will generate a list of users from github.com that can then be filtered down to a specific target range

func ValidateUserInput

func ValidateUserInput(s *session.Session) error

ValidateUserInput will check for special characters in the strings and make sure we have at least one usr/repo/org to scan

Types

type CloneConfiguration

type CloneConfiguration struct {
	URL        string
	Username   string
	Token      string
	Branch     string
	TagMode    git.TagMode
	Depth      int
	InMemClone bool
	Tag        bool
}

CloneConfiguration holds the configurations for cloning a repo

type GithubRepository

type GithubRepository struct {
	Owner         *string
	ID            *int64
	Name          *string
	FullName      *string
	CloneURL      *string
	URL           *string
	DefaultBranch *string
	Description   *string
	Homepage      *string
}

GithubRepository holds the necessary information for a repository, this data is specific to Github.

Directories

Path Synopsis
Package core represents the core functionality of all commands
Package core represents the core functionality of all commands
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL