-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Bastian Muhlhauser edited this page Jun 9, 2022
·
1 revision
- MongoDB
git clone https://github.com/xpl0ited1/arf
cd arf
go build main.go
xpl0ited1@n0tj41l $ ./main -h
Usage of main:
-b string
Set the listening ip address (default "0.0.0.0")
-p int
Set the listening port (default 3100)
After building the binary you could execute the server with the following command:
xpl0ited1@n0tj41l $ ./main -p 8080
2022/06/08 21:23:26 JWT Secret: HNqmki5rnk5a2ovfm51IpL8g5cNQQzgT4tzRoyWy5tk3GK32Y23vWhMIlKpSdVkl8lnJSLNqOVwzgeSmnMoDOltZWS0DIXOeQ7BWB0a31iMmzHpbyYGCjVVrb6D4gSrD
Active Recon Framework API Server v0.1a - Author: Bastian Muhlhauser @xpl0ited11
2022/06/08 21:23:26 [*] Initiating...
2022/06/08 21:23:26 [*] Binding to 0.0.0.0:8080
2022/06/08 21:23:26 [+] Server started
If you want to specify the mondodb credentials, host, etc. First you must specify this on the GetConfig
function of service/config/config.go
file:
func GetConfig() *Config {
return &Config{
DB: &DBConfig{
Dialect: "mongodb",
Host: "127.0.0.1",
Port: 27017,
Username: "customuser",
Password: "custompasswd",
Name: "customdb",
Charset: "utf8",
},
}
}
Then change the default dbURI
from the service/service.go
file at the Initialize
function and then build again the binary:
Default:
func (a *App) Initialize(config *config.Config) {
dbURI := fmt.Sprintf("%s://%s:%d",
config.DB.Dialect,
config.DB.Host,
config.DB.Port)
err := mgm.SetDefaultConfig(nil, config.DB.Name, options.Client().ApplyURI(dbURI))
if err != nil {
log.Fatalln(err)
}
a.Router = mux.NewRouter()
a.Router.Use(loggingMiddleWare)
a.setRouters()
}
With custom config:
func (a *App) Initialize(config *config.Config) {
dbURI := fmt.Sprintf("%s://%s:%s@%s:%d",
config.DB.Dialect,
config.DB.Username,
config.DB.Password,
config.DB.Host,
config.DB.Port)
err := mgm.SetDefaultConfig(nil, config.DB.Name, options.Client().ApplyURI(dbURI))
if err != nil {
log.Fatalln(err)
}
a.Router = mux.NewRouter()
a.Router.Use(loggingMiddleWare)
a.setRouters()
}