Documentation
¶
Index ¶
- Constants
- Variables
- func CloneRepository(session *Session, url string, dir string) (*git.Repository, error)
- func GetConfigYaml() ([]byte, 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
- type Config
- type ConfigSignature
- type GitHubClientWrapper
- 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
- type Signature
- type SimpleSignature
Constants ¶
View Source
const ( Name = "shhgit" Version = "0.2" Author = "Paul Price (@darkp0rt)" )
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" )
Variables ¶
Functions ¶
func CloneRepository ¶
func GetConfigYaml ¶
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 ¶
Types ¶
type Config ¶
type Config struct {
GitHubAccessTokens []string `yaml:"github_access_tokens"`
SlackWebhook string `yaml:"slack_webhook,omitempty"`
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 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
}
func ParseOptions ¶
type PatternSignature ¶
type PatternSignature struct {
// contains filtered or unexported fields
}
func (PatternSignature) GetContentsMatches ¶
func (s PatternSignature) GetContentsMatches(file MatchFile) []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 int64
Gists chan string
Context context.Context
Clients []*GitHubClientWrapper
CsvWriter *csv.Writer
}
func GetSession ¶
func GetSession() *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(file MatchFile) []string
}
func GetSignatures ¶
type SimpleSignature ¶
type SimpleSignature struct {
// contains filtered or unexported fields
}
func (SimpleSignature) GetContentsMatches ¶
func (s SimpleSignature) GetContentsMatches(file MatchFile) []string
func (SimpleSignature) Name ¶
func (s SimpleSignature) Name() string
Click to show internal directories.
Click to hide internal directories.