Skip to content

Instantly share code, notes, and snippets.

View maanimis's full-sized avatar
🎯
Focusing

Meisam Maani maanimis

🎯
Focusing
  • Tabriz
View GitHub Profile
@indexzero
indexzero / ssh2-tunnel.js
Last active February 4, 2024 05:47
Thoughts about SSH tunnellng using `ssh2`
var fs = require('fs'),
path = require('path');
Connection = require('ssh2');
var tunnelHost = process.argv[2],
dest = process.argv[3],
keyfile = process.argv[4];
var conn = new Connection();
@bhurlow
bhurlow / tunnel.js
Created May 7, 2013 19:56
proxy tunnel
var http = require('http');
var net = require('net');
var url = require('url');
var proxy = http.createServer();
// proxy an HTTP request
proxy.on('request', function(req, res){
var uri = url.parse(req.url);
@montanaflynn
montanaflynn / CONCURRENCY.md
Last active November 7, 2024 18:22
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.

@bwann
bwann / README.md
Last active November 7, 2024 03:19
Tunnelling SSH over SSL/TLS

How to tunnel SSH over SSL/TLS

laptop ssh -> laptop stunnel -> evil network -> internet -> your server -> your server ssh

Server (your shell server/home box/work box/whatever)

Sets up a stunnel process listening externally on port 2443/tcp, forwards to localhost 22/tcp

  • Install stunnel, e.g. yum install stunnel
  • Install server config snippet to /etc/stunnel/stunnel.conf
@aonurdemir
aonurdemir / tunnel
Last active February 4, 2024 05:17
Tunnel
ssh -L 3308:<DB_MACHINE_HOST_ADDRESS>:3306 -f <USER>@<SSH_MACHINE_HOST_ADDRESS> -p <SSH_PORT> -NnT
DB request to localhost:3308 ->(goes to) <SSH_MACHINE_HOST_ADDRESS>:<SSH_PORT> -> <DB_MACHINE_HOST_ADDRESS>:3306
-L local port forwarding
-f run in background
-T disable psuedo terminal allocation
-Nn disable stdin and execution of commands
@gabonator
gabonator / tunnelclient.js
Created November 18, 2017 15:43
simple IP tunneling using public server in nodejs
var net = require('net');
var tunnel = null;
var target = null;
// tunnel server
var serverInfo = {port:8811, host:"public.server.com"};
// target device we want to access on network where this script is running
var targetInfo = {port:1001, host:"ip.local.network"};
function listen()
const { createTunnel, closeTunnel } = require('proxy-chain');
// This is how connection strings usually look like
const serviceConnectionString = '<protocol>://<auth>@<service-hostname>:<service port>';
// Create tunnel for the service, this call will start local tunnel and
// return string in format localhost:<selected-free-port> which is address
// of the local tunnel.
const tunnelInfo = await createTunnel(
'http://<username>:<password>@<proxy-server-hostname>:<proxy-server-port>',
@yume-chan
yume-chan / client.js
Last active February 4, 2024 05:48
reverse tunnel
const net = require("net");
const http = require("http");
const https = require("https");
const http2 = require("http2");
const req = https.request({
method: "CONNECT",
host: "server",
port: 443,
path: "magic.string"
@vietor
vietor / ogrok.js
Last active February 4, 2024 05:53
ogrok introspectable tunnels to localhost
const net = require('net');
const IdMaker = (function() {
var seq = 0;
return {
next: () => {
seq = (++seq) % 10000;
return Date.now() + '-' + seq;
}
@hizkifw
hizkifw / cloudflare-worker-youtube-dl.js
Last active August 10, 2024 09:06
Download YouTube videos with Cloudflare Worker
/**
* cloudflare-worker-youtube-dl.js
* Get direct links to YouTube videos using Cloudflare Workers.
*
* Usage:
* GET /?v=dQw4w9WgXcQ
* -> Returns a JSON list of supported formats
*
* GET /?v=dQw4w9WgXcQ&f=251
* -> Returns a stream of the specified format ID