简体   繁体   English

袜子在C代理认证

[英]socks proxy authentication in c

I have a function designed to make a socks handshake packet; 我有一个设计用来制作袜子握手包的功能; but I can't find any information regarding how the authorization fields are filled. 但找不到有关如何填写授权字段的任何信息。 How is the authentication packet formatted? 身份验证数据包的格式如何?

void socks_auth(int sd, char *buffer) {
    char *ptrBuff;
    ptrBuff = buffer;
    *(ptrBuff++) = SOCKS_V;
    *(ptrBuff++) = 2;
    *(ptrBuff++) = 0x00;
    *(ptrBuff++) = 0x02;
    send(sd, ptrBuff, ptrBuff - buffer, 0);
    recv(sd, buffer, 2, 0);
    if (buffer[1] == 0xFF) write(STDOUT_FILENO, "not supported\n", 14);
    if (buffer[1] == 0x02) {

    };
}

I'd suggest you start with RFC1928 , SOCKS Protocol Version 5 and possibly RFC1961 GSS-API Authentication Method for SOCKS Version 5 . 我建议您从RFC1928SOCKS协议版本5SOCKS版本5的 RFC1961 GSS-API身份验证方法开始

If neither of those help, perhaps looking at the source of socat , which can act as a SOCKS5 proxy, will help. 如果这些都不起作用 ,也许看看socat的来源(可以充当SOCKS5代理)将有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM