GSSE - GreyScript Script Extender
June 1, 2025 Β· View on GitHub
GreyScript Script Extender (GSSE) is a modular library designed to enhance and expand the existing scripting capabilities of the GreyScript framework. By providing a flexible and extensible architecture, GSSE enables developers to build more powerful and feature-rich scripts within the GreyScript ecosystem.
We welcome community involvementβfeel free to explore the code, suggest improvements, or make contributions
A bundle with all of the scripts in one file is located inside the build folder.
π Documentation
π¦ Module: Crypto
Crypto.b64encode(text)
Encodes a string with base64.
Parameters
text(string): The string to be encoded with base64.
Returns
- (string): The base64 encoded version of the text.
Example
b64encoded = Crypto.b64encode("Hello, World!")
print(b64encoded)
Crypto.b64decode(text)
Decodes a base64 encoded string.
Parameters
text(string): The base64 encoded string to be decoded.
Returns
- (string): The plaintext version of the base64 encoded text.
Example
text = Crypto.b64decode("SGVsbG8sIFdvcmxkIQ==")
print(text)
Crypto.sha256(text)
Hashes a string with sha256.
Parameters
text(string): The string to be hashed.
Returns
- (string): The sha256 version of the string.
Example
hash = Crypto.sha256("S3cure!")
print(hash)
Crypto.aes128(choice, password, text)
Encrypts or decrypts a string with aes128.
Parameters
choice(string): Choose between 'encrypt' or 'decrypt'.encrypt: Encrypts the string.decrypt: Decrypts the string.
password(string): The password used to encrypt the string.text(string): The string to be encrypted or decrypted.
Returns
- (string): The aes128 encrypted or decrypted version of the string.
Example
ciphertext = Crypto.aes128("encrypt", password, text)
decrypted = Crypto.aes128("decrypt", password, ciphertext)
print(decrypted)
π¦ Module: files
getFile(object, path)
Gets a file object from another object.
Parameters
object(object): This object is used to obtain the file object.file: Gets a file object from another file object.computer: Gets a file object from a computer object.ftpShell: Gets a file object from an ftpShell object.shell: Gets a file object from a shell object.
path(string): The path of the file object to obtain.
Returns
- (object|null): The file object from the specified path or null on error.
Example
passwd_object = getFile(result, "/etc/passwd")
print(passwd_object.get_content)
getUser(object)
Returns the user that owns the object.
Parameters
object(object): This object is used to obtain the file object.file: Gets a file object from another file object.computer: Gets a file object from a computer object.ftpShell: Gets a file object from an ftpShell object.shell: Gets a file object from a shell object.
Returns
- (string): The owner of the object.
Example
user = getUser(result)
print("The current user is: "+user)
π¦ Module: Json
Json.dump(json)
Converts the map into a json string
Parameters
json(map): The map to convert into a json string.
Returns
- (string): The json string from the map.
Example
json_string = Json.dump({"key":"value"})
print(json_string)
Json.loads(json)
Converts the json string into a map
Parameters
json(string): The string to convert into a map.
Returns
- (string): The map from the json string.
Example
json_map = Json.loads("{""key"":""value""}")
print(json_map)
π¦ Module: lists
clean(myList)
Removes empty strings from a list.
Parameters
myList(list): The list that needs to be cleaned.
Returns
- (list): The cleaned list.
Example
cleanList = myList.clean
cleanList = clean(myList)
print(cleanList)
hasvalue(myList, item)
Returns 1 if the list has a value else return 0.
Parameters
myList(list|map): The list that contains the item.item(any): The item that is contained in the list.
Returns
- (number): 1 if the item is found else 0.
Example
if myList.hasvalue("cat") then print("The cat has been found")
if hasvalue(myList, "cat") then print("The cat has been found")
π¦ Module: maps
hasvalue(myMap, item)
Returns 1 if the map has a value else return 0.
Parameters
myMap(map|list): The map that contains the item.item(any): The item that is contained in the map.
Returns
- (number): 1 if the item is found else 0.
Example
if myMap.hasvalue("cat") then print("The cat has been found")
if hasvalue(myMap, "cat") then print("The cat has been found")
π¦ Module: networking
check_service(ip, service, libVersion=null)
Searches a network for a library and returns 1 if the service is found else return 0
Parameters
ip(string): The ip of the network.service(string): The service that needs to be found.libVersion(string|null): The version of the library that needs to be found, default null for no specific version.
Returns
- (number): 1 if the service is found else 0.
Example
if check_service("188.211.38.42", "ssh") then print("This network has ssh!")
if check_service("188.211.38.42", "ssh", "1.0.0") then print("This network has ssh with version 1.0.0!")
if check_service("188.211.38.42", "kernel_router", "1.0.0") then print("This network has a kernel_router of version 1.0.0!")
π¦ Module: parser
parse_input(input)
Returns a list of arguments from the input.
Parameters
input(string): The input that needs to be parsed.
Returns
- (list): A list of the parsed arguments.
Example
print(parse_input(input("Terminal: ")))
perm_format(permCode)
Returns a list of permissions from a permission code.
Parameters
permCode(string): The permission code ex: 777.
Returns
- (list): A list of permissions.
Example
for perm in perm_format("777")
file.chmod(perm)
end for
π¦ Module: strings
color(string, colorCode)
Changes the color of a string.
Parameters
string(string): The string that needs to be colored.colorCode(string): The color code.blueyellowblackgreygraywhitegreenredff00ff: Color codes like these are also compatible.
Returns
- (string): The colored string.
Example
print(color("This is red", "red"))
print("This is blue".color("blue"))
mark(string, colorCode)
Marks a string.
Parameters
string(string): The string that needs to be marked.colorCode(string): The color code.blueyellowblackgreygraywhitegreenredff00ffaa: Color codes like these are also compatible.
Returns
- (string): The colored string.
Example
print(mark("This is marked in red", "red"))
print("This is marked in blue".mark("blue"))
bold(string)
Turns a string into a bold string.
Returns
- (string): The string in bold.
Example
print(bold("This string is now bold"))
print("This string is now bold".bold)
underline(string)
Adds an underline to a string.
Returns
- (string): The string with an underline.
Example
print(underline("This string now has an underline"))
print("This string now has an underline".underline)
alpha(string, alphaCode)
Changes the transparancy of a string.
Parameters
string(string): The string that needs to be transparent.alphaCode(string): The transparacy code.aa: This is a valid transparacy code.
Returns
- (string): A transparent string.
Example
print(alpha("This string is now transparant", "aa"))
print("This string is now transparant".mark("aa"))
startswith(string, prefix)
Returns 1 if the string starts with the defined prefix else returns 0.
Parameters
string(string): The string that needs to be checked.prefix(string): The prefix that needs to be checked.
Returns
- (number): 1 if the string starts with the prefix else 0.
Example
if myString.startswith("prefix") then print("The string starts with prefix")
if startswith(myString, "prefix") then print("The string starts with prefix")
endswith(string, suffix)
Returns 1 if the string ends with the defined suffix else returns 0.
Parameters
string(string): The string that needs to be checked.suffix(string): The suffix that needs to be checked.
Returns
- (number): 1 if the string ends with the suffix else 0.
Example
if myString.endswith("prefix") then print("The string ends with prefix")
if endswith(myString, "prefix") then print("The string ends with prefix")
tagstrip(string)
Strips richtext tags from a string.
Parameters
string(string): The string that needs it's richtext tags stripped.
Returns
- (string): The string without richtext tags.
Example
print(myString.tagstrip)
print(tagstrip(myString))
format(string, params)
Formats a string to include the params.
Parameters
string(string): The string that needs to be formatted.params(list): A list with parameters that need to be included into the string.
Returns
- (string|null): The formatted string to include the params. Or null when something went wrong.
Example
myString.format([name])
format("Name: {}", [name])
printf(string, params)
Prints a formatted string that includes the params.
Parameters
string(string): The string that needs to be formatted.params(list): A list with parameters that need to be included into the string.
Returns
- (null): This returns nothing.
Example
printf("Name: {}", [name])
format_table(csv)
Formats a string in a table format.
Parameters
csv(string): Csv that needs to be formatted to a table.
Returns
- (string): The formatted table.
Example
print(format_table("#,username,password\n0,admin,s3cure!\n1,user,welcome123"))
π¦ Module: Error
Error.New(message)
Creates a new Error object.
Parameters
message(string): The error message.
Returns
- (Error): An Error object.
Example
return Error.New("Error: could not...")
if Error.New("Error: could not...") isa Error then print("isa works to verify errors")
Error.Log(self)
Prints the error message associated with the Error object.
Parameters
self(Error): The error that you want to print to the screen.
Example
Error.Log(myError)
myError.Log
π¦ Module: Datetime
Datetime.Now()
Returns the current date and time.
Returns
- (string): The current date and time.
Example
print(Datetime.now)
Datetime.epoch(date)
Returns the epoch timestamp.
Parameters
date(string): The date to be converted into epoch timestamp.
Returns
- (string): The epoch timestamp.
Example
print(Datetime.epoch("1/Jan/2000 - 00:00"))
Datetime.from_epoch(epoch)
Returns the date and time from an epoch timestamp.
Parameters
epoch(string): The epoch timestamp to be converted into a date and time.
Returns
- (string): The data and time from an epoch timestamp.
Example
print(Datetime.from_epoch(64579))