sudo apt update -y
sudo apt install python3 python3-pip git unzip -y
10.1.1.4/24 --> a system connected to bmc system. 10.1.1.5/24 --> bmc system. localhost --> my laptop. Suppose we want to access a service running at UDP port 623 but UDP port 623 is blocked by our firewall and TCP port 80 is unblocked. So we can use nc to create a tunnel using TCP port 80.
mkfifo /tmp/fifo
sudo nc -l -u -p 623 < /tmp/fifo | nc 10.1.1.4 80 > /tmp/fifo
// Modified version of https://gist.github.com/igorgatis/d294fe714a4f523ac3a3 | |
function hexdump(buffer, blockSize, maxLength) { | |
if(typeof buffer === 'string'){ | |
console.log("buffer is string"); | |
//do nothing | |
}else if(buffer instanceof ArrayBuffer && buffer.byteLength !== undefined){ | |
console.log("buffer is ArrayBuffer"); | |
var tlen = buffer.byteLength; | |
if (tlen > 65000) tlen = 65000; | |
buffer = String.fromCharCode.apply(String, [].slice.call(new Uint8Array(buffer, 0, tlen))); |
Project URL https://github.com/novnc/websockify-other
apt install openssl-dev
git clone git@github.com:novnc/websockify-other.git websockify
cd websockify/c
make
cp websockify /usr/bin
Check current state of swap
swapon -s
Turn off the swap
swapoff -a
Formate a file or block device as swap
mkswap /dev/sdX
Update fstab to mount this swap devie/file on every boot
/* | |
* This program is inspired from following articles - | |
* http://www.linux-pam.org/Linux-PAM-html/adg-example.html | |
* https://docs.oracle.com/cd/E23824_01/html/819-2145/pam-1.html#pam-20 | |
* https://man7.org/tlpi/code/online/book/tty/no_echo.c.html | |
* | |
* Install required packages: | |
* $ sudo apt-get install libpam-dev -y | |
* | |
* Compile using gcc: |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <systemd/sd-bus.h> | |
int main(int argc, char *argv[]) { | |
sd_bus_error error = SD_BUS_ERROR_NULL; | |
sd_bus_message *m = NULL; | |
sd_bus *bus = NULL; | |
int64_t x, y, z; | |
int r; |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <sys/socket.h> | |
#include <systemd/sd-bus.h> | |
int fds[2]; | |
#define INT_TO_PTR(integer) ((void*) (long) ((int)integer)) |
#include<stdio.h> | |
// A sample puzzle | |
int sudoku[9][9] = { {0,0,0,4,0,0,0,9,0}, | |
{0,3,0,0,5,0,0,1,8}, | |
{0,0,0,0,0,0,6,0,7}, | |
{4,2,0,1,0,3,0,0,6}, | |
{0,9,0,0,0,0,0,2,0}, | |
{7,0,0,2,0,8,0,4,1}, | |
{6,0,4,0,0,0,0,0,0}, |