Documentation
¶
Index ¶
- Variables
- func AmountArtifact(artifactName string) error
- func AutoCheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
- func CheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
- func ConvertArtifact(artifact *clientpb.Artifact, format string, rdi string) (*clientpb.Artifact, error)
- func CopyProfileFilesExceptConfig(profilePath, targetPath string) error
- func DeleteSuccessWorkflow(owner, repo, token string, workflowID int64) error
- func DetectTransport(implantYaml []byte) string
- func FindTemplate(transport, target string) (string, error)
- func GetActionStatus(owner, repo, token, artifactName string) (string, string, error)
- func GetContainerID(d *DockerBuilder) string
- func GetDockerClient() (*client.Client, error)
- func GetDockerStatus(cli *client.Client, containerName string) (string, error)
- func GetFilePath(name, target, buildType, format string) string
- func GetImage(target string) string
- func GetVolumes() []string
- func GetWorkflowStatus(config *clientpb.GithubActionBuildConfig) error
- func InitTemplatePath()
- func ListTemplates() map[string][]string
- func MoveBuildOutput(target, buildType string, enable3RD bool, outputType string) (string, string, error)
- func MutantSrdi(path string) ([]byte, error)
- func ObjcopyPulse(path, platform, arch string) ([]byte, error)
- func ProcessAutorunWithProfile(paramsBytes []byte, profilePath, targetPath string) error
- func ProcessAutorunZip(zipData []byte, targetPath string) error
- func ProcessAutorunZipFromBytes(zipData []byte) (*clientpb.BuildConfig, error)
- func ProcessAutorunZipToBase64(paramsByte []byte, profileName string) (string, string, error)
- func PushArtifact(owner, repo, token, buildName string, isRemove bool) (*models.Artifact, error)
- func SRDIArtifact(bin []byte, platform, arch string, RDIType string) ([]byte, error)
- func SaveArtifact(dst string, bin []byte) error
- func SendBuildMsg(artifact *clientpb.Artifact, status string, params []byte, err error)
- func SetLicenseID(d *DockerBuilder, licenseID string)
- func WriteAutoYaml(data []byte) error
- func WriteBuildConfigToPath(buildConfig *clientpb.BuildConfig, srcPath string) error
- func WriteProfile(data []byte) error
- type ActionBuilder
- type Artifact
- type ArtifactsResponse
- type Builder
- type BuilderState
- type DockerBuilder
- type Job
- type JobsResponse
- type PatchBuilder
- type SaasBuilder
- type Step
- type Workflow
- type WorkflowDispatchPayload
Constants ¶
This section is empty.
Variables ¶
var ( ERRORSRDI = errors.New("srdi error") ERROROBJCOPY = errors.New("objcopy error") )
var ( //NameSpace = "ghcr.io/chainreactors" //Tag = "nightly-2024-02-03-latest" Ver = "latest" ContainerSourceCodePath = "/root/src" ContainerCargoRegistryCache = "/root/cargo/registry" ContainerCargoGitCache = "/root/cargo/git" ContainerBinPath = "/root/bin" ContainerBuiltinResourcePath = "/tmp/builtin/resources" ContainerCustomResourcePath = "/tmp/custom/resources" ContainerResourcePath = "/root/src/resources" ContainerAutoRunPath = "/root/src/prelude.yaml" ContainerConfigPath = "/root/src/implant.yaml" PATH_ENV = ContainerBinPath + ":/root/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/osxcross/bin:/usr/bin/mingw-w64" )
var (
TemplatePath = filepath.Join(configs.ServerRootPath, "templates")
)
Functions ¶
func AmountArtifact ¶
func AutoCheckSource ¶ added in v0.1.2
func AutoCheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
func CheckSource ¶ added in v0.1.2
func CheckSource(ctx context.Context, req *clientpb.BuildConfig) (*clientpb.BuildConfig, error)
CheckSource
func ConvertArtifact ¶ added in v0.1.2
func CopyProfileFilesExceptConfig ¶ added in v0.1.2
CopyProfileFilesExceptConfig copies all files from the profile directory except implant.yaml to the target path
func DeleteSuccessWorkflow ¶
删除成功workflow
func DetectTransport ¶ added in v0.3.0
DetectTransport infers the transport type from implant.yaml content. It looks for transport-related keywords in the targets section.
func FindTemplate ¶ added in v0.3.0
FindTemplate locates a pre-compiled template binary by transport and target. Naming convention: malefic-{transport}-{target}[.exe]
func GetActionStatus ¶
获取action状态
func GetContainerID ¶
func GetContainerID(d *DockerBuilder) string
func GetDockerClient ¶
func GetDockerStatus ¶
func GetFilePath ¶
func GetVolumes ¶ added in v0.3.0
func GetVolumes() []string
GetVolumes returns Docker volume mounts computed from current configs paths. Called at build time (not init time) so that UpdateSourceCodeRoot takes effect.
func GetWorkflowStatus ¶
func GetWorkflowStatus(config *clientpb.GithubActionBuildConfig) error
func InitTemplatePath ¶ added in v0.3.0
func InitTemplatePath()
func ListTemplates ¶ added in v0.3.0
ListTemplates returns all available template files grouped by transport.
func MoveBuildOutput ¶
func MutantSrdi ¶ added in v0.1.2
func ObjcopyPulse ¶ added in v0.1.2
ObjcopyPulse extracts shellcode from compiled artifact using objcopy
func ProcessAutorunWithProfile ¶ added in v0.1.2
ProcessAutorunWithProfile processes autorun.zip and copies profile files
func ProcessAutorunZip ¶ added in v0.1.2
ProcessAutorunZip processes autorun.zip file, extracting only files from the resource directory to the target root directory
func ProcessAutorunZipFromBytes ¶ added in v0.3.0
func ProcessAutorunZipFromBytes(zipData []byte) (*clientpb.BuildConfig, error)
ProcessAutorunZipFromBytes
func ProcessAutorunZipToBase64 ¶ added in v0.1.2
func PushArtifact ¶
主流程
func SRDIArtifact ¶ added in v0.1.2
func SaveArtifact ¶
func SendBuildMsg ¶
func SetLicenseID ¶ added in v0.1.2
func SetLicenseID(d *DockerBuilder, licenseID string)
func WriteAutoYaml ¶ added in v0.1.2
func WriteBuildConfigToPath ¶ added in v0.3.0
func WriteBuildConfigToPath(buildConfig *clientpb.BuildConfig, srcPath string) error
WriteBuildConfigToPath
func WriteProfile ¶ added in v0.1.2
Types ¶
type ActionBuilder ¶
type ActionBuilder struct {
// contains filtered or unexported fields
}
func NewActionBuilder ¶
func NewActionBuilder(req *clientpb.BuildConfig) *ActionBuilder
func (*ActionBuilder) Execute ¶
func (a *ActionBuilder) Execute() error
type Artifact ¶
type Artifact struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
SizeInBytes int64 `json:"size_in_bytes"`
URL string `json:"url"`
ArchiveDownloadURL string `json:"archive_download_url"`
Expired bool `json:"expired"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
UpdatedAt time.Time `json:"updated_at"`
WorkflowRun struct {
ID int64 `json:"id"`
RepositoryID int64 `json:"repository_id"`
HeadRepositoryID int64 `json:"head_repository_id"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
} `json:"workflow_run"`
}
Artifact represents a GitHub Actions artifact
type ArtifactsResponse ¶
type ArtifactsResponse struct {
TotalCount int `json:"total_count"`
Artifacts []Artifact `json:"artifacts"`
}
ArtifactsResponse is the response structure for listing artifacts
type Builder ¶
type Builder interface {
Generate() (*clientpb.Artifact, error)
Execute() error
Collect() (string, string, error)
}
Builder
func NewBuilder ¶
func NewBuilder(req *clientpb.BuildConfig) (Builder, error)
type BuilderState ¶
type DockerBuilder ¶
type DockerBuilder struct {
// contains filtered or unexported fields
}
func NewDockerBuilder ¶
func NewDockerBuilder(req *clientpb.BuildConfig) *DockerBuilder
func (*DockerBuilder) Execute ¶
func (d *DockerBuilder) Execute() error
type JobsResponse ¶
type PatchBuilder ¶ added in v0.3.0
type PatchBuilder struct {
// contains filtered or unexported fields
}
func NewPatchBuilder ¶ added in v0.3.0
func NewPatchBuilder(req *clientpb.BuildConfig) *PatchBuilder
func (*PatchBuilder) Collect ¶ added in v0.3.0
func (p *PatchBuilder) Collect() (string, string, error)
func (*PatchBuilder) Execute ¶ added in v0.3.0
func (p *PatchBuilder) Execute() error
type SaasBuilder ¶
type SaasBuilder struct {
// contains filtered or unexported fields
}
func NewSaasBuilder ¶
func NewSaasBuilder(req *clientpb.BuildConfig) *SaasBuilder
func (*SaasBuilder) Execute ¶
func (s *SaasBuilder) Execute() error
type Workflow ¶
type Workflow struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
Path string `json:"path"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Status string `json:"status"`
State string `json:"state"`
Conclusion string `json:"conclusion"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
ArtifactsURL string `json:"artifacts_url"`
}
Workflow represents a GitHub Actions workflow
type WorkflowDispatchPayload ¶
type WorkflowDispatchPayload struct {
Ref string `json:"ref"`
Inputs map[string]string `json:"inputs,omitempty"`
}
WorkflowDispatchPayload defines the payload for triggering a workflow dispatch event