MCPcopy Create free account
hub / github.com/Tylous/SourcePoint / GenerateProfile

Function GenerateProfile

Loader/Loader.go:492–562  ·  view source on GitHub ↗
(Profile, CDN, CDN_Value, cert_password, custom_cert, ProfilePath, hostname string)

Source from the content-addressed store, hash-verified

490}
491
492func GenerateProfile(Profile, CDN, CDN_Value, cert_password, custom_cert, ProfilePath, hostname string) (map[string]string, map[string]string) {
493 Beacon_GETPOST_Profile := &Beacon_GETPOST_Profile{}
494 Beacon_SSL := &Beacon_SSL{}
495 Beacon_GETPOST_Profile.Variables = make(map[string]string)
496 Beacon_SSL.Variables = make(map[string]string)
497 if Profile == "" {
498 CNAME := "\nhttps-certificate {\rset CN \"" + hostname + "\"; #Common Name"
499 Beacon_SSL.Variables["Cert"] = CNAME + Struct.Cert[num_Profile-1]
500 Beacon_GETPOST_Profile.Variables["Profile"] = Struct.HTTP_GET_POST_list[num_Profile-1]
501 }
502 if Profile != "" {
503 num_Profile, _ = strconv.Atoi(Profile)
504 if num_Profile <= 4 {
505 CNAME := "\nhttps-certificate {\rset CN \"" + hostname + "\"; #Common Name"
506 Beacon_SSL.Variables["Cert"] = CNAME + Struct.Cert[num_Profile-1]
507 Beacon_GETPOST_Profile.Variables["Profile"] = Struct.HTTP_GET_POST_list[(num_Profile - 1)]
508 fmt.Println("[!] Self Signed SSL Cerificate Used")
509 } else if num_Profile == 6 {
510 if CDN == "" {
511 log.Fatal("Error: Please provide a CDN value in order to use AzureEdge profiles")
512 }
513 if cert_password == "" {
514 log.Fatal("Error: Please provide a Password value to use this profile")
515 }
516 if custom_cert == "" {
517 log.Fatal("Error: Please provide a Keystore value to use this profile")
518 }
519 Beacon_SSL.Variables["Cert"] = Struct.Cert[4]
520 Beacon_GETPOST_Profile.Variables["Profile"] = Struct.HTTP_GET_POST_list[num_Profile-1]
521 } else if num_Profile == 5 || num_Profile == 7 {
522 if cert_password == "" {
523 log.Fatal("Error: Please provide a Password value to use this profile")
524 }
525 if custom_cert == "" {
526 log.Fatal("Error: Please provide a Keystore value to use this profile")
527 }
528 Beacon_SSL.Variables["Cert"] = Struct.Cert[4]
529 Beacon_GETPOST_Profile.Variables["Profile"] = Struct.HTTP_GET_POST_list[(num_Profile - 1)]
530 } else if num_Profile == 8 {
531 if cert_password == "" && custom_cert == "" {
532 CNAME := "\rhttps-certificate {\rset CN \"" + hostname + "\"; #Common Name"
533 Beacon_SSL.Variables["Cert"] = CNAME + Struct.Cert[0]
534 fmt.Println("[!] Self Signed SSL Cerificate Used")
535 }
536 if cert_password == "" && custom_cert != "" {
537 log.Fatal("Error: Please provide a Password value to use this profile")
538 }
539 if custom_cert == "" && cert_password != "" {
540 log.Fatal("Error: Please provide a Keystore value to use this profile")
541 }
542 if cert_password != "" && custom_cert != "" {
543 Beacon_SSL.Variables["Cert"] = Struct.Cert[4]
544 }
545 Beacon_GETPOST_Profile.Variables["Profile"] = Utils.Readfile(ProfilePath)
546 } else {
547 log.Fatal("Error: Please provide a Profile number of 8 or less")
548 }
549 }

Callers 1

GenerateOptionsFunction · 0.85

Calls 1

ReadfileFunction · 0.92

Tested by

no test coverage detected