Skip to content

Commit

Permalink
Merge pull request #13 from Nahid5/main
Browse files Browse the repository at this point in the history
CS 4.6 Support
  • Loading branch information
Tylous authored May 5, 2022
2 parents 4ac281b + 5e4d6a6 commit a51aa35
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 49 deletions.
61 changes: 40 additions & 21 deletions Loader/Loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@ import (
)

type FlagOptions struct {
sleeptime string
jitter string
useragent string
uri string
customuri string
beacon_PE string
processinject_min_alloc string
Post_EX_Process_Name string
metadata string
injector string
Host string
outFile string
Profile string
ProfilePath string
cert_password string
custom_cert string
CDN string
Yaml string
sleeptime string
jitter string
useragent string
uri string
customuri string
beacon_PE string
processinject_min_alloc string
Post_EX_Process_Name string
metadata string
injector string
Host string
outFile string
Profile string
ProfilePath string
cert_password string
custom_cert string
CDN string
Yaml string
tasks_max_size string
tasks_proxy_max_size string
tasks_dns_proxy_max_size string
}

type Beacon_Com struct {
Expand Down Expand Up @@ -64,7 +67,7 @@ type Beacon_SSL struct {
var num_Profile int
var Post bool

func GenerateOptions(stage, sleeptime, jitter, useragent, uri, customuri, customuriGET, customuriPOST, beacon_PE, processinject_min_alloc, Post_EX_Process_Name, metadata, injector, Host, Profile, ProfilePath, outFile, custom_cert, cert_password, CDN, CDN_Value, datajitter, Keylogger string, Forwarder bool) {
func GenerateOptions(stage, sleeptime, jitter, useragent, uri, customuri, customuriGET, customuriPOST, beacon_PE, processinject_min_alloc, Post_EX_Process_Name, metadata, injector, Host, Profile, ProfilePath, outFile, custom_cert, cert_password, CDN, CDN_Value, datajitter, Keylogger string, Forwarder bool, tasks_max_size string, tasks_proxy_max_size string, tasks_dns_proxy_max_size string) {
Beacon_Com := &Beacon_Com{}
Beacon_Stage_p1 := &Beacon_Stage_p1{}
Beacon_Stage_p2 := &Beacon_Stage_p2{}
Expand All @@ -77,7 +80,7 @@ func GenerateOptions(stage, sleeptime, jitter, useragent, uri, customuri, custom
var HostStageMessage string

fmt.Println("[*] Preparing Varibles...")
HostStageMessage, Beacon_Com.Variables = GenerateComunication(stage, sleeptime, jitter, useragent, datajitter)
HostStageMessage, Beacon_Com.Variables = GenerateComunication(stage, sleeptime, jitter, useragent, datajitter, tasks_max_size, tasks_proxy_max_size, tasks_dns_proxy_max_size)
Beacon_PostEX.Variables = GeneratePostProcessName(Post_EX_Process_Name, Keylogger)
Beacon_GETPOST.Variables = GenerateHTTPVaribles(Host, metadata, uri, customuri, customuriGET, customuriPOST, CDN, CDN_Value, Profile, Forwarder)
Beacon_Stage_p2.Variables = GeneratePE(beacon_PE)
Expand All @@ -99,7 +102,7 @@ func GenerateOptions(stage, sleeptime, jitter, useragent, uri, customuri, custom
fmt.Println("[+] Happy Hacking")
}

func GenerateComunication(stage, sleeptime, jitter, useragent, datajitter string) (string, map[string]string) {
func GenerateComunication(stage, sleeptime, jitter, useragent, datajitter string, tasks_max_size string, tasks_proxy_max_size string, tasks_dns_proxy_max_size string) (string, map[string]string) {
Beacon_Com := &Beacon_Com{}
Beacon_Com.Variables = make(map[string]string)
var HostStageMessage string
Expand Down Expand Up @@ -127,6 +130,22 @@ func GenerateComunication(stage, sleeptime, jitter, useragent, datajitter string
if datajitter == "" {
Beacon_Com.Variables["datajitter"] = Utils.GenerateNumer(10, 60)
}

if tasks_max_size != "" {
Beacon_Com.Variables["tasks_max_size"] = tasks_max_size
} else {
Beacon_Com.Variables["tasks_max_size"] = "1048576"
}
if tasks_proxy_max_size != "" {
Beacon_Com.Variables["tasks_proxy_max_size"] = tasks_proxy_max_size
} else {
Beacon_Com.Variables["tasks_proxy_max_size"] = "921600"
}
if tasks_dns_proxy_max_size != "" {
Beacon_Com.Variables["tasks_dns_proxy_max_size"] = tasks_dns_proxy_max_size
} else {
Beacon_Com.Variables["tasks_dns_proxy_max_size"] = "71680"
}
SSH_Numb, _ := strconv.Atoi(Utils.GenerateNumer(0, 4))
Beacon_Com.Variables["SSH_Banner"] = Struct.SSH_Banner[SSH_Numb]

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ Usage of ./SourcePoint:
[*] Linux
[*] Mac
[*] Custom - Whatever string you specify will be used as the user agent
-TasksMaxSize string
The maximum size (in bytes) of task(s) and proxy data that can be transferred through a communication channel at a check in
-TasksProxyMaxSize string
The maximum size (in bytes) of proxy data to transfer via the communication channel at a check in.
-TasksDnsProxyMaxSize string
The maximum size (in bytes) of proxy data to transfer via the DNS communication channel at a check in.
-Yaml string
Path to the Yaml config file
```
Expand Down
68 changes: 40 additions & 28 deletions SourcePoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ import (
)

type FlagOptions struct {
stage string
sleeptime string
jitter string
useragent string
uri string
customuri string
customuriGET string
customuriPOST string
beacon_PE string
processinject_min_alloc string
Post_EX_Process_Name string
metadata string
injector string
Host string
outFile string
Profile string
ProfilePath string
cert_password string
custom_cert string
CDN string
CDN_Value string
Datajitter string
Keylogger string
Forwarder bool
Yaml string
stage string
sleeptime string
jitter string
useragent string
uri string
customuri string
customuriGET string
customuriPOST string
beacon_PE string
processinject_min_alloc string
Post_EX_Process_Name string
metadata string
injector string
Host string
outFile string
Profile string
ProfilePath string
cert_password string
custom_cert string
CDN string
CDN_Value string
Datajitter string
Keylogger string
Forwarder bool
tasks_max_size string
tasks_proxy_max_size string
tasks_dns_proxy_max_size string
Yaml string
}

type conf struct {
Expand Down Expand Up @@ -65,6 +68,9 @@ type conf struct {
Datajitter string `yaml:"Datajitter"`
Keylogger string `yaml:"Keylogger"`
Forwarder bool `yaml:"Forwarder"`
TasksMaxSize string `yaml:"TasksMaxSize"`
TasksProxyMaxSize string `yaml:"TasksProxyMaxSize"`
TasksDnsProxyMaxSize string `yaml:"TasksDnsProxyMaxSize"`
}

func (c *conf) getConf(yamlfile string) *conf {
Expand Down Expand Up @@ -177,9 +183,12 @@ func options() *FlagOptions {
CDN_Value := flag.String("CDN-Value", "", "CDN cookie value (typically used for AzureEdge profiles)")
CDN := flag.String("CDN", "", "CDN cookie name (typically used for AzureEdge profiles)")
Forwarder := flag.Bool("Forwarder", false, "Enabled the X-forwarded-For header (Good for when your C2 is behind a redirector)")
tasks_max_size := flag.String("TasksMaxSize", "", "The maximum size (in bytes) of task(s) and proxy data that can be transferred through a communication channel at a check in")
tasks_proxy_max_size := flag.String("TasksProxyMaxSize", "", "The maximum size (in bytes) of proxy data to transfer via the communication channel at a check in")
tasks_dns_proxy_max_size := flag.String("TasksDnsProxyMaxSize", "", "The maximum size (in bytes) of proxy data to transfer via the DNS communication channel at a check in")
Yaml := flag.String("Yaml", "", "Path to the Yaml config file")
flag.Parse()
return &FlagOptions{stage: *stage, sleeptime: *sleeptime, jitter: *jitter, useragent: *useragent, uri: *uri, customuri: *customuri, customuriGET: *customuriGET, customuriPOST: *customuriPOST, beacon_PE: *beacon_PE, processinject_min_alloc: *processinject_min_alloc, Post_EX_Process_Name: *Post_EX_Process_Name, metadata: *metadata, injector: *injector, Host: *Host, Profile: *Profile, ProfilePath: *ProfilePath, outFile: *outFile, custom_cert: *custom_cert, cert_password: *cert_password, CDN: *CDN, CDN_Value: *CDN_Value, Yaml: *Yaml, Datajitter: *Datajitter, Keylogger: *Keylogger, Forwarder: *Forwarder}
return &FlagOptions{stage: *stage, sleeptime: *sleeptime, jitter: *jitter, useragent: *useragent, uri: *uri, customuri: *customuri, customuriGET: *customuriGET, customuriPOST: *customuriPOST, beacon_PE: *beacon_PE, processinject_min_alloc: *processinject_min_alloc, Post_EX_Process_Name: *Post_EX_Process_Name, metadata: *metadata, injector: *injector, Host: *Host, Profile: *Profile, ProfilePath: *ProfilePath, outFile: *outFile, custom_cert: *custom_cert, cert_password: *cert_password, CDN: *CDN, CDN_Value: *CDN_Value, Yaml: *Yaml, Datajitter: *Datajitter, Keylogger: *Keylogger, Forwarder: *Forwarder, tasks_max_size: *tasks_max_size, tasks_proxy_max_size: *tasks_proxy_max_size, tasks_dns_proxy_max_size: *tasks_dns_proxy_max_size}

}

Expand Down Expand Up @@ -223,6 +232,9 @@ func main() {
opt.Datajitter = c.Datajitter
opt.Keylogger = c.Keylogger
opt.Forwarder = c.Forwarder
opt.tasks_max_size = c.TasksMaxSize
opt.tasks_proxy_max_size = c.TasksProxyMaxSize
opt.tasks_dns_proxy_max_size = c.TasksDnsProxyMaxSize
}
if opt.outFile == "" {
log.Fatal("Error: Please provide a file name to save the profile into")
Expand All @@ -236,6 +248,6 @@ func main() {
if (opt.customuriGET != "" && opt.customuriPOST == "") || (opt.customuriGET == "" && opt.customuriPOST != "") {
log.Fatal("Error: When using CustomuriGET/CustomuriPOST, both must be sepecified")
}

Loader.GenerateOptions(opt.stage, opt.sleeptime, opt.jitter, opt.useragent, opt.uri, opt.customuri, opt.customuriGET, opt.customuriPOST, opt.beacon_PE, opt.processinject_min_alloc, opt.Post_EX_Process_Name, opt.metadata, opt.injector, opt.Host, opt.Profile, opt.ProfilePath, opt.outFile, opt.custom_cert, opt.cert_password, opt.CDN, opt.CDN_Value, opt.Datajitter, opt.Keylogger, opt.Forwarder)
fmt.Println(c.TasksMaxSize)
Loader.GenerateOptions(opt.stage, opt.sleeptime, opt.jitter, opt.useragent, opt.uri, opt.customuri, opt.customuriGET, opt.customuriPOST, opt.beacon_PE, opt.processinject_min_alloc, opt.Post_EX_Process_Name, opt.metadata, opt.injector, opt.Host, opt.Profile, opt.ProfilePath, opt.outFile, opt.custom_cert, opt.cert_password, opt.CDN, opt.CDN_Value, opt.Datajitter, opt.Keylogger, opt.Forwarder, opt.tasks_max_size, opt.tasks_proxy_max_size, opt.tasks_dns_proxy_max_size)
}
5 changes: 5 additions & 0 deletions Struct/Struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,11 @@ set sleeptime "{{.Variables.sleep}}";
set jitter "{{.Variables.jitter}}";
set useragent "{{.Variables.useragent}}";
# Task and Proxy Max Size
set tasks_max_size "{{.Variables.tasks_max_size}}";
set tasks_proxy_max_size "{{.Variables.tasks_proxy_max_size}}";
set tasks_dns_proxy_max_size "{{.Variables.tasks_dns_proxy_max_size}}";
set data_jitter "{{.Variables.datajitter}}";
set smb_frame_header "";
set pipename "{{.Variables.pipename}}";
Expand Down

0 comments on commit a51aa35

Please sign in to comment.