Published Date: 2024/06/02 by: DaVieS
This is an industry-class cross-platform complete Framework written in C/C++ with many built-in functions implemented and designed with absolutely zero depedency needs.
Cross-Platform: FreeBSD, Linux, Windows, MacOS and more.
Supports: Little-Endian & Big-Endian
Scriptable by Squirrel-Lang, built-in many functions inspired by PHP but with a lot of speed improvements, natively supports thread, thread-pool, thread management, async operations, TCP client and server.
This framework named after my daughter because I realised I wont have as much time as I had it before =).
This framework allows to manage all of my existing applications are once, due flexibility and stability.
Very low memory footprint, and CPU usage.
One package, multi purpose. Backend + API and Frontend
root@esec:/MVCP/buildsystem/mvcpSources/sources/dev/backend# ./backend [N] 2020-09-17 13:11:48 | bootCode | Nexus-8 Framework Initialising [N] 2020-09-17 13:11:48 | bootCode | Machine Arch: FreeBSD64 [N] 2020-09-17 13:11:48 | bootCode | Build Date: 2020/08-04 [N] 2020-09-17 13:11:48 | bootCode | Build Number: stable-52-gf23a09a3 [N] 2020-09-17 13:11:48 | bootCode | Machine Arch: FreeBSD64 [N] 2020-09-17 13:11:48 | bootCode | Machine Type: LittleEndian [N] 2020-09-17 13:11:48 | SW | Nexus8/Kinga Framework [N] 2020-09-17 13:11:48 | SW | Author: nPulse.net / Viktor Hlavaji aka DaVieS [N] 2020-09-17 13:11:48 | SW | Working Directory: ./ [N] 2020-09-17 13:11:48 | LVM::MAIN | Initialising .. [N] 2020-09-17 13:11:48 | INTR | Performance Set: (90%) [10,30] [N] 2020-09-17 13:11:48 | Logger | Logger Output: System.log [N] 2020-09-17 13:11:48 | application/mvcp-backend/main.c | Initialising MVCP Backend Application [!] True Random generator running [5E8258311D66DE3E1F64985C58D9A939] [N] 2020-09-17 13:11:50 | application/mvcp-backend/main.c | SSL Certificate Store Loaded [N] 2020-09-17 13:11:50 | application/mvcp-backend/main.c | Starting Software ... [N] 2020-09-17 13:11:52 | LVM::NewThread | application/mvcp-backend/main.c:104 -> application/mvcp-backend/api/api.c [N] 2020-09-17 13:11:52 | API/Server | (1) Started Server at address: 0.0.0.0:6827 [N] 2020-09-17 13:11:52 | API/Server | (1) Started Server at address: [::]:6827 [N] 2020-09-17 13:11:53 | LVM::NewThread | application/mvcp-backend/main.c:111 -> application/mvcp-backend/worker/lazy_worker.c [N] 2020-09-17 13:11:53 | LVM::NewThread | application/mvcp-backend/main.c:114 -> application/mvcp-backend/worker/realtime_worker.c [N] 2020-09-17 13:11:53 | LVM::NewThread | application/mvcp-backend/main.c:117 -> application/mvcp-backend/worker/mvcp_worker.c [N] 2020-09-17 13:19:47 | API/Connection | New Connection [8] from 127.0.2.1:6985 [N] 2020-09-17 13:20:48 | API/Connection | Peer[8]: 127.0.2.1:6985 Timeout [N] 2020-09-17 13:20:48 | API/Connection | Shutdown Peer[8]: 127.0.2.1:6985 due Connection Closed [N] 2020-09-17 14:20:14 | API/Connection | New Connection [8] from 127.0.2.1:25272 [N] 2020-09-17 14:20:14 | API/Connection | New Connection [10] from 127.0.2.1:25278 [N] 2020-09-17 14:21:15 | API/Connection | Peer[8]: 127.0.2.1:25272 Timeout [N] 2020-09-17 14:21:15 | API/Connection | Shutdown Peer[8]: 127.0.2.1:25272 due Connection Closed [N] 2020-09-17 14:21:15 | API/Connection | Peer[10]: 127.0.2.1:25278 Timeout [N] 2020-09-17 14:21:15 | API/Connection | Shutdown Peer[10]: 127.0.2.1:25278 due Connection Closed
Currently active/done self-projects by using this framework:
[CLIBS]
{
[DEPRECATED]
{
void intr_wait_signal(); //Wait until socket operation happening
void intr_performance(int level); //Level: 1-99, less is faster Socket operations but takes more CPU, this is global setting
int intr_send_buffer_size(int size); // Get/Set Send Buffer Size in Bytes, if input less than 0 only return the current value
int intr_recv_buffer_size(int size); // Get/Set Recv Buffer Size in Bytes, if input less than 0 only return the current value
int intr_send_buffer_size_max(); // Get maximum allowed send buffer size
int intr_recv_buffer_size_max(); // Get maximum allowed recv buffer size
}
[SYSTEM]
{
table vminfo(string filter); //Returns Current Process and System Informations
Class PROC_OPEN()
{
bool open(string cmd, array args); // Open Process
bool start(); //Start Process
void stop(); //Stop Process
void kill(); //Kill Process
void intr(); //Interrupt process
void term(); //Terminate Process
bool reinit(); //Reinit Process
bool send(string cmd); //Write stdin to attached process
bool poll(int timeout_ms); //Return true immediately when there is activity
bool poll2(int wait_ms); //Return true when there was in activity, wait until wait_ms or one of the buffer become full
void set_buffer_size(int); //Set Buffer Size in Bytes
int get_buffer_size(); //Get Buffer Size
void set_timeout(int timeout_sec); //Set Execution Timeout in Seconds
int get_timeout(); //Get timeout
bool is_running(); //Returns true when the process is running
bool is_error(); //Returns true when error
bool is_stderr(); //Returns true when stderr available to read
bool is_stdout(); //Returns true when stdout available to read
int get_retval(); //Get process return value when end
string get_stdout(); //Get and clear stdout buffer
string get_stderr(); //Get and clear stderr buffer
string get_error(); //Get the error string
string get_status(); //Get current status
}
Class FOPEN()
{
bool open(string file); //Open File for Read & Write
bool open_readonly(string file); //Open File for Read Only
bool open_truncate(string file); //Open File for RW and Truncate to 0
bool is_open(); //True if is open
bool flush(); //Flush File
bool close(); //Close File
int size(); //Get File Size
bool seekg(int pos); //Seek Get Pointer
bool seekp(int pos); //Seek Put Pointer
int tellg(); //Returns Get Pointer
int tellp(); //Returns Put Pointer
string read(int size); //Read Data
bool write(string data); //Write Data into File
}
}
[IMAGE]
{
Class iMagick
{
bool load(string data); //Load image from string
string save(); //Save RGBA image to string
string save_jpeg(int compression); //Save JPEG image to string
string save_png(int compression); //Save PNG image to string
string save_bmp(); //Save BMP image to string
string get_last_error(); //Returns latest error
bool resize(string geometry = "800x600"); //Resize Image
bool scale(string geometry = "800x600"); //Resize Image
bool adaptiveResize(string geometry = "800x600"); //Fastest Resize Image
bool canvas8(int width, int height, COLOR); //Create new canvas, Color could be array [R,G,B,A] or string like HTML colors
bool canvas16(int width, int height, COLOR); //16bit mode
array get8(int x, int y); //Return 8-bit Color Array [R,G,B,A]
array get16(int x, int y); //Return 16-bit Color Array [R,G,B,A]
array get8Area(int x, int y, int x2, int y2); //Return 8-bit Color Multi Dimension Array [R,G,B,A]
array get16Area(int x, int y, int x2, int y2); //Return 16-bit Color Multi Dimension Array [R,G,B,A]
int width(); //Return width of image
int height(); //Return height of image
bool put8(int x, int y, COLOR); //Insert 8bit color-pixel into image;
bool put16(int x, int y, COLOR); //Insert 16bit color-pixel into image;
bool put8Area(int x, int y, [[COLOR]]); //Insert 8bit multi dimension color-pixel into image;
bool put16Area(int x, int y, [[COLOR]]); //Insert 16bit multi dimension color-pixel into image;
bool rotate(int deg); //Rotate Image
bool chop(int x, int y); //Chop Image
bool crop(int x, int y); //Crop Image
bool addLayer(int x, int y, IMAGE); //Merge two image
bool normalize(); //Normalize Image
bool enhance(); //Enhance Image
bool greyScale(); //greyScale Image
bool autoGamma(); //autoGamma Image
bool autoLevel(); //autoLevel Image
bool autoOrient(); //autoOrient Image
bool imageControl(brightness, contrast); //Set Brightness & Contrast
bool canny(float radius, float sigma, float lower, float upper); //CannyEdge Detection
bool kuwahara(float radius, float sigma); //Kuwahara Effect
bool houghLine(int width, int height, int threshold); //Draw Hough Lines
bool blur(float radius, float sigma); //Gaussian Blur
bool motionBlur(float radius, float sigma, int angle); //Motion Blur
bool adaptiveBlur(float radius, float sigma); //Adaptive Gaussian Blur
bool adaptiveSharpen(float radius, float sigma);
}
}
[Basic]
{
string BUILD_DATE(); //Returns C++ Framework Build Date
string BUILD_NUMBER(); //Returns C++ Framework Build Number
string LICENSE(); //Return Binary License
string COPYRIGHT(); //Return Binary Copyright Note
bool is_bigendian(); //Return true if the machine type is bigendian
string working_path(); //Return application directory
string get_working_dir(); //Get Actual working directory
string os_type(); //Return {Windows64,Windows32,Linux32,Linux64,FreeBSD64,FreeBSD32,Apple64,Apple32,Unknown} depending on machine also +GTK appended if supports it
string concat(array in); //Concatenate array into string
string colorize(string in, string color); //RED, YELLOW, CYAN, PINK, BOLD, GREEN, RED_BG, YELLOW_BG, WHITE_BG, PINK_BG
string hexdump(string in, int hex_col); //Return hexdump
string hexdump_color(string in, int hex_col); //Return hexdump
void ssl_setup_ca(string pem); //Initiates CA-Chains of openssl, sahred with sockets and CURL
void sleep(int sleep_for_ms); //Sleep for given milliseconds
bool should_stop(); //Returns false if program execution immediately should abort (SIGINT)
void stop(); // STOP THE PROGRAM AND EXIT
void crash(); // CRASH THREAD
double round(double in, int level) //Return formatted double
string urlencode(string in);
string urldecode(string in);
LVM require(string filename); //Load a program-file into a variable
LVM require_gc(string filename); //RUN GC collector then load a program-file into variable
}
[S7SNAP]
{
Class S7Server
{
bool registerDB(int DBnum, int DBSize);
string getDB(int DBnum);
string setDB(int DBnum, string data);
bool clearDB(int DBnum);
string getDBOffset(int DBnum, int start, int end);
bool setDBOffset(int DBnum, int start, string data);
bool start(string bind_address = "0.0.0.0");
}
Class S7Client
{
bool connect(string ip, int rack, int slot);
bool close();
string readDB(int DBnum, int start, int len);
bool writeDB(int DBnum, int start, string data);
Table getInfo(any);
}
}
[CLI]
{
void disable_cerr(bool); //Toggle Cerr Output
void disable_cout(bool); //Toggle Cout Output
void disable_logger(bool); //Toggle Logger Output
array get_args(any); //Return array of program call arguments, argv[]
void cerr(string); //Print string to STDERR
void cout(string); //Print string to STDOUT
void stdin(string); //Read string from STDIN
}
[POSIX]
{
bool setuid(string username); //Posix setuid
void guardian_restart(); // Guardian: Restart
void set_exitcode(int rv); // Set Exit Code
int guardian_total_fails(); // Get Crash Numbers
int guardian_total_restarts(); // Get Restart Count
int guardian_start_time(); // Get start timetamp
}
[Signals]
{
void notify_signal();
void notify_signal2();
void wait_signal();
void wait_signal2();
}
[Math_C_API]
{
string lrc(string input); //Decimal output, Binary input
int crc32(string input); //Decimal output, Binary input
int crc16(string input); //Decimal output, Binary input
string lrc_hex(string input); //HEX output, Binary input
string crc32_hex(string input); //HEX output, Binary input
string crc16_hex(string input); //HEX output, Binary input
int modbus_crc16_dec(string input); //Decimal output, Binary input
string modbus_crc16_hex(string input); //HEX output, Binary input
string int8_byte(int);
string int16_byte(int);
string int32_byte(int);
string int64_byte(int);
string float_byte(float);
string double_byte(float);
string byte_int8(string);
string byte_int16(string);
string byte_int32(string);
string byte_int64(string);
string byte_uint8(string);
string byte_uint16(string);
string byte_uint32(string);
string byte_uint64(string);
string byte_float(string);
string byte_double(string);
}
[String]
{
string __serialize(string input);
array(func_code, olen, rval) __unserialize(string input);
bool check_string(string input_string, string allowed_chars); //Check if string contains only allowed characters
string str_pad(string string_in, int length, string pad_string, string pad_type[STR_PAD_LEFT,STR_PAD_RIGHT,STR_PAD_BOTH]); //Padding String
string replace(string subject, string search, string replace); //Replace substring in string
string trim(string subject); //Trim whitespace from begining and end of input string
string bin2hex(); //Binary to Hexadecimal conversion
string hex2bin(); //Hexadecimal to Binary conversion
array explode(string exploder,string original,int occurances,bool cut);
string implode(string imploder,array original);
string concat(array original);
}
[Database]
{
Class MYSQL
{
bool connect(string host, string port, string user, string passwd, string db, string reconnect_sec); // Connect to DB, if host is path then unix socket used
string escape(string data); // Escape String
int push(string data); // Run query and return affected rows
Array query(string data); // Run query and return a multi-level array as results
bool store_query(string prefix, string query); // Run query and stores it in global buffer, return true if success
bool pop_query(string prefix); // Pop-out previously stored query (auto-cleanup)
bool close(); // Close connection
string error(); // Get Error
}
Class SQLITE
{
bool open(string file); // Open new file or existing, true if success
string escape(string data); // Escape String
int push(string data); // Run query and return affected rows
Array query(string data); // Run query and return a multi-level array as results
bool close(); // Close connection
string error(); // Get Error
}
}
[GeoIP]
{
bool geoip_country_load(mmdb_file); // Open Maxmind's v2 binary file
bool geoip_city_load(mmdb_file); // Open Maxmind's v2 binary file
bool geoip_asn_load(mmdb_file); // Open Maxmind's v2 binary file
Table geoip_country(string ip); // Query Country
Table geoip_asn(string ip); // Query ASN
}
[Virtual Machine]
{
bool make_thread(string vfs_file, string argument, string caller, string receiver); //Create new thread and invoke vfs_file and passing argument to it | caller and receiver for usage stat
bool create_new_thread(string vfs_file, string argument); //Alias for make_thread
string get_error(); //Get Error
[DEPRECATED] bool exec_vfs_thread_string(string vfs_file, string argument); //Alias for make_thread
Class GLOBAL() //Shared, Threadsafe Container
{
string Get(string prefix, string key); //Get data
void Put(string prefix, string key, string value); //Put data
void Remove(string prefix, string key); //Remove data
void RemovePrefix(string prefix); //Remove prefix with its all datas
Table List(string prefix); //List all data from given prefix
}
Class NCONFIG(string logname, string filename) //Shared, Threadsafe Container
{
string get(string prefix, string key); //Get data
void del(string prefix, string key); //Get data
void set(string prefix, string key, string value); //Put data
void clear(); //Remove all data
bool save(); //Save File
bool load(); //Load File
Table export_config(any); //List all data
}
Class RGLOBAL(string prefix) //Shared, Threadsafe Container, with Garbage Collector, when destroys remove the whole prefix
{
string Get(string prefix, string key); //Get data
void Put(string prefix, string key, string value); //Put data
void Remove(string prefix, string key); //Remove data
}
Class LOGGER(string log_name) //Initiates logging function
{
void e(string msg, string file, int line); //Log errors, __FILE__, __LINE__ must be given
void w(string msg, string file, int line); //Log warnings, __FILE__, __LINE__ must be given
void n(string msg, string file, int line); //Log notices, __FILE__, __LINE__ must be given
void d(string msg, string file, int line); //Log debug, __FILE__, __LINE__ must be given
void E(string msg); //Log errors
void W(string msg); //Log warnings
void N(string msg); //Log notices
void D(string msg); //Log debug
string copy(); // Copy Log Buffer into String
void rename(string new_name); //Rename Prefix
bool file_output(string file); //Logger File Output (GLOBAL)
}
Class LVM() //Low Level Virtual Machine
{
string get_file(string vfs_file_path); //Get file from Embedded Filesystem
}
Class VFS() //Virtual Pseudo Filesystem
{
bool emulate(string path); //Emulate VFS
bool open(string file, int compression_level = 0, string encrypt_key = ""); //Open VFS File
bool addFile(string real_file, string relative_path); //Add File into VFS
bool addPath(string real_path, string relative_path); //Add Directory into VFS
int mtime(string vfs_file); //Get Last Modified tstamp
int size(string vfs_file); //Get File size
bool is_file(string vfs_file); //Return true if file exists
bool extractFS(string out_path, string relative_path); //Extract VFS
string readFile(string path_to_file); //Read VFS File
bool writeFile(string path_to_file, string data); //Write file
bool rmFile(string path); // Delete File
bool close(); //Close VFS
bool wipe(); //Wipe VFS
bool flush(); //Flush VFS
}
}
[Windows Native]
{
void HideConsole(); //Hide Console Window
void ShowConsole(); //Show Console Window
bool IsConsoleVisible(); //Return true if Console Window Shown
bool killProcess(int pid);
Table listProcess(any);
bool suspendProcess(int pid);
bool resumeProcess(int pid);
Table getIPv4Table(any);
Table getIPv6Table(any);
Table WMI_QUERY(string WQL, array fields);
}
[FreeBSD Native]
{
}
[Native Filesystem]
{
bool create_dir(string path); //Create Directory
bool recursive_create_dir(string path); //Recursive Create Directory
bool renameFile(string old_file, string new_file); //Rename / Move file
Table scandir(string path, bool recursive); //Scan Directory
Table scandir_simple(string path, bool recursive); //Scan Directory
bool is_file(string path_to_file); //Returns true if path is a file or the symlink is points to the file
bool is_dir(string path); //Returns true if path is a directory or the symlink is points to the dir
bool is_link(string path); //Return true if file is a link
string read_link(string path); //Return link location
string readFile(string path_to_file); //Read all contents from file
string readFile_ex(string path_to_file, size_t start_pos, size_t end_pos); //Read selected size from file
bool writeFile(string path_to_file, string data); //Write data into file
bool writeFile_ex(string path_to_file, size_t pos, string data); //Append data to pos in file
bool rmfile(string path_to_file); //Delete file
bool recursive_remove_dir(string path, bool keep_root); //Recursive Delete Directory
int get_file_mtime(string path_to_file); //Get file mtime !32/64bit dependent
int get_file_size(string path_to_file); //Get file size !32/64bit dependent
bool schown(string path_to_file, string user, string group); //chown on windows does nothing
bool schmod(string path_to_file, string mode); //chmod on windows does nothing
string exec(string cmd); //Executes a command and return its output (POPEN)
string exec2(string cmd); //Executes a command and return its exit status (SYSTEM)
string basepath(string file); //Return a directory of file
}
[Date]
{
string htime(); //Returns a precision time
int helapsed_ms(string htime); //Returns time elapsed since htime() in milliseconds
string helapsed(string htime); //Returns time elapsed since htime() in string formatted seconds
int stime(int ajust); //Returns current timestamp
int localize_time(int time); //Returns a local timestamp
string date(int timestamp, string format); //Returns date, see c++ date()
string date_utc(int timestamp, string format); //Returns date (UTC), see c++ date()
string date_rfc1123(int timestamp); //Returns date in rfc1123 standards
int strtotime(string date); //Date String to Timestamp
}
[Crypto]
{
string md5(string input, bool raw); //Generate sha256 hash !UpperCase when not raw
string sha256(string input, bool raw); //Generate sha256 hash !UpperCase when not raw
string sha512(string input, bool raw); //Generate sha512 hash !UpperCase when not raw
string hmac_md5(string key, string input, bool raw); //Generate md5 hmac hash !UpperCase when not raw
string hmac_sha256(string key, string input, bool raw); //Generate sha256 hmac hash !UpperCase when not raw
string hmac_sha512(string key, string input, bool raw); //Generate sha512 hmac hash !UpperCase when not raw
string Random(int size); //Generate some random
int mt_rand(int min, int max); //Generate a random number between
string base64_encode(string input); //Returns Base64 Encoded string
string base64_decode(string input); //Returns Base64 Decoded string
string sq_AES_PROTO_ENCRYPT(string input, string key, int gzip); //Returns Encrypted Data
Array sq_AES_PROTO_DECRYPT(string input, string key, string temp_buffer); //Returns array, 0 = Decrypted Data, 1 = Error, 2 = Temp Buffer
Class AES128(key,iv) //KEY && IV must be 128bit, 16byte long
{
string Encrypt(string input); //Encrypt input string
string Decrypt(string input); //Decrypt input string
void enablePadding(bool pad); //Enable / Disable Padding (Default: Enabled, PKCS7)
}
}
[ZLIB]
{
string deflate2(string input, int window_bits int level[0-9]); //Compress string with deflate
string inflate2(string input, int window_bits); //Decompress string with inflate
string deflate(string input, int level[0-9]); //Compress string with deflate
string inflate(string input); //Decompress string with inflate
string gzencode(string input, int level[0-9]); //Compress string with gzencode
string gzdecode(string input); //Decompress string with gzdecode
}
[Networking]
{
string idn_encode(string host); //Convert UTF-8 to xn--- punycode
string idn_decode(string host); //Convert from xn--- punycode to UTF-8
string host2ip(string input); //Resolv hostname to IP
string host2ptr(string input); //Resolv hostname/IP to PTR
Array resolv(string host, string port); //Query all available IPv4 and IPv6 for give host
Class CURL() //Full Curl implementation
{
bool setopt(string param, string opt); //See CURL setopt
Table getinfo(&any_value); //Returns a table with all informations about the session
string geterror(); //Returns an error or no_error if no error
string getdata(); //Return data received by CURL
bool perform(); //Do Curl Task
}
Class SERIAL(string log_name) //Serial I/O Communication Class
{
bool is_open(); //Return true if serial is openned
bool open(string fd); //Open Serial port
bool settings(string baud, string bits[5,6,7,8], string parity[no,even,odd], string stopbits[1,1.5,2]);
int write(string data, int timeout_ms); //Write data into serial port, returns sent bytes
string read(int max_len, int timeout_ms); //Read data from serial port, returns received data
bool close(); //Close serial port
}
Class DNS()
{
Table query(string host, string type);
Table get_mx(string host);
Table get_a(string host);
Table get_aaaa(string host);
Table get_txt(string host);
Table get_ns(string host);
Table get_soa(string host);
void set_nameserver(string ip);
}
Class UDPSOCKET()
{
string connection(); //Return socket
string get_unique_number(); //Generate Mutexed Unique Number
void wait_signal(); //Wait until some global socket operation done
bool server(string host, string port); //Bind and listens on IP and Port (IPv4 or IPv6 specified by IP);
bool blacklist(string ip, int bl_time); // Blacklist an IP address
Array select(int _poll_time, int max_data_size, int min_wait); // SELECT, MIN_WAIT for a little delay to access more data
int send_buffer_size(int size); // Get/Set Send Buffer Size in Bytes, if input less than 0 only return the current value
int recv_buffer_size(int size); // Get/Set Recv Buffer Size in Bytes, if input less than 0 only return the current value
int send_buffer_size_max(); // Get maximum allowed send buffer size
int recv_buffer_size_max(); // Get maximum allowed recv buffer size
int send(string host, string port, string data, size_t max_wait); //returns the sent bytes, max_wait for sending loop
}
Class TCPSOCKET()
{
string connection(); //Return socket
string get_unique_number(); //Generate Mutexed Unique Number
int recv_limit(int limit); //Set current socket receive buffer limit
/** GLOBAL **/
int send_buffer_size(int size); // Get/Set Send Buffer Size in Bytes, if input less than 0 only return the current value
int recv_buffer_size(int size); // Get/Set Recv Buffer Size in Bytes, if input less than 0 only return the current value
int send_buffer_size_max(); // Get maximum allowed send buffer size
int recv_buffer_size_max(); // Get maximum allowed recv buffer size
void wait_signal(); //Wait until some global socket operation done
bool poll(int min_timeout_ms); // Wait until something happening on this socket, if min_timeout_ms set then returns false when timeout occurs, true if socket has change
bool pipe(string sock1, string sock2); //Make pipe between provided two sockets
bool aes(string sock, bool enable, string key, uint8 gzip_level);
bool websocket_pipe(string websock, string sock2, string type); //Make pipe and websocket capatibility between two sockets
bool websocket(string websock, string type); //Make pipe and websocket capatibility between two sockets
Table peer_table(any); //Return Peer Table
/** GLOBAL **/
/** CLIENT **/
string get_errors(); //Get errors separated by (;)
string get_lasterror(); //Get last error
void set_timeout(int timeout_ms); //Set global timeout for blocking sockets, in milliseconds
void lingerie(bool state); //When true, close() will abort connection and do not TIME_WAIT
void set_blocking(bool state); // If true socket is blocking, otherwise non-blocking by default
bool connect(string host, string port); //Initiate TCP Connect
bool ssl_connect(bool verify_peer); //Initiate TLS Session
table status(&any) //Get status
bool is_connecting(); //True if connecting in progress
bool is_sslconnecting(); //True if SSL Connecting in progress
bool is_connected(); //True if connected
bool is_error(); //True if error present
bool is_sslerror(); //True if SSL error present
bool is_sslconnected(); //True if connected throught SSL
bool is_readable(); //True if any data available to read
bool is_writeable(); //True if any data available to write
bool is_peer_cert_valid(); //True if peer certificate is valid
bool read_clear(); //Clear Received data, usefull on peek success
string read(); //Read Received data, empty returned if no data
string peek(); //Read Received data, but not empty internal buffer
bool find(string needle); //Search a string in internal read buffer, return true if found
bool write(string in); //Write data into socket
bool close(); // Immediately Closes Connection !! (UNSAFE)
bool shutdown(); // Send remaining in send buffers then terminate connection (SAFE)
/** CLIENT **/
/** SERVER **/
bool server(string host, string port); //Bind and listens on IP and Port (IPv4 or IPv6 specified by IP);
Table select(wait_ms, bool all); //Select returns a table of new connections and connections that readable or all connections if all applied
Table select_bind(wait_ms, socket bound, bool all); //Select returns a table and bound to the specific socket and register clients there
bool copy(string sock); //Clone socket neccesary if new connection appear
bool copy_server(string sock); //Clone server socket usable for
bool ssl_setup(string cert, string chain, string key, bool finit); //Initiates SSL on server Side, this is only need once, if finit = true SSLAccept does automatically
bool ssl_accept(); //Negoiate SSL Connection
bool blacklist(ban_seconds);
/** SERVER **/
}
}
[WEBGUI]
{
Class WEBGUI(string window_title, string URL, int width, int height) //Launch WebGUI
{
}
}
}
If you like the article then don't forget to share!
|
||
Nexus Datalogger 2023
Our first version of Datalogger Software released back in 2012. What we made is a simple and continuous datalogging software with a reliable..
TrackIT-PortGuard
This is a simple TCP Gateway or proxy with advanced security features.The mechanism similar to port knocking, however much more safe..
[P]artial [F]ile [R]ecovery in case of badSector, HDD Error
Our new Software released under Open Source license.PFR is a cross-platform easy-to-use powerfull tool to recover broken files that caused HDD or..
BVCP: FreeBSD Bhyve Web UI
This is a personal project from the author of nPulse.net, Viktor Hlavaji (DaVieS).nPulse.net is always willing to share knowledge and resources..
SSH Two-Factor Authentication
SSH Twofactor Authentication is our "still-under-development" project.It for Android mobile phones and linux / FreeBSD servers.The goal is make..
sysAdmin ToolBox v2.0
We are happily announce that our second version of sysAdmin ToolBox for Adnroid mobile phones published into live.The first version of this..
ASPF-Milter
ASPF-Milter is our next generation Centralised SPAM Filter on both directions (sending, receiving).ASPF-Milter as it's name suggest uses MILTER..
Trackit-2019
Trackit-2019 is our enterprise class /very advanced/ all-in-one monitoring/datalogger application for IT / ICT Infrastructure. This is the 5th..
MVCP 1.0 (Discounted, 2.0 coming soon)
MVCP is our 5th generation of Mass Virtual Hosting Control Panel. Unlike any-other versions MVCP is written in PHP instead of C/C++/LUA.MVCP uses..