Category Archives: Uncategorized

Uncategorized but very important

How to Replace a Substring in a String in c++ code

A bit away for from security themes just simple c++ coding related to string processing, changing substring in char array. Recently I had a task to hide some private info in log replacing it with asterisks. It is the code, I tried to do it the new substituted substring may longer or shorter then initial… Read More »

Golang. UTF-8 String from unsafe pointer

It is a continuation of previous post “Compare storage of string in memory for c++ and golang using dgb” where gbg debugger was used to read characters defined in string variable directly from memory. The example below shows how to read string bytes from memory using unsafe pointer. String encoding is UTF-8, and it contains… Read More »

Calculate SHA-256 programmatically (c++ and golang)

SHA-256 is 256 bit hash value calculated by SHA-2 (Secure Hash Algorithm 2). SHA-256 is used in some of the multiple well known authentication and encryption protocols, including SSL, TLS, IPsec, SSH, and PGP. Also it is used for secure password hashing and cryptocurrency transaction verification. Here is c++ example how to calculate SHA-256 has… Read More »

Simple method of bash script step debugging

I always wanted to be able to debug bash scripts just like any other code and I did not know how to do in for very long time. However it is easy to do using trap command which may intercept different kind of signals and exceptions. Adding trap in some place of your script you… Read More »

How detach forked process from parent process

A child forked process in Linux inherits most of parent process attributes, such as file descriptors. Basically a child process basically represents a copy of the parent. setsid() function may help to break this inherency. “man 2 setsid” gives us the following information about this function: setsid() creates a new session if the calling process… Read More »

Removing trovi.com from Chromebook

I bought new Chromebook at Costco and found that my Chrome browser redirects me to trovi.com search engine. I did not know anything about trovi and after googling I found that trovi is classified as browser hijacker which modifies a web browser’s settings without my permission. Definitely it does not look good. Before removing trovi… Read More »

ioctl, analog of DeviceIOControl

Win32 API DeviceIOControl function allows Windows application program to send a control code directly to a specified device driver, requesting the corresponding device to perform the appropriate operation. The application program must be started with administrator privileges. I used DeviceIOcontrol function in many project some of them as xedit and socketspy are mentioned in this… Read More »

Question Mark Environment Variable in Linux

Question Mark Environment Variable is special variable in Linux and other Unix operating systems which contains status (return code) of shell commands or executable. This variable is widely used in scripts to verify exit status of shell command. The value range of question mark environment variable is between 0 and 255. Normally zero value means… Read More »

cURL without cacert or capath options

The curl as mention in its manual is the tool to transfer data from or to a server, using one of the different application-layer Internet protocol including HTTPS. With HTTPS curl works as CLI browser and supports TLS handshake process. cURL cacert option is used to specify certificate file to verify the peer, capath tells… Read More »