-
Notifications
You must be signed in to change notification settings - Fork 0
New General Functions
These functions do not extend from any of the current object/class from greyscript. Instead, these functions are similar to the System Functions or "built-in" functions.
The following are a list of new functions that can be utilized.
Will return a list of the factors of said number.
print(factors(20))
-- [1, 2, 4, 5, 10, 20]Will return a list of the prime factors of the said number.
print(factorsPrime(20))
-- [2, 2, 5]Will return true if said number is prime, false if otherwise (1 or 0).
print(isPrime(7))
-- 1(true)Will return the greatest common factor of the given Values.
print(greatestCommonFactor([10, 20, 55])
-- 5Will convert the number value into percentage form assuming the value is a decimal.
print(decimalpercent(10))
-- 1000Will convert the number value into decimal form assuming the value is a percentage.
print(percentdecimal(10))
-- 0.1Will convert the number value into multiplier form assuming the value is a percentage.
print(percentmultiplier(10))
-- 1.1Will convert the number value into percentage form assuming the value is a multiplier.
print(multiplierpercent(10))
-- 900Will convert the number value into fraction form assuming the value is a decimal.
print(decimalfraction (10))
-- "61/200"Will convert the number value variable assuming base 10 into given base base and will return as list.
print(baseConvert(100, 7))
-- [2, 0, 2]Will convert the number value variable into base 10 from given base and will return as number.
print(baseToDecimal("4d2", 16))
-- 1234Will return the number value variable assuming number is base 10 as a hexidecimal string.
print(hex(100))
-- "64"Will return the number value variable assuming number is base 10 as a binary string.
print(bin(100))
-- "1100100"Will return the number value variable assuming number is base 10 as a octal string.
print(oct(100))
-- "144"Will return true if all values in given list Values are true.
print(all([true, true, false])
-- 0(false)Will return true if at least one values in given list Values are true.
print(any([true, true, false])
-- 1(true)Will return how many folders are in the given folder folder, will return null if folder is not of type file(folder).
folder = get_shell.host_computer.File("/home")
print(foldercount(folder))
-- 3Will return how many files are in the given folder folder, will return null if folder is not of type file(folder).
folder = get_shell.host_computer.File("/etc")
print(filecount(folder))
-- 3Will return a list of open used ports on the given router router.
print(open_ports(get_router))
-- [port, port, port, port]Will return a list of closed used ports on the given router router.
print(closed_ports(get_router))
-- [port, port]Will return the md5 hash of the file contents of the given file file.
print(filehash(get_shell.host_computer.File("/etc/passwd")))
-- returns "e2d0144aa03278f03fb1d50c1c46b7ca"Will return the md5 hash of all child folder and file paths concatenated of the given folder folder.
print(folderhash(get_shell.host_computer.File("/home")))
-- returns "9c746492c2295b799aa637d641b3998a"Will return the natural log of the provided number number.
print(nlog(100))
-- returns 4.62607Will return the log with the base of 10 of the provided number number.
print(log10(100))
-- returns 2Will return Euler's number.
print(e)
-- returns 2.718281828459045Will return a random whole number between the provided min and max values inclusive.
print(rndint(0, 2))
-- returns 1Will return a random decimal number between the provided min and max values inclusive, rounded to the given decimal decimal places.
print(rndint(0, 2, 4))
-- returns 1.3455