Managing Scripts
This is the main and core part of using SecLoad. This page goes over how you can use the NodeJS SDK to view and modify scripts. There is some miscellaneous info you can use, such as generating keys and using Node's Native API for SecLoad's API.
This API is Promise Based, meaning you will have to use await or .then(function)
In these examples, you will have to log into the client first, not doing this will throw an error.
Modifying scripts.
Creating a script
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.createScript("scriptname", "content")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.createScript("scriptname", "content")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.createScript("scriptname", "content")
Overwriting a script.
You can update your own scripts with this.
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.overwriteScript("scriptname", "content")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.overwriteScript("scriptname", "content")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.overwriteScript("scriptname", "content")
Removing a script
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.removeScript("scriptname")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.removeScript("scriptname")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.removeScript("scriptname")
Viewing Scripts
Listing Scripts
This function returns a promise (obviously) as an array with strings.
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.listScripts()
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.listScripts()
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.listScripts()
Viewing a script's source
You can get the script source if you want.
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.getScriptSource("scriptname")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.getScriptSource("scriptname")
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.getScriptSource("scriptname")
Miscellaneous
Generating Script Keys
- CommonJS
- ESM
- TypeScript
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.generateKey("scriptname", 5, "doqe_wow") // (scriptname, time [minutes], username)
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.generateKey("scriptname", 5, "doqe_wow") // (scriptname, time [minutes], username)
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.generateKey("scriptname", 5, "doqe_wow") // (scriptname, time [minutes], username)
Using FileSystem/Buffers with SecLoad
SecLoad automatically supports buffers if you use them. This example, we will use the fs
package, a well known official node package used for file modification/reading.
If you are using TypeScript, make sure @types/node
is installed.
- CommonJS
- ESM
- TypeScript
const fs = require('fs')
const {SecloadClient} = require('secload')
const client = new SecloadClient()
client.createScript("scriptname", fs.readFileSync('script.lua'))
import fs from "fs"
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.createScript("scriptname", fs.readFileSync('script.lua'))
import fs from "fs"
import {SecloadClient} from "secload"
const client = new SecloadClient()
client.createScript("scriptname", fs.readFileSync('script.lua'))