皇冠篮球比分网

您的位置:皇冠篮球比分网 >新闻资讯 > 正文

socks5代理之由浅入深写代理方法

来源: 作者:admin 时间:2019-05-15 18:11:16

  socks5代理之由浅入深写代理方法,本文讲的是如何写一个socks5代理,其实 shadowsocks 的代理也是 socks5协议的,所以 socks5代理也是本系列教程的一个重点。首先放出 socks5协议的 [rfc]( ),socks5协议很简单,SOCKS5协议并不负责代理服务器的数据传输环节,此协议只是在 C/S 两端真实交互之间,建立起一条从客户端到代理服务器的授信连接。

皇冠篮球比分网  0x01 sock5DAILIJIEGOUTU

socks5代理之由浅入深写代理

  0x02 socks5XIEYIFENXI

  RENZHENGJIEDUAN

皇冠篮球比分网  SHOUXIANKEHUDUANXUYAOHEFUWUDUANYOUGEWOSHOURENZHENGDEGUOCHENG,KEYICAIYONG YONGHUMING/MIMA RENZHENGHUOZHEWUXURENZHENGFANGSHI。

  GESHIRUXIA (SHUZIBIAOSHIWEISHU)

  +----+----------+----------+

皇冠篮球比分网  |VER | NMETHODS | METHODS |

皇冠篮球比分网  +----+----------+----------+

  | 1 | 1 | 1~255 |

  +----+----------+----------+

皇冠篮球比分网  VER ZIDUANSHIDANGQIANXIEYIDEBANBENHAO,YEJIUSHI 5;NMETHODS ZIDUANSHI METHODS ZIDUANZHANYONGDEZIJIESHU;METHODS ZIDUANDEMEIYIGEZIJIEBIAOSHIYIZHONGRENZHENGFANGSHI,BIAOSHIKEHUDUANZHICHIDEQUANBURENZHENGFANGSHI。

皇冠篮球比分网  0x00: NO AUTHENTICATION REQUIRED

  0x01: GSSAPI

  0x02: USERNAME/PASSWORD

皇冠篮球比分网  0x03: to X’7F’ IANA ASSIGNED

  0x80: to X’FE’ RESERVED FOR PRIVATE METHODS

皇冠篮球比分网  0xFF: NO ACCEPTABLE METHODS

  FUWUDUANFANHUIGESHI

  +----+--------+

  |VER | METHOD |

皇冠篮球比分网  +----+--------+

  | 1 | 1 |

  +----+--------+

  YIBANQINGKUANGXIAFUWUDUANFANHUILIANGZHONGQINGKUANG

  0x05 0x00:GAOSUKEHUDUANCAIYONGWURENZHENGDEFANGSHIJIANLILIANJIE;

皇冠篮球比分网  0x05 0xff:KEHUDUANDERENYIYIZHONGRENZHENGFANGSHIFUWUQIDOUBUZHICHI。

  JUGELIZI, FUWUQIWUXURENZHENGDEQINGKUANGRUXIA

皇冠篮球比分网  client -> server: 0x05 0x01 0x00 server -> client: 0x05 0x00

  LIANJIEJIEDUAN

  RENZHENGWANCHENG,KEHUDUANXIANGFUWUDUANFASONGQINGQIU:

  +----+-----+-------+------+----------+----------+

  |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |

  +----+-----+-------+------+----------+----------+

  | 1 | 1 | 1 | 1 | Variable | 2 |

  +----+-----+-------+------+----------+----------+

  CMD ZIDUAN command DESUOXIE:

皇冠篮球比分网  * 0x01:CONNECT JIANLI TCP LIANJIE * 0x02: BIND SHANGBAOFANXIANGLIANJIEDIZHI * 0x03:GUANLIAN UDP QINGQIU

  RSV ZIDUAN:BAOLIUZIDUAN,ZHIWEI 0x00ATYP ZIDUAN:address type DESUOXIE,QUZHIWEI:

皇冠篮球比分网  * 0x01:IPv4 * 0x03:YUMING * 0x04:IPv6

皇冠篮球比分网  DST.ADDR ZIDUAN:destination address DESUOXIE,QUZHISUI ATYP BIANHUA:

  * ATYP == 0x01:4 GEZIJIEDE IPv4 DIZHI * ATYP == 0x03:1 GEZIJIEBIAOSHIYUMINGZHANGDU,JINSUIQIHOUDESHIDUIYINGDEYUMING * ATYP == 0x04:16 GEZIJIEDE IPv6 DIZHI * DST.PORT ZIDUAN:MUDEFUWUQIDEDUANKOU

  FUWUDUANFANHUIGESHI

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

  |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

皇冠篮球比分网  | 1 | 1 | 1 | 1 | Variable | 2 |

  +----+-----+-------+------+----------+----------+

  REP ZIDUAN

皇冠篮球比分网  * X'00' succeeded * X'01' general SOCKS server failure * X'02' connection not allowed by ruleset * X'03' Network unreachable * X'04' Host unreachable * X'05' Connection refused * X'06' TTL expired * X'07' Command not supported * X'08' Address type not supported * X'09' to X'FF' unassigned

皇冠篮球比分网  JUGELIZI,KEHUDUANTONGGUO 127.0.0.1:8000 DEDAILIFASONGQINGQIU

  # request: VER CMD RSV ATYP DST.ADDR DST.PORT client -> server: 0x05 0x01 0x00 0x01 0x7f 0x00 0x00 0x01 0x1f 0x40 # response: VER REP RSV ATYP BND.ADDR BND.PORT server -> client: 0x05 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x10 0x10

  CHUANSHUJIEDUAN

  JIEXIALAIJIUKAISHICHUANSHUSHUJU,socks5FUWUQIZHIZUODANCHUNDEZHUANFAGONGNENG

  ZHENGGEGUOCHENGRUXIA

皇冠篮球比分网  # RENZHENGJIEDUAN client -> server: 0x05 0x01 0x00 server -> client: 0x05 0x00 # LIANJIEJIEDUAN client -> server: 0x05 0x01 0x00 0x03 0x0a b'google.com' 0x00 0x50 server -> client: 0x05 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x10 0x10 # CHUANSHUJIEDUAN client -> server -> remote remote -> server -> client ...

皇冠篮球比分网  ~BENWENJIANGDESHIRUHEXIEYIGE socks5DAILI,QISHI shadowsocks DEDAILIYESHI socks5XIEYIDE,SUOYI socks5DAILIYESHIBENXILIEJIAOCHENGDEYIGEZHONGDIAN。

皇冠篮球比分网  SHOUXIANFANGCHU socks5XIEYIDE [rfc]( ),socks5XIEYIHENJIANDAN,SOCKS5XIEYIBINGBUFUZEDAILIFUWUQIDESHUJUCHUANSHUHUANJIE,CIXIEYIZHISHIZAI C/S LIANGDUANZHENSHIJIAOHUZHIJIAN,JIANLIQIYITIAOCONGKEHUDUANDAODAILIFUWUQIDESHOUXINLIANJIE。

  0x01 sock5DAILIJIEGOUTU

皇冠篮球比分网  YOUQIANRUSHENXIEDAILI(3) -socks5DAILI

  0x02 socks5XIEYIFENXI

  RENZHENGJIEDUAN

  SHOUXIANKEHUDUANXUYAOHEFUWUDUANYOUGEWOSHOURENZHENGDEGUOCHENG,KEYICAIYONG YONGHUMING/MIMA RENZHENGHUOZHEWUXURENZHENGFANGSHI。

皇冠篮球比分网  GESHIRUXIA (SHUZIBIAOSHIWEISHU)

皇冠篮球比分网  +----+----------+----------+

  |VER | NMETHODS | METHODS |

  +----+----------+----------+

皇冠篮球比分网  | 1 | 1 | 1~255 |

  +----+----------+----------+

  VER ZIDUANSHIDANGQIANXIEYIDEBANBENHAO,YEJIUSHI 5;NMETHODS ZIDUANSHI METHODS ZIDUANZHANYONGDEZIJIESHU;METHODS ZIDUANDEMEIYIGEZIJIEBIAOSHIYIZHONGRENZHENGFANGSHI,BIAOSHIKEHUDUANZHICHIDEQUANBURENZHENGFANGSHI。

皇冠篮球比分网  0x00: NO AUTHENTICATION REQUIRED

皇冠篮球比分网  0x01: GSSAPI

  0x02: USERNAME/PASSWORD

  0x03: to X’7F’ IANA ASSIGNED

  0x80: to X’FE’ RESERVED FOR PRIVATE METHODS

  0xFF: NO ACCEPTABLE METHODS

  FUWUDUANFANHUIGESHI

皇冠篮球比分网  +----+--------+

皇冠篮球比分网  |VER | METHOD |

  +----+--------+

  | 1 | 1 |

  +----+--------+

皇冠篮球比分网  YIBANQINGKUANGXIAFUWUDUANFANHUILIANGZHONGQINGKUANG

  0x05 0x00:GAOSUKEHUDUANCAIYONGWURENZHENGDEFANGSHIJIANLILIANJIE;

  0x05 0xff:KEHUDUANDERENYIYIZHONGRENZHENGFANGSHIFUWUQIDOUBUZHICHI。

皇冠篮球比分网  JUGELIZI, FUWUQIWUXURENZHENGDEQINGKUANGRUXIA

皇冠篮球比分网  client -> server: 0x05 0x01 0x00

  server -> client: 0x05 0x00

  LIANJIEJIEDUAN

皇冠篮球比分网  RENZHENGWANCHENG,KEHUDUANXIANGFUWUDUANFASONGQINGQIU:

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

  |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

  | 1 | 1 | 1 | 1 | Variable | 2 |

  +----+-----+-------+------+----------+----------+

皇冠篮球比分网  CMD ZIDUAN command DESUOXIE:

皇冠篮球比分网  * 0x01:CONNECT JIANLI TCP LIANJIE

  * 0x02: BIND SHANGBAOFANXIANGLIANJIEDIZHI

皇冠篮球比分网  * 0x03:GUANLIAN UDP QINGQIU

  RSV ZIDUAN:BAOLIUZIDUAN,ZHIWEI 0x00ATYP ZIDUAN:address type DESUOXIE,QUZHIWEI:

  * 0x01:IPv4

皇冠篮球比分网  * 0x03:YUMING

皇冠篮球比分网  * 0x04:IPv6

  DST.ADDR ZIDUAN:destination address DESUOXIE,QUZHISUI ATYP BIANHUA:

  * ATYP == 0x01:4 GEZIJIEDE IPv4 DIZHI

  * ATYP == 0x03:1 GEZIJIEBIAOSHIYUMINGZHANGDU,JINSUIQIHOUDESHIDUIYINGDEYUMING

  * ATYP == 0x04:16 GEZIJIEDE IPv6 DIZHI

皇冠篮球比分网  * DST.PORT ZIDUAN:MUDEFUWUQIDEDUANKOU

  FUWUDUANFANHUIGESHI

  +----+-----+-------+------+----------+----------+

  |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

  | 1 | 1 | 1 | 1 | Variable | 2 |

皇冠篮球比分网  +----+-----+-------+------+----------+----------+

  REP ZIDUAN

皇冠篮球比分网  * X'00' succeeded

  * X'01' general SOCKS server failure

皇冠篮球比分网  * X'02' connection not allowed by ruleset

  * X'03' Network unreachable

  * X'04' Host unreachable

皇冠篮球比分网  * X'05' Connection refused

  * X'06' TTL expired

  * X'07' Command not supported

  * X'08' Address type not supported

皇冠篮球比分网  * X'09' to X'FF' unassigned

  JUGELIZI,KEHUDUANTONGGUO 127.0.0.1:8000 DEDAILIFASONGQINGQIU

皇冠篮球比分网  # request: VER CMD RSV ATYP DST.ADDR DST.PORT

  client -> server: 0x05 0x01 0x00 0x01 0x7f 0x00 0x00 0x01 0x1f 0x40

皇冠篮球比分网  # response: VER REP RSV ATYP BND.ADDR BND.PORT

  server -> client: 0x05 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x10 0x10

  CHUANSHUJIEDUAN

  JIEXIALAIJIUKAISHICHUANSHUSHUJU,socks5FUWUQIZHIZUODANCHUNDEZHUANFAGONGNENG

  ZHENGGEGUOCHENGRUXIA

  # RENZHENGJIEDUAN

  client -> server: 0x05 0x01 0x00

皇冠篮球比分网  server -> client: 0x05 0x00

  # LIANJIEJIEDUAN

皇冠篮球比分网  client -> server: 0x05 0x01 0x00 0x03 0x0a b'google.com' 0x00 0x50

  server -> client: 0x05 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x10 0x10

  # CHUANSHUJIEDUAN

  client -> server -> remote

皇冠篮球比分网  remote -> server -> client

  ...

皇冠篮球比分网相关的文章内容简介