diff --git a/CHANGELOG b/CHANGELOG index 8ecd6f8..34d33d5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +## [22.7.14.1043] - 2022-7-14 +### Added +- Resolve the problem that the custom certificate is overwritten + ## [22.7.12.1111] - 2022-7-12 ### Added - Profile Header authentication ignores case diff --git a/RedGuard.log b/RedGuard.log index 25903a4..ec2639c 100644 --- a/RedGuard.log +++ b/RedGuard.log @@ -539,3 +539,23 @@ [2022-06-01 15:37:41] [RedGuard/core.modifyResponse.func1.1] [RESPONSE] HTTP 404 Not Found, length: 0 [2022-06-01 15:37:41] [RedGuard/core.(*baseHandle).ServeHTTP] [REDIRECT] Source IP: 127.0.0.1 -> Destination Site: https://cloud.tencent.com/ +[2022-07-14 10:41:04] [RedGuard/lib.InitGenerateSelfSignedCert] A default SSL certificate is being generated for the reverse proxy... +[2022-07-14 10:41:04] [main.(*cobaltStrike).serverInit] HostTarget: {"360.net":"http://127.0.0.1:8080","360.com":"https://127.0.0.1:4433"} +[2022-07-14 10:41:04] [RedGuard/core.ProxyManger] Proxy Listen Port :80 (HTTP) +[2022-07-14 10:41:04] [RedGuard/core.ProxyManger] Proxy Listen Port :443 (HTTPS) +[2022-07-14 10:41:12] [main.(*cobaltStrike).serverInit] HostTarget: {"360.net":"http://127.0.0.1:8080","360.com":"https://127.0.0.1:4433"} +[2022-07-14 10:41:12] [RedGuard/core.ProxyManger] Proxy Listen Port :80 (HTTP) +[2022-07-14 10:41:12] [RedGuard/core.ProxyManger] Proxy Listen Port :443 (HTTPS) +[2022-07-14 10:41:51] [RedGuard/lib.InitGenerateSelfSignedCert] A default SSL certificate is being generated for the reverse proxy... +[2022-07-14 10:41:51] [main.(*cobaltStrike).serverInit] HostTarget: {"360.net":"http://127.0.0.1:8080","360.com":"https://127.0.0.1:4433"} +[2022-07-14 10:41:51] [RedGuard/core.ProxyManger] Proxy Listen Port :80 (HTTP) +[2022-07-14 10:41:51] [RedGuard/core.ProxyManger] Proxy Listen Port :443 (HTTPS) +[2022-07-14 10:42:20] [RedGuard/lib.CreateConfig] RedGuard initialization is complete! +[2022-07-14 10:42:21] [RedGuard/lib.CreateConfig] RedGuard config path is: C:\Users\风起/.RedGuard_CobaltStrike.ini +[2022-07-14 10:42:24] [RedGuard/lib.InitGenerateSelfSignedCert] A default SSL certificate is being generated for the reverse proxy... +[2022-07-14 10:42:24] [main.(*cobaltStrike).serverInit] HostTarget: {"360.net":"http://127.0.0.1:8080","360.com":"https://127.0.0.1:4433"} +[2022-07-14 10:42:24] [RedGuard/core.ProxyManger] Proxy Listen Port :80 (HTTP) +[2022-07-14 10:42:24] [RedGuard/core.ProxyManger] Proxy Listen Port :443 (HTTPS) +[2022-07-14 10:43:15] [main.(*cobaltStrike).serverInit] HostTarget: {"360.net":"http://127.0.0.1:8080","360.com":"https://127.0.0.1:4433"} +[2022-07-14 10:43:15] [RedGuard/core.ProxyManger] Proxy Listen Port :80 (HTTP) +[2022-07-14 10:43:15] [RedGuard/core.ProxyManger] Proxy Listen Port :443 (HTTPS) diff --git a/cert-rsa/ca.crt b/cert-rsa/ca.crt index f02e1dd..1c45362 100644 --- a/cert-rsa/ca.crt +++ b/cert-rsa/ca.crt @@ -1,24 +1,24 @@ -----BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIIFwD2T6B86kAwDQYJKoZIhvcNAQELBQAwZjELMAkGA1UE +MIIEFDCCAvygAwIBAgIIFwGR46UNXCwwDQYJKoZIhvcNAQELBQAwZjELMAkGA1UE BhMCQ04xETAPBgNVBAcTCEhhbmdaaG91MS0wKwYDVQQKEyRBbGliYWJhIChDaGlu YSkgVGVjaG5vbG9neSBDby4sIEx0ZC4xFTATBgNVBAMMDCouYWxpeXVuLmNvbTAe -Fw0yMjA3MTIwMzExMjRaFw0yMzA3MTIwMzExMjRaMGYxCzAJBgNVBAYTAkNOMREw +Fw0yMjA3MTQwMjQyMjRaFw0yMzA3MTQwMjQyMjRaMGYxCzAJBgNVBAYTAkNOMRE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ibYBy5VChbqktc4 +9hgOKhm4RO/6XIg6Dey/mBefannq2DgTj2lv9NNXiFppj81ugWhOmQ== -----END CERTIFICATE----- diff --git a/cert-rsa/ca.key b/cert-rsa/ca.key index 414c0ea..9f2f92d 100644 --- a/cert-rsa/ca.key +++ b/cert-rsa/ca.key @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAzkqrthOubgzK56rfsXl2e8Pk6fsNAE2i9ZOn/ontHpiKv1RM -S9Y8446QcixFV6rJMCFw7yEu1lyk3rnVUlGdQkVd/qPGbXbMuaErH00Nydb6re/6 -gOqzIqmQCH7L6reSs/shNWgdqOyKS6LHkVtj618t9Kmyd8RSqUp92JdCf56N3oDU -2tPekdEBpqS9t5BuWENrP2IYGUAS4Psf/bX9CRhVjDvP928bw4rvUblZkKZGIcCb -yUk4W24OMigBZrQWb3ehsnGY4Mic3pE3FPk9A6msCVt7N6//0cbhiOMiHrC4t9DM -2dEqFr3wl8XWCDTz18mF8M6bdrSKCwyXIDgY3wIDAQABAoIBAQCA+w8BeKzHAhib -YKscO+Vo3MJzyRQH7ILHKNsQuwwW5SlbF0nc4MaRQMHvoN56Qb4o6b/Cw+yU+rfa -yjYmkgDRPq3WWG/oYS7/oVVk7LiCSnfR6QmnMRdvxLTZmu3Eg6KmBY5t5fslcz/E -qrI8n/eJYqlJIBEF8Sn9zyWAFpLtVwVpZ9MxU28oHMdAcJXHXW64BGudpyTDWM1s -LJqajk5kU1beMyIpZUkScXyBuISgJAYwHYQhf5ftE8FuCVtgwF5ThJnpBk6GZWad -WGDzUx+Hb0rZRFrNaNP3WXThggwM6hAB4He0eRIqZJD1djhjRI9MbU98bXV3oPEL -tUI4iGGBAoGBANk1Rrt6YmAnjZpbxRHf0vx60RlTgtY6T+r3V2d1zoQiQ7CNOyEC -HGET7OLWoacJF/ZG5dl1Uha0C6KaWPicchrEFAevPyfv2dQH539spXtbG6tONCR4 -ba5VGZreVPLfO/Qzg2mOX4Fj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cSBqK6GpXbplUt4N3u +gNJRAoGBAIo2SQXHObtfphpMVoDZm3A2DubekPuY5aHx0x5U24IDcF/19AJ3SvOh +U7NHpHgGDal5WhLN9dIRBxujP/BL1TAKPpf6P5x4o1Jva0tUWcLvTzAM6NgFMY+0 +p4z+rF2IIkG383nWDpSL3r+0mpUEaPY5iCO8fyUQQtIr6gt+o8PW -----END RSA PRIVATE KEY----- diff --git a/config/version.go b/config/version.go index 8a086a4..6ba5861 100644 --- a/config/version.go +++ b/config/version.go @@ -21,7 +21,7 @@ Github:%s RedGuard is a C2 front flow control tool,Can avoid Blue Teams,AVs,EDRs check. ` - VERSION = "22.7.12 Alpha" + VERSION = "22.7.14 Alpha" TITLE = "RedGuard" LICENSE = "GPL-2.0" URL = "https://github.com/wikiZ/RedGuard" diff --git a/lib/CreateSSL.go b/lib/CreateSSL.go index e0ef8bb..9346b86 100644 --- a/lib/CreateSSL.go +++ b/lib/CreateSSL.go @@ -89,6 +89,12 @@ func GenerateSelfSignedCert(cert *parameter.Cert) { } func InitGenerateSelfSignedCert() { + // Check whether an SSL certificate is generated + if _existsCrt, _ := FileExists("cert-rsa/ca.crt"); _existsCrt { + if _existsKey, _ := FileExists("cert-rsa/ca.key"); _existsKey { + return + } + } // Example Create a CA certificate storage directory if _, err := os.Stat("cert-rsa"); err != nil { _ = os.Mkdir("cert-rsa", 0766) // Directory permissions diff --git a/lib/convert.go b/lib/convert.go index 5d460db..32c4b59 100644 --- a/lib/convert.go +++ b/lib/convert.go @@ -11,6 +11,7 @@ import ( "crypto/md5" "encoding/hex" "encoding/json" + "os" "regexp" ) @@ -45,3 +46,14 @@ func CheckIP(ip string) bool { } return true } + +func FileExists(path string) (bool, error) { + _, err := os.Stat(path) + if err == nil { + return true, nil + } + if os.IsNotExist(err) { + return false, nil + } + return false, err +}