Documentation
¶
Index ¶
- Constants
- Variables
- func CloneRepository(session *Session, url string, ref string, dir string) (*git.Repository, error)
- func GetEntropy(data string) (entropy float64)
- func GetGists(session *Session)
- func GetHash(s string) string
- func GetRepositories(session *Session)
- func GetRepository(session *Session, id int64) (*github.Repository, error)
- func GetTempDir(suffix string) string
- func IsSkippableFile(path string) bool
- func LogIfError(text string, err error)
- func PathExists(path string) bool
- func Pluralize(count int, singular string, plural string) string
- func ShowSpinner() func()
- type Config
- type ConfigSignature
- type GitHubClientWrapper
- type GitResource
- type GitResourceType
- type Logger
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) Fatal(format string, args ...interface{})
- func (l *Logger) Important(format string, args ...interface{})
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Log(level int, format string, args ...interface{})
- func (l *Logger) SetDebug(d bool)
- func (l *Logger) SetSilent(d bool)
- func (l *Logger) Warn(format string, args ...interface{})
- type MatchFile
- type Options
- type PatternSignature
- type Session
- func (s *Session) FreeClient(client *GitHubClientWrapper)
- func (s *Session) GetClient() *GitHubClientWrapper
- func (s *Session) InitCsvWriter()
- func (s *Session) InitGitHubClients()
- func (s *Session) InitLogger()
- func (s *Session) InitSignatures()
- func (s *Session) InitThreads()
- func (s *Session) Start()
- func (s *Session) WriteToCsv(line []string)
- type Signature
- type SimpleSignature
- type Spinner
Constants ¶
View Source
const ( Name = "shhgit" Version = "0.4" Author = "Paul Price (@darkp0rt) - www.darkport.co.uk" )
View Source
const ( FATAL = 5 ERROR = 4 IMPORTANT = 3 WARN = 2 INFO = 1 DEBUG = 0 )
View Source
const ( TypeSimple = "simple" TypePattern = "pattern" PartExtension = "extension" PartFilename = "filename" PartPath = "path" PartContents = "contents" )
View Source
const Banner = ` _ _ _ _ | | | | (_) | ___| |__ | |__ __ _ _| |_ / __| '_ \| '_ \ / _` + "`" + ` | | __| \__ \ | | | | | | (_| | | |_ |___/_| |_|_| |_|\__, |_|\__| __/ | v` + Version + ` |___/`
View Source
const SpinnerChars = `|/-\`
Variables ¶
Functions ¶
func CloneRepository ¶
func GetEntropy ¶
func GetRepositories ¶
func GetRepositories(session *Session)
func GetRepository ¶
func GetRepository(session *Session, id int64) (*github.Repository, error)
func GetTempDir ¶
func IsSkippableFile ¶
func LogIfError ¶
func PathExists ¶
func ShowSpinner ¶
func ShowSpinner() func()
Types ¶
type Config ¶
type Config struct { GitHubAccessTokens []string `yaml:"github_access_tokens"` Webhook string `yaml:"webhook,omitempty"` WebhookPayload string `yaml:"webhook_payload,omitempty"` BlacklistedStrings []string `yaml:"blacklisted_strings"` BlacklistedExtensions []string `yaml:"blacklisted_extensions"` BlacklistedPaths []string `yaml:"blacklisted_paths"` BlacklistedEntropyExtensions []string `yaml:"blacklisted_entropy_extensions"` Signatures []ConfigSignature `yaml:"signatures"` }
func ParseConfig ¶
func (*Config) UnmarshalYAML ¶
type ConfigSignature ¶
type GitHubClientWrapper ¶
type GitResource ¶
type GitResource struct { Id int64 Type GitResourceType Url string Ref string }
type GitResourceType ¶
type GitResourceType int
const ( LOCAL_SOURCE GitResourceType = iota GITHUB_SOURCE GITHUB_COMMENT GIST_SOURCE BITBUCKET_SOURCE GITLAB_SOURCE )
type Options ¶
type Options struct { Threads *int Silent *bool Debug *bool MaximumRepositorySize *uint MaximumFileSize *uint CloneRepositoryTimeout *uint EntropyThreshold *float64 MinimumStars *uint PathChecks *bool ProcessGists *bool TempDirectory *string CsvPath *string SearchQuery *string Local *string Live *string ConfigPath *string }
func ParseOptions ¶
type PatternSignature ¶
type PatternSignature struct {
// contains filtered or unexported fields
}
func (PatternSignature) GetContentsMatches ¶
func (s PatternSignature) GetContentsMatches(contents []byte) []string
func (PatternSignature) Name ¶
func (s PatternSignature) Name() string
type Session ¶
type Session struct { sync.Mutex Version string Log *Logger Options *Options Config *Config Signatures []Signature Repositories chan GitResource Gists chan string Comments chan string Context context.Context Clients chan *GitHubClientWrapper ExhaustedClients chan *GitHubClientWrapper CsvWriter *csv.Writer }
func GetSession ¶
func GetSession() *Session
func (*Session) FreeClient ¶
func (s *Session) FreeClient(client *GitHubClientWrapper)
FreeClient returns the GitHub Client to the pool of available, non-rate-limited channel of clients in the session
func (*Session) GetClient ¶
func (s *Session) GetClient() *GitHubClientWrapper
func (*Session) InitCsvWriter ¶
func (s *Session) InitCsvWriter()
func (*Session) InitGitHubClients ¶
func (s *Session) InitGitHubClients()
func (*Session) InitLogger ¶
func (s *Session) InitLogger()
func (*Session) InitSignatures ¶
func (s *Session) InitSignatures()
func (*Session) InitThreads ¶
func (s *Session) InitThreads()
func (*Session) WriteToCsv ¶
type Signature ¶
type Signature interface { Name() string Match(file MatchFile) (bool, string) GetContentsMatches(contents []byte) []string }
func GetSignatures ¶
type SimpleSignature ¶
type SimpleSignature struct {
// contains filtered or unexported fields
}
func (SimpleSignature) GetContentsMatches ¶
func (s SimpleSignature) GetContentsMatches(contents []byte) []string
func (SimpleSignature) Name ¶
func (s SimpleSignature) Name() string
Click to show internal directories.
Click to hide internal directories.