Skip to content

o8x/cc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CryptConn

GitHub top language Go Report Card CodeFactor Go Reference LICENSE

net.Conn 的封装,采用 cc1 协议进行加密数据传输

CC1

CC1 是 CC(CryptConn) 协议族的 1.0 版本,本质上是使用 aes 对传输进行加解密的一种 socks like 协议

CC1 RFC

协议握手:

+-------------------------------------+
| protocol | version | cipher |  type |
|-----------------------------|--------
|   2byte  |  1byte  |  1byte | 1byte |
+-------------------------------------+

protocol:协议
    - cc: 0x00cc
version: 版本号
    - 0x10: 1.0
cipher: 加密方法
    - 0x00: 明文
    - 0x01: aes-128-cfb
    - 0x02: aes-192-cfb
    - 0x03: aes-256-cfb
    - 0x11: aes-128-ctr
    - 0x12: aes-192-ctr
    - 0x13: aes-256-ctr
type: 类型
    - 0x02: 客户端
    - 0x05: 服务端

示例

        00cc100102
client ---------------> server
        00cc100105
client <--------------- server

权限验证

+--------------------------------------------------------------------+
|  cmd  | method | username-len | username | password-len | password |
+--------------------------------------------------------------------+
| 1byte | 1byte  |     1byte    |   -bit   |     1byte    |   -bit   |
+--------------------------------------------------------------------+

cmd: 命令类型
    - 0x01:权限验证
    - 0x02:CONNECT
method: 认证方法
    - 0x00: 无权限认证
    - 0x01: USERNAME/PASSWORD 认证
username-len: 用户名长度
username: 用户名
password-len: 密码长度
password: 密码

响应

+--------------------------+
|  cmd  |  method |  reply |
+--------------------------+
| 1byte |  1byte  |  1byte |
+--------------------------+

method: 认证方法
    - 0x00: 无权限认证
    - 0x01: USERNAME/PASSWORD 认证
reply: 响应
    - 0x01: CMD成功
    - 0x02: CMD失败
    - 0x03: CMD错误

CONNECT

类似 socks5 的 Requests 部分

+------------------------+
|  cmd  | ATYP  | target |
+------------------------+
| 1byte | 1byte |  -byte  |
+------------------------+

ATYP: target 的类型
    - 0x01: 域名
    - 0x02: IP
target: 目标地址

响应

+------------------------+
|  cmd  |  ATYP  | reply |
+------------------------+
| 1byte | 1byte | 1byte  |
+------------------------+

ATYP: target 的类型
    - 0x01: 域名
    - 0x02: IP
reply: 响应
    - 0x01: CMD成功
    - 0x02: CMD失败
    - 0x03: CMD错误
    - 0x04: 不允许连接
    - 0x05: 找不到主机
    - 0x06: 不支持的 ATYP

Golang Example

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages