Pages

Wednesday, 28 February 2018

由socks proxy生成http proxy的工具汇总

1.(非常好用,比privoxy/polipo/3proxy好用多了)

hpts is a nodejs-based app to convert socks proxy into http proxy.

build
简介
hpts(http-proxy-to-socks) is a nodejs tool to convert SOCKS proxy into http proxy.
Many clients support setting up http proxy to speed up network requests and for sometimes only SOCKS proxy is available to you. SOCKS proxy supports TCP so that it's possible to convert those requests from http proxy into SOCKS protocol. In this way, you can still keep the goodness provided by your SOCKS proxy(e.g. encryption).

Setup

npm install -g http-proxy-to-socks
Make sure your nodejs version is greater than 4.

Usage

hpts -s 127.0.0.1:1080 -p 8080 (此程序很好用)
This will start a process listening on 8080 as a http proxy. It will convert http requests into socks requests and send them to port 1080. Please make sure your socks service is available at the corresponding port.
Other options:
Options:

  -h, --help             output usage information
  -V, --version          output the version number
  -s, --socks [socks]    specify your socks proxy host, default: 127.0.0.1:1080
  -p, --port [port]      specify the listening port of http proxy server, default: 8080
  -c, --config [config]  read configs from file in json format
  --level [level]        log level, vals: info, error
You can specify a json config file with -c:
{
  "socks": "127.0.0.1:1080",
  "port": 8080
}
 
from  https://github.com/oyyd/http-proxy-to-socks

hpts --socks 127.0.0.1:1080 --port 8080
-----------------------------------------

 
2. 把socks proxy转换为http proxy的工具:socks2http-by-zenhack

在本地机器mac上,搭建go环境。然后,
cd $GOPATH
go get -u -v github.com/zenhack/socks2http

可执行文件socks2http就会出现在$GOBIN/里面。
mv $GOBIN/socks2http $GOBIN/socks2http-by-zenhack
socks2http-by-zenhack -laddr 127.0.0.1:8081 -raddr 127.0.0.1:1080

这样,socks代理服务器127.0.0.1:1080就转换为了http代理服务器127.0.0.1:8081
设置浏览器的http代理服务器为127.0.0.1,端口为8081 ,浏览器即可翻墙。

注意:最好是在浏览器chrome+switchyomega下使用。如果直接在ff下,设置http proxy,ff是翻不了墙的。

项目地址:https://github.com/zenhack/socks2http
---------------------------------------

3. 把socks proxy转换为http proxy的工具:http2socks-by-mischief

在本地机器mac上,搭建go环境。然后,
cd $GOPATH
go get -u -v github.com/mischief/http2socks
可执行文件http2socks就会出现在$GOBIN/里面。
mv $GOBIN/http2socks $GOBIN/http2socks-by-mischief


http2socks-by-mischief -listen 127.0.0.1:8100 -socks 127.0.0.1:1080

这样,socks代理服务器127.0.0.1:1080就转换为了http代理服务器127.0.0.1:8100
设置浏览器的http代理服务器为127.0.0.1,端口为8100,浏览器即可翻墙。

项目地址:github.com/mischief/http2socks
-----------------------------

4. 把socks proxy转换为http proxy的工具:http2socks-by-modyuan

在本地机器mac上,搭建go环境。然后,
cd $GOPATH

go get -u -v github.com/modyuan/http2socks/
可执行文件http2socks就会出现在$GOBIN/里面。
mv $GOBIN/http2socks $GOBIN/http2socks-by-modyuan

http2socks-by-modyuan -http 127.0.0.1:9600 -socks 127.0.0.1:7070
会显示:
2019/10/23 17:43:37 Opened simple http proxy on [127.0.0.1:9600]
2019/10/23 17:43:37 Forwarding to socks proxy on [127.0.0.1:7070]

这样,socks代理服务器127.0.0.1:7070就转换为了http代理服务器127.0.0.1:9600
设置浏览器的http代理服务器为127.0.0.1,端口为9600,浏览器即可翻墙。

项目地址:https://github.com/modyuan/http2socks
-----------------------------

5. 把socks proxy转换为http proxy的工具:infra-socks-http

在本地机器mac上,搭建go环境。然后,
cd $GOPATH
go get -u -v github.com/weiqiang333/infra-socks-http
可执行文件infra-socks-http就会出现在$GOBIN/里面。
infra-socks-http httpProxy -l :6060 -s 127.0.0.1:1080
 这样,就把socks代理服务器127.0.0.1:1080转换为了http代理服务器127.0.0.1:6060
设置浏览器的http代理服务器为127.0.0.1,端口为6060 ,浏览器即可翻墙。

项目地址:https://github.com/weiqiang333/infra-socks-http
-----------------------------------------------

6. 把socks proxy转换为http proxy的工具:jet

安装环境:Node.js >= 8.0.0
安装方法:npm install -g @2players/jet@4.3.4
Change SOCKS Proxy setting via 3 environment variables:
  • JET_SOCKS_ADDR - 127.0.0.1
  • JET_SOCKS_PORT - 1080
  • JET_SOCKS_TYPE - 5
Change setting of listening:
  • JET_LISTEN_ADDR - 127.0.0.1
  • JET_LISTEN_PORT - 9527

Running Jet:

jet sync-geoip

# jet runs on 127.0.0.1:9527 by default:
jet run
 
# run jet on another port, like 9600
JET_LISTEN_PORT=9600 jet run  

这样,就把socks代理服务器127.0.0.1:1080转换为了http代理服务器127.0.0.1:9600
设置浏览器的http代理服务器为127.0.0.1,端口为9600 ,浏览器即可翻墙。
项目地址:https://github.com/dodrio/jet 

注意:本地的socks proxy为127.0.0.1:1080 .如果本地的socks proxy的端口不是1080,
而是其他端口,比如2080,那就要运行:
JET_SOCKS_PORT=2080 JET_LISTEN_PORT=9600 jet run

这样,就把socks代理服务器127.0.0.1:2080转换为了http代理服务器127.0.0.1:9600
设置浏览器的http代理服务器为127.0.0.1,端口为9600 ,浏览器即可翻墙。
-----------------------------------------
7. 把socks proxy转换为http proxy的工具:http2socks-by-zbo14
安装环境:Node.js 
git clone https://github.com/zbo14/http2socks http2socks-by-zbo14
cd http2socks-by-zbo14
npm install
HTTP_PORT=9600 SOCKS_HOST="127.0.0.1" SOCKS_PORT=7070 node http2socks.js
会显示:
HTTP Proxy started!
不要关闭此terminal.
这样,socks代理服务器127.0.0.1:7070就转换为了http代理服务器127.0.0.1:9600
设置浏览器的http代理服务器为127.0.0.1,端口为9600,浏览器即可翻墙。
-------------------------------------------------


8. 把socks proxy转换为http proxy的工具:http2socks5-by-sun-xb


在本地机器mac上,搭建go环境。然后,
cd $GOPATH
go get -u -v github.com/sun-xb/http2socks5/
可执行文件http2socks5就会出现在$GOBIN/里面。
mv $GOBIN/http2socks5 $GOBIN/http2socks5-by-sun-xb
http2socks5-by-sun-xb -h
显示:
Usage of http2socks5-by-sun-xb:
  -http string
    local http proxy address (default "127.0.0.1:8118")
  -socks5 string
    remote socks5 address (default "socks5://127.0.0.1:1080")
于是运行:
http2socks5-by-sun-xb -http 127.0.0.1:9600 -socks5 socks5://127.0.0.1:7070
这样,socks代理服务器127.0.0.1:7070就转换为了http代理服务器127.0.0.1:9600
设置浏览器的http代理服务器为127.0.0.1,端口为9600,浏览器即可翻墙。
项目地址:https://github.com/sun-xb/http2socks5
--------------------------------------------------
9.  把socks proxy转换为http proxy的工具: http-proxy
在Mac机器上。
git clone https://github.com/GangZhuo/http-proxy http-proxy-by-GangZhuo cd http-proxy-by-GangZhuo git submodule init git submodule update make
在当前目录下,会生成可执行文件http-proxy。
./http-proxy -h
./http-proxy -p 1081 --proxy=127.0.0.1:1080 --dns-server=vps-ip:dnsmasq-port-number-on-vps   or:
./http-proxy -p 1081 --proxy=127.0.0.1:1080 --dns-server=208.67.222.222:5353
这样,就把socks proxy(127.0.0.1:1080)转换为了http proxy(127.0.0.1:1081).
项目地址:https://github.com/GangZhuo/http-proxy
-----------------------------------------
10. https://briteming.blogspot.com/2013/02/cow-climb-over-wall-proxy.html里的橘黄色文字。
-----------------------------------

11. https://briteming.blogspot.com/2015/12/sockshttpgoproxy.html
------------------------------------

12. 把socks proxy转换为http proxy的工具:httpRelay

在本地机器mac上.先安装go环境。然后,
cd $GOPATH
go get -u -v github.com/cobratbq/httpRelay/cmd/relay/
这样,可执行文件relay就会出现在$GOBIN/下。
relay -listen :7070 -socks localhost:1080
显示:
2020/04/11 16:28:00 HTTP proxy relay server started on :7070 relaying to SOCKS proxy localhost:1080
这样,就把SOCKS proxy localhost:1080转换为http proxy localhost:7070
-------------------------------------

13. 把socks proxy转换为http proxy的工具:http-socks5

cd $GOPATH
go get -u -v  github.com/soyum2222/http-socks5/
显示:
package http-socks5/socks5-client: unrecognized import path "http-socks5/socks5-client" (import path does not begin with hostname)
于是,
cd src/github.com/soyum2222/http-socks5/
go install
显示:
main.go:8:2: cannot find package "http-socks5/socks5-client" in any of:
~/go1.13/go/src/http-socks5/socks5-client (from $GOROOT)
~/go1.13/go/gopath/src/http-socks5/socks5-client (from $GOPATH)
于是,
cd ~/go1.13/go/gopath/src/
git clone https://github.com/soyum2222/http-socks5
cd http-socks5
go install
which http-socks5
$GOBIN/http-socks5
http-socks5 -p 10800 -s 127.0.0.1:1080
thus we  can convert  a socks proxy server 127.0.0.1:1080 to become a http proxy server 127.0.0.1:10800
------------------------------------------
14. 把socks proxy转换为http proxy的工具:s2http

cd $GOPATH
go get -u -v github.com/chinglinwen/s2http/
which s2http
$GOBIN/s2http

s2http -port 10801 -socks 127.0.0.1:1080
thus we  can convert  a socks proxy server 127.0.0.1:1080 to become a http proxy server 127.0.0.1:10801
项目地址:github.com/chinglinwen/s2http
-----------------------------------------
15. fwlite-cli,详见https://briteming.blogspot.com/2016/12/fwlitecow.html
-----------------
16.https://briteming.blogspot.com/2018/08/http-proxysocks-proxy-h2s.html
------------------
17. 在mac机器上安装pip.然后,(需为python2. python3不行)
  • pip install pysocks
  • git clone https://github.com/kuyagic/socks2http socks2http-by-kuyagic
  • cd socks2http-by-kuyagic
  • nano socks2http.py
  • (把第153行的9050改为你的本地机器上的socks proxy的端口号,比如1080。把第157行的8081改为你所希望的端口号,比如5031)
  • 然后运行python socks2http.py
  • 会显示:
  • [+] Any clients will be served...


    [!] socks2http listening on 0.0.0.0 port 5031 ...

    [!] Upstream Socks Server 127.0.0.1 port 1080

  • 这样,就把socks proxy 127.0.0.1:1080,转换为了http proxy 127.0.0.1:5031

  • 项目地址:https://github.com/kuyagic/socks2http

------------------------------------------------------

18. 
在本地机器mac上。 
cd $GOPATH
go get -u -v github.com/luckypoem/http2socks/
(这一步要挂vpn之后,运行)
在$GOBIN/下,会生成可执行文件http2socks。
cd ~
http2socks -h
http2socks -addr 127.0.0.1:8082 -socks_addr 127.0.0.1:1080 
这样,就由socks proxy 127.0.0.1:1080 生成了http proxy 127.0.0.1:8082
项目地址:https://github.com/luckypoem/http2socks 

--------------------------------------------------

把socks proxy转换为http proxy的工具:http2socks-by-cpplucifer
在本地机器mac上.
git clone https://github.com/cpplucifer/http2socks http2socks-by-cpplucifer
cd http2socks-by-cpplucifer
cmake .
make
显示:
。。。
/Users/xyz/http2socks-by-cpplucifer/src/connection_handler.cpp:7:10: fatal error: 
      'sys/epoll.h' file not found
#include         
1 error generated.
make[2]: *** [src/CMakeFiles/connection_handler.dir/connection_handler.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/connection_handler.dir/all] Error 2
make: *** [all] Error 2
所以,在mac上,编译失败。要在linux desktop os上,才行。
--------------





类似的工具kneesocks(不稳定,不建议使用)
 

Motivation

Driven by my burning desire to tunnel npm install requests through a SOCKSv5 proxy (eg. shadowsocks). Since npm only support HTTP proxy, I wrote this simple command line module to fire up a HTTP Proxy server, then use it to tunnel requests to my SOCKS proxy.

Features

  • Supports HTTP and HTTPS requests
  • Built-in DNS cache

Install

npm install kneesocks --production -g

Usage

kneesocks port1 port2, eg. kneesocks 10001 10002
  • port1 is the port your HTTP proxy server listen to on localhost.
  • port2 is the port of your existing SOCKS proxy, also on localhost.
  •  
  • 这样就把SOCKS proxy"转换为"了HTTP proxy,由socks代理服务器127.0.0.1:port2生成了http代理服务器127.0.0.1:port1

Limit

  • Node v0.10+ required (Node v0.11+ preferred).
  • Probably not the best solution for day-to-day browsing, due to lack of remote dns and websocket support.
  • If you don't mind building binaries, use DeleGate or Polipo instead.
from https://github.com/bitinn/kneesocks
------

由socks proxy生成http proxy的工具: socks2http-rs

首先在mac机器上安装rust环境。然后,
git clone https://github.com/xVanTuring/socks2http-rs socks2http-rs-by-xVanTuring
cd socks2http-rs-by-xVanTuring
cargo build --release
(会生成target/release目录)
cd target/release
./socks2http -h

./socks2http --socks5-addr 127.0.0.1:1080 --local-addr 127.0.0.1:5050

这样就由本地的socks proxy 127.0.0.1:1080生成了http proxy 127.0.0.1:5050


项目地址:

https://github.com/xVanTuring/socks2http-rs
-------

h2sproxy

h2sproxy wraps socks proxy with http proxy.

config

{
    "proxies": [
        "localhost:18080"
    ],
    "ignore": [
		"google.co.jp"
    ]
}

Usage

install

$ go get github.com/goshinobi/h2sproxy/cmd/h2s

help

$ h2s -h
Usage of h2s:
  -addr string
    	Which Addr the proxy listens (default "0.0.0.0:3128")
  -c string
    	Config json path

run

$ h2s -addr 0.0.0.0:3128 -c config.json
from https://github.com/goshinobi/h2sproxy
------
https://github.com/yukixz/socks2http, https://github.com/yukixz/socks2http/blob/master/proxy.js 
------------

https://github.com/Evan2698/socks2http

在mac上安装go1.17, 然后fork这个项目,我fork后的地址为https://github.com/briteming/socks2http-1
然后修改https://github.com/briteming/socks2http-1/blob/master/go.mod的第一行代码的
module socks2http为
module github.com/briteming/socks2http-1

运行: go install github.com/briteming/socks2http-1@latest
显示:

go: downloading github.com/briteming/socks2http-1 v0.0.0-20220818153608-5725655aaa34

go: downloading github.com/Evan2698/socks2http v0.0.0-20181227115234-dd5935935702

go: downloading golang.org/x/net v0.0.0-20191109021931-daa7c04131f5


运行:which socks2http-1

显示:

/Users/brite/go1.17.9/go/gopath/bin/socks2http-1


yudeMacBook-Air:~ brite$ socks2http-1 -h

Usage of socks2http-1:

  -http string

    local http proxy address (default "0.0.0.0:8000")

  -socks5 string

    remote socks5 address (default "socks5://127.0.0.1:1080")

yudeMacBook-Air:~ brite$ socks2http-1 -http :7777 -socks5 socks5://127.0.0.1:10086


这样,就由上游的socks5 proxy 127.0.0.1:10086生成了一个http proxy 127.0.0.1:7777

------------------

https://github.com/exfun/socks2http
------------

https://github.com/shejingui/socks2http
---------------

https://github.com/rinsuki/socks2http
------------------

https://github.com/adam-zhang/socks2http
------------------------------
 
https://github.com/juanmv94/SOCKS2HTTP
 
git clone https://github.com/juanmv94/SOCKS2HTTP SOCKS2HTTP-by-juanmv94
cd SOCKS2HTTP-by-juanmv94
wget https://github.com/juanmv94/jsocket/raw/master/jsocket/jsocket.cpp
wget https://github.com/juanmv94/jsocket/raw/master/jsocket/jsocket.h
wget https://github.com/juanmv94/jsocket/raw/master/jssocket/jssocket.h
wget https://github.com/juanmv94/jsocket/raw/master/jssocket/jssocket.cpp
chmod 755 compile.sh 
./compile.sh 
mv SOCKS2HTTP.out SOCKS2HTTP
./SOCKS2HTTP --help
./SOCKS2HTTP 7080 localhost 10086 local
这样就从本地的socks proxy localhost:10086生成了一个http proxy localhost:7080
------------------------ 
 
https://github.com/dworld/http2socks
---------------------------

https://github.com/chinglinwen/s2http
-----------------

https://github.com/stong/httpsocks
--------------------
 

socks-to-http-proxy Rust release

An executable to convert SOCKS5 proxy into HTTP proxy

sthp purpose is to create HTTP proxy on top of the Socks 5 Proxy

How it works

It uses hyper library HTTP proxy example and adds functionality to connect via Socks5

Compiling

Follow these instructions to compile

  1. Ensure you have current version of cargo and Rust installed
  2. Clone the project $ git clone https://github.com/KaranGauswami/socks-to-http-proxy.git && cd socks-to-http-proxy
  3. Build the project $ cargo build --release
  4. Once complete, the binary will be located at target/release/sthp

Usage

sthp -p 8080 -s 127.0.0.1:1080

This will create proxy server on 8080 and use localhost:1080 as a Socks5 Proxy

Options

There are a few options for using sthp.

USAGE:
    sthp [OPTIONS]

OPTIONS:
    -h, --help                             Print help information
    -p, --port <PORT>                      port where Http proxy should listen [default: 8080]
    -s, --socks-address <SOCKS_ADDRESS>    Socks5 proxy address [default: 127.0.0.1:1080] 
from https://github.com/KaranGauswami/socks-to-http-proxy 
 --------------------------------------------
https://github.com/KrxkGit/ProxyServer/issues/1