Documentation ¶
Index ¶
- Constants
- Variables
- func AppendIfMissing(slice []string, e string) []string
- func CleanHostname(hostname string) string
- func DefaultUserAgent() string
- func DownloadResource(resource ModuleResource, config *FringeConfig) error
- func FileExists(filename string) bool
- func GenerateDialer(allowIPAddresses []string) (func(string, string) (net.Conn, error), error)
- func GetCommands() []*cli.Command
- func GetProxyFromEnv() (string, bool)
- func GetRessourceFile(config *FringeConfig, filename string) (string, error)
- func IsHostname(host string) bool
- func IsIPv4(rawString string) bool
- func IsURL(url string) bool
- func IsValidAddr(addr string) bool
- func LookupCName(fqdn, serverAddr string) ([]string, error)
- func LookupNS(domain, serverAddr string) ([]string, error)
- func LookupName(fqdn, serverAddr string) ([]string, error)
- func ParseYAMLFile(filePath string, out interface{}) error
- func ReadJSONFile(path string, result interface{}) error
- func RegisterCommand(name, usage string, data Commander, flags []cli.Flag)
- func SearchAllHostname(rawString string) []string
- func SearchAllIP(rawString string) []string
- func StringInSlice(slice []string, e string) bool
- type AppVersionInfo
- type Asset
- type AssetType
- type Commander
- type FringeClientModuleListRequest
- type FringeClientUpdateJobRequest
- type FringeConfig
- type FringeWorkflow
- type FringeWorkflowAssetType
- type FringeWorkflowJob
- type FringeWorkflowNewAssetTrigger
- type FringeWorkflowTrigger
- type HTTPClient
- func (client *HTTPClient) DoJson(method, target, host, cookie string, request interface{}, response interface{}) (*int, *[]byte, *http.Header, error)
- func (client *HTTPClient) DoRequest(method, target, host, cookie string, data io.Reader) (*int, *[]byte, *http.Header, error)
- func (client *HTTPClient) DownloadFile(method, target, host, cookie, destination string, data io.Reader) (*int, *http.Header, error)
- func (client *HTTPClient) Get(target, host, cookie string, data io.Reader) (*int, *[]byte, *http.Header, error)
- func (client *HTTPClient) Post(target, host, cookie string, data io.Reader) (*int, *[]byte, *http.Header, error)
- func (client *HTTPClient) Put(target, host, cookie string, data io.Reader) (*int, *[]byte, *http.Header, error)
- func (client *HTTPClient) Trace(target, host, cookie string, data io.Reader) (*int, *[]byte, *http.Header, error)
- type HTTPHeader
- type HTTPOptions
- type Job
- type Module
- type ModuleContext
- func (ctx *ModuleContext) AddTag(tag string) error
- func (ctx *ModuleContext) CreateNewAssetAsHostname(hostname string) error
- func (ctx *ModuleContext) CreateNewAssetAsIP(ip string) error
- func (ctx *ModuleContext) CreateNewAssetAsRaw(raw string) error
- func (ctx *ModuleContext) CreateNewAssetAsURL(url string) error
- func (ctx *ModuleContext) GetAssetAsHostname() (string, error)
- func (ctx *ModuleContext) GetAssetAsIP() (string, error)
- func (ctx *ModuleContext) GetAssetAsRawString() (string, error)
- func (ctx *ModuleContext) GetAssetAsURL() (string, error)
- func (ctx *ModuleContext) GetBeaconAsURL() string
- func (ctx *ModuleContext) GetConfigurationValue(key string) (string, error)
- func (ctx *ModuleContext) GetDefaultHTTPOptions() *HTTPOptions
- func (ctx *ModuleContext) GetRessourceFile(filename string) (string, error)
- func (ctx *ModuleContext) HTTPRequestJson(method string, target string, request interface{}, response interface{}, ...) (*int, *[]byte, *http.Header, error)
- func (ctx *ModuleContext) HttpRequest(method string, target string, data io.Reader, opts *HTTPOptions) (*int, *[]byte, *http.Header, error)
- type ModuleInterface
- type ModuleList
- type ModuleResource
- type RunnerClient
- type Session
- type StringArray
Constants ¶
const ( JOB_STATUS_WAITING string = "WA" JOB_STATUS_ON_GOING string = "OG" JOB_STATUS_SUCCESS string = "SU" JOB_STATUS_ERROR string = "ER" )
const ( ContentTypeHeaderName = "Content-Type" AcceptHeaderName = "Accept" ApplicationJSON = "application/json" )
const (
FRINGE_HOME_DIRECTORY = ".fringe-runner"
)
const (
FRINGE_RESSOURCE_DIRECTORY = "resources"
)
Variables ¶
var AssetTypes = map[string]AssetType{ "ip": ASSET_IP, "hostname": ASSET_HOSTNAME, "url": ASSET_URL, "raw": ASSET_RAW, }
var BRANCH = "HEAD"
var BUILT = "unknown"
var NAME = "fringe-runner"
var REVISION = "HEAD"
var VERSION = "development version"
Functions ¶
func AppendIfMissing ¶
func CleanHostname ¶
func DefaultUserAgent ¶
func DefaultUserAgent() string
func DownloadResource ¶
func DownloadResource(resource ModuleResource, config *FringeConfig) error
func GenerateDialer ¶
func GetCommands ¶
func GetCommands() []*cli.Command
func GetProxyFromEnv ¶
func GetRessourceFile ¶
func GetRessourceFile(config *FringeConfig, filename string) (string, error)
func IsHostname ¶
func IsValidAddr ¶
func LookupCName ¶
LookupName returns IPv4 addresses from A records or error.
func LookupName ¶
LookupName returns IPv4 addresses from A records or error.
func ParseYAMLFile ¶
Parse a YAML file to a structure
func ReadJSONFile ¶
func RegisterCommand ¶
func SearchAllHostname ¶
func SearchAllIP ¶
func StringInSlice ¶
Types ¶
type AppVersionInfo ¶
type AppVersionInfo struct { Name string `json:"name"` Version string `json:"version"` Revision string `json:"revision"` Branch string `json:"branch"` GOVersion string `json:"go_version"` BuiltAt string `json:"built_at"` OS string `json:"os"` Architecture string `json:"architecture"` }
var AppVersion AppVersionInfo
func (*AppVersionInfo) Extended ¶
func (v *AppVersionInfo) Extended() string
func (*AppVersionInfo) Printer ¶
func (v *AppVersionInfo) Printer(c *cli.Context)
func (*AppVersionInfo) ShortLine ¶
func (v *AppVersionInfo) ShortLine() string
type Asset ¶
type Asset struct { ID string `json:"id"` Value string `json:"value"` Type AssetType `json:"type"` }
Represents an asset with a value and a type
type Commander ¶
type Commander interface {
Execute(c *cli.Context, config *FringeConfig) error
}
type FringeClientModuleListRequest ¶
type FringeClientModuleListRequest struct {
Modules []Module `json:"modules"`
}
type FringeClientUpdateJobRequest ¶
type FringeClientUpdateJobRequest struct { ID string `json:"id"` Status string `json:"status"` Assets []Asset `json:"datas"` Tags []string `json:"tags"` Description string `json:"description"` StartedAt int64 `json:"startedAt"` EndedAt int64 `json:"endedAt"` }
func (FringeClientUpdateJobRequest) JSON ¶
func (r FringeClientUpdateJobRequest) JSON() string
type FringeConfig ¶
type FringeConfig struct { LogLevel string `yaml:"log_level"` Proxy string `yaml:"proxy"` VerifyCert bool `yaml:"verify_cert"` HomeDirectory string `yaml:"home_directory"` FringeCoordinator string `yaml:"fringe_coordinator"` FringeRunnerId string `yaml:"fringe_runner_id"` FringeRunnerToken string `yaml:"fringe_runner_token"` ModuleConfiguration map[string]string `yaml:"module_config"` }
func ReadConfigFile ¶
func ReadConfigFile(configPath string) (*FringeConfig, error)
type FringeWorkflow ¶
type FringeWorkflow struct { Name string `yaml:"name"` On FringeWorkflowTrigger `yaml:"on"` Jobs []FringeWorkflowJob `yaml:"jobs"` }
func NewFringeWorkflow ¶
func NewFringeWorkflow(filePath string) (*FringeWorkflow, error)
Parse a workflow YAML file, check the structure and returns the object
func (*FringeWorkflow) Run ¶
func (w *FringeWorkflow) Run(asset Asset, sess *Session, config *FringeConfig) error
func (*FringeWorkflow) String ¶
func (w *FringeWorkflow) String() string
type FringeWorkflowAssetType ¶
type FringeWorkflowAssetType []AssetType
type FringeWorkflowJob ¶
type FringeWorkflowNewAssetTrigger ¶
type FringeWorkflowNewAssetTrigger struct { Types FringeWorkflowAssetType `yaml:"types"` Regex StringArray `yaml:"regex"` }
type FringeWorkflowTrigger ¶
type FringeWorkflowTrigger struct {
NewAsset FringeWorkflowNewAssetTrigger `yaml:"new_asset"`
}
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
Represents an HTTP client
func NewHTTPClient ¶
func NewHTTPClient(c context.Context, opt *HTTPOptions) (*HTTPClient, error)
func (*HTTPClient) DownloadFile ¶
type HTTPHeader ¶
Represents a (custom) HTTP header
func GetBasicAuthHeader ¶
func GetBasicAuthHeader(username string, password string) HTTPHeader
type HTTPOptions ¶
type HTTPOptions struct { // We use a default User-Agent but a user may need a custom one to bypass // some verification UserAgent string // Custom headers Headers []HTTPHeader // Some use need a custom timeout, specially on a brute-force attack Timeout time.Duration // Do e follow redirection on 301/302 ? FollowRedirect bool // Set a proxy for the HTTP and HTTPS requests Proxy string // Do we need to check the SSL/TLS server certificate. Can be usefull when // you use a custom proxy like Burp VerifyCert bool // White list for IP addresses WhiteListIP []string }
Represents options for the HTTP client By default a user pass a HTTP option to instanciate a HTTP client. This struct must contains every options the user needs to pass to configure the client.
type ModuleContext ¶
type ModuleContext struct { Asset Asset NewAssets []Asset NewTags []string // contains filtered or unexported fields }
func NewModuleContext ¶
func NewModuleContext(asset Asset, config *FringeConfig) (*ModuleContext, error)
func (*ModuleContext) AddTag ¶
func (ctx *ModuleContext) AddTag(tag string) error
Add a tag to the current asset
func (*ModuleContext) CreateNewAssetAsHostname ¶
func (ctx *ModuleContext) CreateNewAssetAsHostname(hostname string) error
Create a hostname from the current string without format verification
func (*ModuleContext) CreateNewAssetAsIP ¶
func (ctx *ModuleContext) CreateNewAssetAsIP(ip string) error
Create an IP from the current string without format verification
func (*ModuleContext) CreateNewAssetAsRaw ¶
func (ctx *ModuleContext) CreateNewAssetAsRaw(raw string) error
Create a raw asset
func (*ModuleContext) CreateNewAssetAsURL ¶
func (ctx *ModuleContext) CreateNewAssetAsURL(url string) error
Create a URL from the current string without format verification
func (*ModuleContext) GetAssetAsHostname ¶
func (ctx *ModuleContext) GetAssetAsHostname() (string, error)
Check if the asset is a hostname and return it
func (*ModuleContext) GetAssetAsIP ¶
func (ctx *ModuleContext) GetAssetAsIP() (string, error)
Check if the asset is an IP and return it
func (*ModuleContext) GetAssetAsRawString ¶
func (ctx *ModuleContext) GetAssetAsRawString() (string, error)
Get the current asset as a raw string
func (*ModuleContext) GetAssetAsURL ¶
func (ctx *ModuleContext) GetAssetAsURL() (string, error)
Check if the asset is a URL and return it
func (*ModuleContext) GetBeaconAsURL ¶
func (ctx *ModuleContext) GetBeaconAsURL() string
func (*ModuleContext) GetConfigurationValue ¶
func (ctx *ModuleContext) GetConfigurationValue(key string) (string, error)
Get a configuration variable for the module
func (*ModuleContext) GetDefaultHTTPOptions ¶
func (ctx *ModuleContext) GetDefaultHTTPOptions() *HTTPOptions
func (*ModuleContext) GetRessourceFile ¶
func (ctx *ModuleContext) GetRessourceFile(filename string) (string, error)
Get the path for a resource file
func (*ModuleContext) HTTPRequestJson ¶
func (ctx *ModuleContext) HTTPRequestJson(method string, target string, request interface{}, response interface{}, opts *HTTPOptions) (*int, *[]byte, *http.Header, error)
func (*ModuleContext) HttpRequest ¶
type ModuleInterface ¶
type ModuleInterface interface { Name() string Slug() string Description() string ResourceURLs() []ModuleResource Run(*ModuleContext) error }
type ModuleList ¶
type ModuleList []ModuleInterface
type ModuleResource ¶
type RunnerClient ¶
type RunnerClient interface { SendModuleList([]Module) error RequestJob() (*Job, error) UpdateJob(*Job, []Asset) error }
Representeq a client that request next job and send update to a backend
type Session ¶
type Session struct {
Modules ModuleList
}
func NewSession ¶
func (*Session) GetModules ¶
func (*Session) RegisterModule ¶
func (s *Session) RegisterModule(mod ModuleInterface)
type StringArray ¶
type StringArray []string
func (*StringArray) UnmarshalYAML ¶
func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error