Documentation
¶
Overview ¶
Package config provides functions to manage the CookieFarm client configuration globally.
Index ¶
- Variables
- type ArgsAttack
- type ConfigLocal
- type ConfigManager
- func (cm *ConfigManager) GetArgsAttackInstance() ArgsAttack
- func (cm *ConfigManager) GetLocalConfig() ConfigLocal
- func (cm *ConfigManager) GetPID() int
- func (cm *ConfigManager) GetSession() (string, error)
- func (cm *ConfigManager) GetSharedConfig() models.ConfigShared
- func (cm *ConfigManager) GetToken() string
- func (cm *ConfigManager) GetUseBanner() bool
- func (cm *ConfigManager) GetUseTUI() bool
- func (cm *ConfigManager) LoadLocalConfigFromFile() error
- func (cm *ConfigManager) Logout() (string, error)
- func (cm *ConfigManager) MapPortToService(port uint16) string
- func (cm *ConfigManager) ResetLocalConfigToDefaults() (string, error)
- func (cm *ConfigManager) SetArgsAttackInstance(args ArgsAttack)
- func (cm *ConfigManager) SetLocalConfig(config ConfigLocal)
- func (cm *ConfigManager) SetPID(pid int)
- func (cm *ConfigManager) SetSharedConfig(config models.ConfigShared)
- func (cm *ConfigManager) SetToken(token string)
- func (cm *ConfigManager) SetUseBanner(useBanner bool)
- func (cm *ConfigManager) SetUseTUI(useTUI bool)
- func (cm *ConfigManager) ShowLocalConfigContent() (string, error)
- func (cm *ConfigManager) UpdateLocalConfig(host string, port uint16, username string, https bool, exploits []Exploit)
- func (cm *ConfigManager) UpdateLocalConfigToFile(configuration ConfigLocal) (string, error)
- func (cm *ConfigManager) WriteLocalConfigToFile() error
- type Exploit
Constants ¶
This section is empty.
Variables ¶
var ConfigTemplate = []byte(`host: "localhost"
port: 8080
https: false
username: "cookieguest"
`)
var DefaultConfigPath, _ = filesystem.ExpandTilde("~/.config/cookiefarm")
var ExploitTemplate = []byte(`#!/usr/bin/env python3
from cookiefarm import exploit_manager
# "ip" are the IP address of the target team (example: 10.10.X.1)
# "port" is the port of the target service (example: 1337)
# "name_service" is the name of the service to exploit (example: "CookieService")
# "flag_ids" is the flag IDs of the target team and target service (example: [{"username": "psQSDAasd", "password": "qweqweqwe"}, {"username": "sdafjhAS", "password": "HIUOasdb"}])
@exploit_manager
def exploit(ip, port, name_service, flag_ids: list):
# Run your exploit here
flag = ""
# Just print the flag to stdout
print(flag)
`)
Functions ¶
This section is empty.
Types ¶
type ArgsAttack ¶
type ArgsAttack struct {
ServicePort uint16 `json:"port"` // Service Port
TickTime int `json:"tick_time"` // Optional custom tick time
ThreadCount int `json:"thread_count"` // Optional number of concurrent threads (coroutine) to use
Detach bool `json:"detach"` // Run in background if true
ExploitPath string `json:"exploit_path"` // Path to the exploit to run
}
ArgsAttack represents the command-line arguments or configuration values passed at runtime to control the exploit manager behavior.
type ConfigLocal ¶
type ConfigLocal struct {
Host string `json:"host"` // Host address of the server
Port uint16 `json:"port"` // Port of the server
HTTPS bool `json:"protocol"` // Protocol used to connect to the server (e.g., http, https)
Username string `json:"username"` // Username of the client
Exploits []Exploit `json:"exploits"` // List of exploits available in the client
}
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager manages all configuration state in a thread-safe manner
func GetConfigManager ¶
func GetConfigManager() *ConfigManager
GetConfigManager returns the global ConfigManager instance Use this to access the new configuration management system
func GetInstance ¶
func GetInstance() *ConfigManager
GetInstance returns the singleton instance of ConfigManager
func NewConfigManager ¶
func NewConfigManager() *ConfigManager
NewConfigManager creates a new ConfigManager instance for dependency injection Use this when you need a fresh instance (e.g., for testing)
func (*ConfigManager) GetArgsAttackInstance ¶
func (cm *ConfigManager) GetArgsAttackInstance() ArgsAttack
ArgsAttack methods
func (*ConfigManager) GetLocalConfig ¶
func (cm *ConfigManager) GetLocalConfig() ConfigLocal
LocalConfig methods
func (*ConfigManager) GetSession ¶
func (cm *ConfigManager) GetSession() (string, error)
GetSession retrieves the current stored session
func (*ConfigManager) GetSharedConfig ¶
func (cm *ConfigManager) GetSharedConfig() models.ConfigShared
SharedConfig methods
func (*ConfigManager) LoadLocalConfigFromFile ¶
func (cm *ConfigManager) LoadLocalConfigFromFile() error
LoadLocalConfigFromFile loads the local configuration from file
func (*ConfigManager) Logout ¶
func (cm *ConfigManager) Logout() (string, error)
Logout handles user logout by removing session file
func (*ConfigManager) MapPortToService ¶
func (cm *ConfigManager) MapPortToService(port uint16) string
MapPortToService maps a port to a service name using the shared configuration
func (*ConfigManager) ResetLocalConfigToDefaults ¶
func (cm *ConfigManager) ResetLocalConfigToDefaults() (string, error)
ResetLocalConfigToDefaults resets the local configuration to defaults
func (*ConfigManager) SetArgsAttackInstance ¶
func (cm *ConfigManager) SetArgsAttackInstance(args ArgsAttack)
func (*ConfigManager) SetLocalConfig ¶
func (cm *ConfigManager) SetLocalConfig(config ConfigLocal)
func (*ConfigManager) SetPID ¶
func (cm *ConfigManager) SetPID(pid int)
func (*ConfigManager) SetSharedConfig ¶
func (cm *ConfigManager) SetSharedConfig(config models.ConfigShared)
func (*ConfigManager) SetToken ¶
func (cm *ConfigManager) SetToken(token string)
func (*ConfigManager) SetUseBanner ¶
func (cm *ConfigManager) SetUseBanner(useBanner bool)
func (*ConfigManager) SetUseTUI ¶
func (cm *ConfigManager) SetUseTUI(useTUI bool)
func (*ConfigManager) ShowLocalConfigContent ¶
func (cm *ConfigManager) ShowLocalConfigContent() (string, error)
ShowLocalConfigContent displays the current local configuration file content
func (*ConfigManager) UpdateLocalConfig ¶
func (cm *ConfigManager) UpdateLocalConfig(host string, port uint16, username string, https bool, exploits []Exploit)
UpdateLocalConfig the value empty are not setted except for https for the string empty is "" for number is 0
func (*ConfigManager) UpdateLocalConfigToFile ¶
func (cm *ConfigManager) UpdateLocalConfigToFile(configuration ConfigLocal) (string, error)
UpdateLocalConfigToFile updates the local configuration and writes to file
func (*ConfigManager) WriteLocalConfigToFile ¶
func (cm *ConfigManager) WriteLocalConfigToFile() error
WriteLocalConfigToFile writes the current local configuration to file