• Stars
    star
    166
  • Rank 227,748 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created about 8 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HOP: A proxy server to enable arbitrary protocols behind an HTTP proxy

HTTP-Over-Protocol (HOP)

  _   _  ___  ____  
 | | | |/ _ \|  _ \
 | |_| | | | | |_) |
 |  _  | |_| |  __/
 |_| |_|\___/|_|

NOTE Have a look at go-hop for an under-development version in Golang.

Introduction

A friend once told me that his university has an HTTP(S)-only proxy, and thus he is unable to SSH to hosts outside. 5 hours of intensive coding later using code borrowed from my course assignment, here's HOP.

HOP is a tool meant to tunnel any sort of traffic over a standard HTTP channel.

Useful for scenarios where there's a proxy filtering all traffic except standard HTTP(S) traffic. Unlike other tools which either require you to be behind a proxy which let's you pass arbitrary traffic (possibly after an initial CONNECT request), or tools which work only for SSH, this imposes no such restrictions.

Working

Assuming you want to use SSH to connect to a remote machine where you don't have root privileges.

There will be 7 entities:

  1. Client (Your computer, behind the proxy)
  2. Proxy (Evil)
  3. Target Server (The remote machine you want to SSH to, from Client)
  4. Client HOP process
  5. Target HOP process
  6. Client SSH process
  7. Target SSH process

If there was no proxy, the communication would be something like:

Client -> Client SSH process -> Target Server -> Target SSH process

In this scenario, here's the proposed method:

Client -> Client SSH process -> Client HOP process -> Proxy -> Target HOP process -> Target SSH process -> Target Server

HOP simply wraps all the data in HTTP packets, and buffers them accordingly.

Another even more complicated scenario would be if you have an external utility server, and need to access another server's resources from behind a proxy. In this case, hop will still run on your external server, but instead of using localhost in the second command (Usage section), use the hostname of the target machine which has the host.

Usage

On the client machine:

./hop <client-hop-port> <server-host-name> <server-hop-port>

On the target machine:

./hop <server-hop-port> localhost <target-port> SERVER

(Note the keyword SERVER at the end)

In case of SSH, the target-port would be 22. Now once these 2 are running, to SSH you would run the following:

ssh <target-machine-username>@localhost -p <client-hop-port>

Note: The keyword server tells hop which side of the connection has to be over HTTP.

Contributing

Pull Requests are more than welcome! 😄

I've put down a list of possible ideas if you would like to contribute.

Planned features

  • Better and adaptive buffering
  • Better CLI flags interface
  • Optional encrypting of data
  • Parsing of .ssh/config file for hosts
  • Web interface for remote server admin
  • Web interface for local host
  • Daemon mode for certain configs

Bugs

  • HTTP Responses may come before HTTP Requests. Let me know if you know of some proxy which blocks such responses.
  • Logger seems to be non-thread-safe, despite locking. Suspected for memory errors, and thus disabled for now.

Testing

make
./hop 8081 localhost 8091 SERVER
./hop 8083 localhost 8081
python -c 'print("\n".join([ str(i) for i in range(1000000, 2000000)]))' >! ff1
python -c 'print("\n".join([ str(i) for i in range(2000000, 3000000)]))' >! ff2
nc -l 8091 < ff1 >! oo1
nc localhost 8083 < ff2 >! oo2
wc -l oo*

This should say that both files contain a million lines. Any less would mean some data loss.

More Repositories

1

zpyi

The power of python in your Zsh - Unobtrusive and easy python scripting in shell
Shell
105
star
2

resume

My personal resume/CV
TeX
12
star
3

vrf-hs

Verifiable Random Functions in Haskell (FFI to Google's implementation in Golang)
Go
8
star
4

pwnpeii

A docker to solve pwnable service deployment issues
Shell
6
star
5

dotfiles-genie

My automated configuration management system
TeX
5
star
6

max-emacs

emacs.d configuration (modular, holy)
Emacs Lisp
5
star
7

xmonadic-zest

My highly tweaked and modular XMonad WM config.
Haskell
4
star
8

Crypto-CS641

Code for CS641
C
4
star
9

emacs-smbc

Read SMBC from inside Emacs!
Emacs Lisp
4
star
10

acehack

Hakyll-based static blog, with lots of blog features written in Haskell.
CSS
4
star
11

acehack-blog-v2

Homepage cum Blog v3. Statically built using Hakyll.
HTML
3
star
12

acehack-blog-v1

Dynamic website cum blog. v2
HTML
3
star
13

CodeInnNode

The backend server for CodeInn based on Node.js
JavaScript
3
star
14

my-configs

Contains myriads of configurations with multiple scripts to make regular day terminal usage easier and faster.
Shell
3
star
15

vivid-vim

A modular Vim/NeoVim configuration
Vim Script
2
star
16

abcd-esolang

A modified esoteric programming language made for Chaos '16 - Techkriti IIT Kanpur
HTML
2
star
17

ffi-hs-testing

Demo code for static/dynamic linking and FFI from Haskell to Golang.
Haskell
2
star
18

go-hop

Implementation of a wrapping-HTTP proxy in Golang
Go
2
star
19

CompOund

A compile_commands.json parser script which can infer missing compilation commands, inspired by ccls and compdb.
Python
2
star
20

BigInTS

A Big Integer library written fully in TypeScript
TypeScript
1
star
21

encfile-mode

Safely manipulate encrypted files without leaving a trace
Vim Script
1
star
22

distributed-control-panel

A python-based control panel to launch, control, and view distributed applications across machines.
Python
1
star
23

st-suckless-term-config

My configuration (and code) for suckless's st terminal emulator
C
1
star
24

HTML-sanitizing

Scala
1
star
25

ConceptGraph

Project under Prof. Amey Karkare for Intelligent Tutoring System to extract relations/concepts from questions and visualize them as a graph.
Python
1
star
26

zsh-fu

Contains my prezto-compatible ZSH configuration
Shell
1
star
27

abstract-network

An abstraction over the network layer in Haskell, facilitating easy development of distributed applications.
Haskell
1
star