Merge pull request #1218 from kkrypt0nn/master
Some checks failed
Build and Push Docker Images / docker (push) Has been cancelled
Linux tests / build (1.24.x, ubuntu-latest) (push) Has been cancelled
macOS tests / build (1.24.x, macos-latest) (push) Has been cancelled
Windows tests / build (1.24.x, windows-latest) (push) Has been cancelled

feat: Add default username and password for API
This commit is contained in:
Simone Margaritelli 2025-08-09 13:48:07 +02:00 committed by GitHub
commit 453c417e92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -90,12 +90,12 @@ func NewRestAPI(s *session.Session) *RestAPI {
"Value of the Access-Control-Allow-Origin header of the API server.")) "Value of the Access-Control-Allow-Origin header of the API server."))
mod.AddParam(session.NewStringParameter("api.rest.username", mod.AddParam(session.NewStringParameter("api.rest.username",
"", "user",
"", "",
"API authentication username.")) "API authentication username."))
mod.AddParam(session.NewStringParameter("api.rest.password", mod.AddParam(session.NewStringParameter("api.rest.password",
"", "pass",
"", "",
"API authentication password.")) "API authentication password."))

View file

@ -31,20 +31,20 @@ func NewHttpServer(s *session.Session) *HttpServer {
mod.AddParam(session.NewStringParameter("http.server.address", mod.AddParam(session.NewStringParameter("http.server.address",
session.ParamIfaceAddress, session.ParamIfaceAddress,
session.IPv4Validator, session.IPv4Validator,
"Address to bind the http server to.")) "Address to bind the HTTP server to."))
mod.AddParam(session.NewIntParameter("http.server.port", mod.AddParam(session.NewIntParameter("http.server.port",
"80", "80",
"Port to bind the http server to.")) "Port to bind the HTTP server to."))
mod.AddHandler(session.NewModuleHandler("http.server on", "", mod.AddHandler(session.NewModuleHandler("http.server on", "",
"Start httpd server.", "Start HTTP server.",
func(args []string) error { func(args []string) error {
return mod.Start() return mod.Start()
})) }))
mod.AddHandler(session.NewModuleHandler("http.server off", "", mod.AddHandler(session.NewModuleHandler("http.server off", "",
"Stop httpd server.", "Stop HTTP server.",
func(args []string) error { func(args []string) error {
return mod.Stop() return mod.Stop()
})) }))

View file

@ -35,11 +35,11 @@ func NewHttpsServer(s *session.Session) *HttpsServer {
mod.AddParam(session.NewStringParameter("https.server.address", mod.AddParam(session.NewStringParameter("https.server.address",
session.ParamIfaceAddress, session.ParamIfaceAddress,
session.IPv4Validator, session.IPv4Validator,
"Address to bind the http server to.")) "Address to bind the HTTPS server to."))
mod.AddParam(session.NewIntParameter("https.server.port", mod.AddParam(session.NewIntParameter("https.server.port",
"443", "443",
"Port to bind the http server to.")) "Port to bind the HTTPS server to."))
mod.AddParam(session.NewStringParameter("https.server.certificate", mod.AddParam(session.NewStringParameter("https.server.certificate",
"~/.bettercap-httpd.cert.pem", "~/.bettercap-httpd.cert.pem",
@ -54,13 +54,13 @@ func NewHttpsServer(s *session.Session) *HttpsServer {
tls.CertConfigToModule("https.server", &mod.SessionModule, tls.DefaultLegitConfig) tls.CertConfigToModule("https.server", &mod.SessionModule, tls.DefaultLegitConfig)
mod.AddHandler(session.NewModuleHandler("https.server on", "", mod.AddHandler(session.NewModuleHandler("https.server on", "",
"Start https server.", "Start HTTPS server.",
func(args []string) error { func(args []string) error {
return mod.Start() return mod.Start()
})) }))
mod.AddHandler(session.NewModuleHandler("https.server off", "", mod.AddHandler(session.NewModuleHandler("https.server off", "",
"Stop https server.", "Stop HTTPS server.",
func(args []string) error { func(args []string) error {
return mod.Stop() return mod.Stop()
})) }))