Skip to content

Instantly share code, notes, and snippets.

Using SSH to set up a VPN

If you're a roaming user or you're trying to link a satellite office to the main network, SSH can handle the job. Other solutions exist, and SSH isn't perfect, but this is probably the simplest trick out there.

OpenSSH since version 4.3 has the ability to set up TUN/TAP tunnels. I'm sure most of you have set up port-forwarding via SSH, but this is a little

@caffedrine
caffedrine / ethernet-socat-ssh.md
Created September 29, 2024 11:45 — forked from cfra/ethernet-socat-ssh.md
Tunneling Ethernet Over SSH With Socat and Tap Devices

Tunneling Ethernet Over SSH With Socat and Tap Devices

There are circumstances where one wants to attach the local machine to the same layer 2 ethernet segment, which a remote machine is connected to, with the only available transport being SSH.

While this solution has quite some shortcomings and should not be used to replace a real VPN, it can be beneficial e.g. for debugging network issues remotely.

@caffedrine
caffedrine / chroot-to-pi.sh
Created September 4, 2018 13:47 — forked from htruong/chroot-to-pi.sh
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@caffedrine
caffedrine / install_opencv2_ubuntu.sh
Created September 3, 2018 13:53 — forked from arthurbeggs/install_opencv2_ubuntu.sh
Install OpenCV2 in Ubuntu
#!/bin/bash
################################################################################
### OpenCV2 Installation Script ###
################################################################################
# Source code at https://github.com/arthurbeggs/scripts #
################################################################################
# #
# Feel free to copy and modify this file. Giving me credit for it is your #
# choice, but please keep references to other people's work, which I don't #
@caffedrine
caffedrine / msf_install.sh
Created March 17, 2018 16:37 — forked from minkione/msf_install.sh
Install metasploit on Debian 8
# Install Oracle Java 8
apt-get install software-properties-common
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" && apt-get update
apt-get install oracle-java8-installer
# Installing Dependencies
apt-get update
apt-get upgrade
apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev
@caffedrine
caffedrine / script.py
Created January 20, 2018 09:08 — forked from bodokaiser/script.py
Apache > 2.2.22 remote denial of service exploit.
# The idea is to do a HEAD request on a large file on an apache server with multiple byte ranges in multiple connections.
# The server then will have to read this large file from all the given byte ranges without returning any content
# (as it is a HEAD) request. If we do this about > 500 times in parallel the memory will collapse with
# the apache process crashing down.
import sys
import socket
header = ''
@caffedrine
caffedrine / I2C_Adapter.ino
Created July 19, 2017 12:01 — forked from kraftb/I2C_Adapter.ino
USB to I2C Adapter using Arduino
// I2C to USB Adapter using Arduino
// by Bernhard Kraft <kraftb@think-open.at>
/**
* This sketch can get loaded onto an Arduino to use it as USB to I2C Adapter.
* It uses the Wire library. So take a look at the documentation of the Wire
* libarary about the pins being used as SDA/SCL. For most Arduino boards this
* will be analog input pin 4 for SDA and analog input pin 5 for SCL.
*
* On the USB side the default serial link of the Arduino is used. A protocol
@caffedrine
caffedrine / LinkedList.c
Created June 10, 2017 21:25
Data Structures with Arduino - The Linked List
/*
Using Arduino Data Struct
Written: Obed Isai
*/
#include "LinkedList.h"
void setup(){
Node<int>* root = create_node(0);
@caffedrine
caffedrine / preprocessor_fun.h
Created June 5, 2017 19:50 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,