socks5 | A C11 socks5 proxy server based on Libevent | Proxy library

 by   senlinzhan C++ Version: Current License: MIT

kandi X-RAY | socks5 Summary

kandi X-RAY | socks5 Summary

socks5 is a C++ library typically used in Networking, Proxy applications. socks5 has no bugs, it has a Permissive License and it has low support. However socks5 has 4 vulnerabilities. You can download it from GitHub.

A C++11 socks5 proxy server based on Libevent.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              socks5 has a low active ecosystem.
              It has 35 star(s) with 20 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of socks5 is current.

            kandi-Quality Quality

              socks5 has 0 bugs and 0 code smells.

            kandi-Security Security

              OutlinedDot
              socks5 has 4 vulnerability issues reported (0 critical, 4 high, 0 medium, 0 low).
              socks5 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              socks5 is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              socks5 releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of socks5
            Get all kandi verified functions for this library.

            socks5 Key Features

            No Key Features are available at this moment for socks5.

            socks5 Examples and Code Snippets

            No Code Snippets are available at this moment for socks5.

            Community Discussions

            QUESTION

            Privoxy does not work with traffic from iptables
            Asked 2022-Apr-02 at 11:45

            I have privoxy configured and working on port 8118. I can forward HTTP and HTTPS traffic when defining the http_proxy and https_proxy variables to point out to the proxy. Examples:

            ...

            ANSWER

            Answered 2022-Apr-02 at 11:45

            I'm not entirely familiar with how Privoxy works, however I do know how intercepting proxy works on Linux.
            HTTP proxies and intercepting proxies work in very different ways. An HTTP proxy get the destination from the first line of the query, which would contain the domain name (e.g. it should be GET http://www.google.com/ HTTP/1.1). For HTTPS, it does an HTTP CONNECT request with the domain:port to connect to (e.g. CONNECT www.google.com:443 HTTP/1.1).
            An intercepting proxy get the original destination address from the kernel by doing a getsockopt() with some specific parameters. It has no knowledge of higher level protocol.
            In general redirecting with iptables a request to an HTTP proxy does not work because of theses differences. That said, Privoxy seems to have a configuration option accept-intercepted-requests that you can use so it read the target from the Host: HTTP header. With that configuration, it should be able to handle HTTP requests redirected using iptables. As the documentation says, this is not supported for HTTPS. You will need to use some additional software which can do the forwarding to an HTTP proxy, probably much like Proxifier does. I know moproxy can do that. It ought to not be the only one, but I don't know others.

            Additional questions:

            • Why setting the variables works, and through iptables doesn't?

            because HTTP and transparent/intercepting proxy works in different ways. When the variables are present, curl (and other) alter how they send the query, but with iptables, they don't (as they don't know you use a proxy).

            • Why do I have to set the https_proxy to point to http://...? Is that privoxy-related?

            the http:// in your environment variable is to describe how you connect to the proxy (it could actually be https:// if your proxy had a tls certificate, and it would work with http requests too, though they would be encrypted only from you to the proxy, not from the proxy to the remote server).

            • Regarding the comment "HTTPS is not supposed to be used with transparent proxies": So how does Proxifier work on Windows? If that is not transparent a proxy, is there another term for it? Why can't we have something similar on WSL/Linux?

            I don't know the specifics of how transparent proxies work on Windows. Assuming it works a lot like Linux, Proxifier probably redirect the request to a local port, get the actual destination, wrap the data in a way it's understood by HTTP/SOCKS proxy and send that to the proxy you told it to use. Maybe the capture part is a bit different (creating a new network interface, ask Windows to send the traffic their, reconstruct the stream from raw tcp packets, wrap the data). This is often called transparent proxy as the client doesn't know a proxy is used, some call it an intercepting proxy instead. And we can have something similar, moproxy is an example (probably not the only one)

            Source https://stackoverflow.com/questions/71709157

            QUESTION

            Setting proxies when crawling websites with Python
            Asked 2022-Mar-12 at 18:30

            I want to set proxies to my crawler. I'm using requests module and Beautiful Soup. I have found a list of API links that provide free proxies with 4 types of protocols.

            All proxies with 3/4 protocols work (HTTP, SOCKS4, SOCKS5) except one, and thats proxies with HTTPS protocol. This is my code:

            ...

            ANSWER

            Answered 2021-Sep-17 at 16:08

            I did some research on the topic and now I'm confused why you want a proxy for HTTPS.

            While it is understandable to want a proxy for HTTP, (HTTP is unencrypted) HTTPS is secure.

            Could it be possible your proxy is not connecting because you don't need one?

            I am not a proxy expert, so I apologize if I'm putting out something completely stupid.

            I don't want to leave you completely empty-handed though. If you are looking for complete privacy, I would suggest a VPN. Both Windscribe and RiseUpVPN are free and encrypt all your data on your computer. (The desktop version, not the browser extension.)

            While this is not a fully automated process, it is still very effective.

            Source https://stackoverflow.com/questions/69064792

            QUESTION

            Failed to connect to shadowsocks client
            Asked 2022-Feb-07 at 17:10

            I've configured shadowsocks system by running ss-server on VPS and ss-local on my client machine. Then I made a simple SOCKS5 client which connects to ss-local and resolve SOCKS request using C. All work well, when I run ss-tunnel instead of ss-local, my SOCKS5 client can't connect to ss-tunnel.

            TCP connection terminates as soon as it established. I'm not sure what is the proper reason.

            ...

            ANSWER

            Answered 2022-Feb-07 at 17:10

            ss-tunnel establishes a complete tunnel with ss-server, all traffic to ss-tunnel is directly relayed to ss-server without any SOCKS request/resolve processes. After I've removed SOCKS handshake in my client program, it worked properly.

            Source https://stackoverflow.com/questions/70994692

            QUESTION

            HTTPS over Socks5 server implementation
            Asked 2022-Jan-01 at 04:00

            I am trying to implement a Socks5 server that could relay both HTTP and HTTPS traffic.

            As the RFC1928 mentions, the following steps to establish a connection and forward the data must be taken :

            1. Client sends a greeting message to the proxy.
            2. Client & proxy authentication (assuming it is successful).
            3. Client sends a request to the proxy to connect to the destination.
            4. The proxy connects to the destination and sends back a response to the client to indicate a successful open tunnel.
            5. The proxy reads the data from the client and forwards it to the destination.
            6. The proxy reads the data from the destination and forwards it to the client.

            So far, the proxy works as it should. It is able to relay HTTP traffic using its basic data forwarding mechanism. However, any request from the client to an HTTPS website will be aborted because of SSL/TLS encryption.

            Is there another sequence/steps that should be followed to be able to handle SSL/TLS (HTTPS) traffic?

            ...

            ANSWER

            Answered 2022-Jan-01 at 04:00

            The sequence you have described is correct, even for HTTPS. When the client wants to send a request to an HTTPS server through a proxy, it will request the proxy to connect to the target server's HTTPS port, and then once the tunnel is established, the client will negotiate a TLS handshake with the target server, then send an (encrypted) HTTP request and receive an (encrypted) HTTP response. The tunnel is just a passthrough of raw bytes, the proxy has no concept of any encryption between the client and server. It doesn't care what the bytes represent, its job is just to pass them along as-is.

            Source https://stackoverflow.com/questions/70546537

            QUESTION

            How SOCKS5 infers the destination port within SSH dynamic forwarding?
            Asked 2021-Dec-31 at 17:54

            When using local forwarding we are free to pick destination port:

            ssh -L 8000:10.10.1.11:80 user@192.168.56.102 - 80 is destination port - we explicitly specify which port to forward to.

            Take a look at diagram in this article. If I understand correctly, in dynamic forwarding destination port is somewhat implicit (?):

            ssh -D 8080 user@192.168.56.102 - 8080 is local host port, but still it somehow forwards to 80 for us.

            Questions:

            • How SOCKS5 proxy knows which port to forward traffic to?
            • Does SOCKS5 proxy somehow sniff destination from the protocol of the traffic it proxies?
            • Can that destination port be configured?
            • Where is it configured - on my local machine, or remote that does final forwarding for us? Nowhere?
            • Is it a predefined fixed set of protocols/ports? Smth like http=80 destination port?
            • Any other internal details of forwarding you can add to clarify the picture.

            thanks.

            PS. Here https://unix.stackexchange.com/questions/213213/difference-between-local-port-forwarding-and-dynamic-port-forwarding#comment401063_213219 i found some hint to what i'm interested in, pity there are no details provided...

            ...

            ANSWER

            Answered 2021-Dec-31 at 17:54

            SSH and SOCKS are two completely different and unrelated protocols. But, to answer your questions:

            How SOCKS5 proxy knows which port to forward traffic to?

            A SOCKS client explicitly tells it where to connect. The destination host/ip and port are input fields in the SOCKS CONNECT command. So, there is no guessing/infering at all.

            Does SOCKS5 proxy somehow sniff destination from the protocol of the traffic it proxies?

            No. SOCKS is just a tunnel of raw bytes, it has no concept of protocols beyond its own.

            Can that destination port be configured?

            Not on the proxy itself, no. Since the client decides where to connect, any configuration would be on the client side.

            Is it a predefined fixed set of protocols/ports? Smth like http=80 destination port?

            No.

            Any other internal details of forwarding you can add to clarify the picture.

            Read the SOCKS protocol specs.

            SOCKS v4: https://www.openssh.com/txt/socks4.protocol

            SOCKS v4a: https://www.openssh.com/txt/socks4a.protocol

            SOCKS v5: https://datatracker.ietf.org/doc/html/rfc1928

            Source https://stackoverflow.com/questions/70527985

            QUESTION

            Expose client behind NAT to internet by using a public reverse-proxy (with access to the internet)
            Asked 2021-Dec-14 at 23:32

            I want to understand the theory of exposing clients behind NATs via a public server, for example to use the client as a proxy (preferably SOCKS5). It would be ideal to find a ready solution but theory would good enough.

            To point out what I mean. The client behind the NAT does not directly listen on TCP. It just opens up a TCP connection to the public server which should expose the client. The SOCKS5 proxy on client behind NAT is not directly exposed so the dialed TCP connection should somehow behave like a TCP listener.

            If a client behind NAT connects to a public server, how do other users connect and how should I forward the requests?

            I think basically it's the same technique that TeamViewer is using:

            "When establishing a session, TeamViewer determines the optimal type of connection. After the handshake through our master servers, a direct connection via UDP or TCP is established in 70% of all cases (even behind standard gateways, NATs and firewalls). The rest of the connections are routed through our highly redundant router network via TCP or https tunneling. You do not have to open any ports in order to work with TeamViewer."

            But how exactly?

            ...

            ANSWER

            Answered 2021-Dec-14 at 23:32

            To summarize, for a proxy server in golang, you have to

            1. Create a server that listens to requests with some parameters.
            2. When a request is received, it will make the request to the desired address.
            3. Then it will return the response to the original client in the private network.

            Source https://stackoverflow.com/questions/70356041

            QUESTION

            Why socks5 UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates?
            Asked 2021-Dec-14 at 09:40

            As socks5 rfc says,

            A UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates.

            I wonder, doesn't "the TCP connection that the UDP ASSOCIATE request arrived on" just terminate when it timeouts? As there is no more data need to be sent in that TCP connection.

            Should the client send meaningless data in that TCP connection just to keep it alive while it need the UDP association?

            ...

            ANSWER

            Answered 2021-Dec-14 at 09:40

            I wonder, doesn't "the TCP connection that the UDP ASSOCIATE request arrived on" just terminate when it timeouts?

            No. The TCP connection is kept alive as a signal that the proxied UDP socket is still valid. Without it, the client has no way of knowing whether the server is still reachable or whether the UDP socket is still allocated.

            Similarly, without the TCP connection the server has no other way of knowing whether the client is still connected.

            Should the client send meaningless data in that TCP connection just to keep it alive while it need the UDP association?

            There's no need to send meaningless data. Just keep the connection alive. TCP has a built-in keepalive mechanism which can be turned on.

            Edit: It's worth pointing out that the default TCP keepalive times on both Linux and Windows is fairly long. See this question on ways of tweaking it for specific sockets.

            Source https://stackoverflow.com/questions/70331639

            QUESTION

            Connecting a proxy to a Python script using the Telethon module
            Asked 2021-Dec-14 at 07:38

            I need to get the proxy from the proxy.txt file:

            ...

            ANSWER

            Answered 2021-Dec-14 at 07:38

            Not sure about HTTP proxy or others, but you can use MTPROTO proxy with super ease:

            Source https://stackoverflow.com/questions/70335584

            QUESTION

            Find a p tag with a partial string using beautifulsoup, and extract the integer in the string of the p tag that follows
            Asked 2021-Dec-11 at 16:53

            Trying to build an iteration that goes through weblinks in order to extract the integer that is in the p tag that follows the p tag that contains the words "AGGREGATE AMOUNT BENEFICIALLY OWNED BY EACH REPORTING PERSON". The target pages have close enough patterns but are not identical. That AGGREGATE AMOUNT sentence is not formatted identically (sometimes capitalized, sometimes not, and spacing might not be identical). I included 3 examples below on the section I am trying to extract the integer value from.

            Below are the steps I am trying to achieve:

            1-Iterate through links Some links: https://www.sec.gov/Archives//edgar/data/29669/000119312521353247/d228949dsc13da.htm https://www.sec.gov/Archives//edgar/data/1482018/000119312521353071/d258656dsc13d.htm https://www.sec.gov/Archives//edgar/data/1590854/000119312521353064/d210475dsc13d.htm https://www.sec.gov/Archives//edgar/data/1021944/000119312521353050/d243715dsc13g.htm https://www.sec.gov/Archives//edgar/data/1609492/000119312521353003/d251372dsc13da.htm ...

            2-Find p tag that contains partial words "AGGREGATE AMOUNT BENEFICIALLY", which can be small caps , titled, or all caps

              Aggregate Amount Beneficially Owned by Each Reporting Person:

            3-Once the p tag found, continue to look in the following p tags until we get to the first p tag where the string (if exists), stripped of its commas is an integer (not empty).This can be the immediate p tag that follows, or the one after as in the code below.

            10,927,100*

            10,927,100 is the number I need, although it needs to be stripped from its commas (I know we can use the code below), but the string needs to be stripped from any other characters that are not numbers as well... int(shares.replace(',', '')

            example1:

            ...

            ANSWER

            Answered 2021-Dec-11 at 15:07

            You should be able to adapt this. The pages you're visiting are very plain HTML (no Javascript) so it's very simple and efficient just to process the page in a simple loop.

            What happens here is that we look for a p tag with text matching "AGGREGATE AMOUNT BENEFICIALLY OWNED BY EACH REPORTING PERSON" in a case-insensitive manner. If we find that, we set a flag. Then on subsequent iterations of the p tags found by BeautifulSoup, we look for text that is a) not empty and b) contains a sequence of digits (ignoring commas).

            And so on...

            Source https://stackoverflow.com/questions/70315876

            QUESTION

            Is there a native support for proxy connection via socks5 for boost::asio?
            Asked 2021-Oct-30 at 19:44

            I'm using boost::asio to handle network communication between my program and remote server. To establish a connection with a server I do the following sequence of operations:

            ...

            ANSWER

            Answered 2021-Oct-30 at 19:36

            I went ahead with the finger exercise and implemented socks5.hpp like I did before for socks4: socks4 with asynchronous boost::asio

            Without further ado:

            Source https://stackoverflow.com/questions/69778112

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install socks5

            Build from source on Ubuntu 16.04:.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/senlinzhan/socks5.git

          • CLI

            gh repo clone senlinzhan/socks5

          • sshUrl

            git@github.com:senlinzhan/socks5.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Proxy Libraries

            frp

            by fatedier

            shadowsocks-windows

            by shadowsocks

            v2ray-core

            by v2ray

            caddy

            by caddyserver

            XX-Net

            by XX-net

            Try Top Libraries by senlinzhan

            mystl

            by senlinzhanC++

            dpool

            by senlinzhanC++

            envoy-examples

            by senlinzhanPython

            requests

            by senlinzhanC++

            code-for-blog

            by senlinzhanC++