EzDevInfo.com

socks-proxy interview questions

Top socks-proxy frequently asked interview questions

Multiple identities at the same time using TOR?

I am scraping some websites with curl and I am using Tor to avoid sending too many request with the same ip. The problem is that my app uses threads, so if I send the packet to change identity to the control port on one thread the identity change for all the other threads.

Is there a way I can use multiple identities with Tor?


Source: (StackOverflow)

Advertisements

What to do when the ISP seems to interrupt a SOCKS5 connection to a VPS?

I have a VPS and until now have been using a socks5 server on it.

The problem is that recently my ISP (I live in Iran) has figured out some way to interrupt it and I'm receiving the "blocked page" for websites which are censored even through the proxy service. I know in some way that the problem isn't with the VPS, it's located in Germany and when used with other ISPs there's no problem.

What is causing the problem? Isn't the socks5 connection secure? What are the alternatives?


Source: (StackOverflow)

Forcing all outgoing connections through proxies

How can I do this in Linux? It'd be nice if there was a way to transparently force connections through proxies rather than configure them individually for each program.


Source: (StackOverflow)

How can I trace a connection through a proxy server and/or a VPN?

Someone is continuously attacking my ftp servers. I observed the IPs he left, but running whois on all of them, I concluded that they are socks5 proxy servers. I even found the site where he is getting them (sockslist.net).

Can I somehow trace him through the proxy so I can get his real IP address and report it to his ISP?

Also, a friend of mine told me that the attacker might be using a VPN for protection, so I'd like to know if there is any way of tracing the connection through a VPN, as well.


Source: (StackOverflow)

How to route traffic from one subnet through a specific SOCKS proxy in other subnet?

Here is my network map:

      Internet
         |
         |
      Router (192.168.1.1)
         |
         |
      (192.168.1.100) (wireless)
      MacBook ( mac os x / windows 7 / ubuntu. It doesn't matter )
      (192.168.2.1) (wired)
         |
         |
      TargetComputer (192.168.2.2)

I want to route all traffic from TargetComputer 192.168.2.2 through socks proxy running on my macbook.

On target computer i can only change IP settings ( ip address, subnetmask, gateway, dns ).


Source: (StackOverflow)

Way to do DNS lookup through SOCKS5 proxy server

SOCKS5 supports UDP and thus DNS lookups. I'm looking for an application, or a command using standard system utilities, to do a single DNS lookup through a SOCKS5 proxy, and not connect to this address. As an example, here's fake dig command to demonstrate what I would want to do, if this switch existed:

dig --socks5 1.2.3.4:8080 @4.2.2.1 example.com

Answers that work on either Linux, Windows or OSX are accepted.


Source: (StackOverflow)

A software like Proxifier for linux?

is there any software similar to Proxifier in windows for linux that passes all of my traffic via SOCKSv4, SOCKSv5, HTTPS and etc.?


Source: (StackOverflow)

http proxy over ssh, not socks

The question is simple, but the answer is not :

ssh -D 8080 user@host

or

ssh -gCNf -D 8080 user@host

or

wathever with -D #

I need a kind of proxy that i can use with http_proxy variable, in an embedded device that doesn't support SOCKS.

What should i do?


Source: (StackOverflow)

How can I make sure all my Mac's TCP traffic goes through a SOCKS5 proxy?

I have a SOCKS proxy with a port.

How can I make my MAC use it? What settings do I change under network settings?


Source: (StackOverflow)

Sharing transparently proxied Internet connection with PS3

I am trying to play a Japanese karaoke game on a PS3 but the latency is just horrendous and downloading songs takes forever. One recommendation I got was to turn my laptop into a SOCKS proxy by logging in via OpenSSH to my friend's server in Japan.

[server]----(ssh tunnel)---[wlan0 < laptop > eth0]---[PS3]

So that's what I did:

ssh -ND 4711 login@friend.server

At that moment I tried reaching google.com from my laptop using Firefox (with SOCKS proxy settings) and I got redirected to google.co.jp. Great.

Then I wanted to connect my PS3 to my laptop via Ethernet.

I first assigned a static IP to eth0 with:

ip link set dev eth0 up
ip addr add 139.96.30.100/24 dev eth0

I then started a DHCP server on my laptop to give an IP to the PS3 with:

systemctl start dhcp4.service

And finally I enabled NAT with some iptables magic:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

I went to "Networks Settings" and tested the connection from my PS3 and nice, it seemed to work. I launched the web browser and google.com got redirected to google.fr. How stupid, I forgot to forward the connection to the right port.

After a lot of connection forwarding through iptables that didn't work I decided to try using a transparent proxy: redsocks. http://darkk.net.ru/redsocks/

After installation I modified /etc/redsocks.conf to suit my needs:

redsocks {
    local_ip=0.0.0.0; // documentation says: "use 0.0.0.0 if you want to listen on every interface"
    local_port=31388;
    ip=127.0.0.1;
    port=4711;
}

with the rest left out as it was in https://github.com/darkk/redsocks/blob/master/redsocks.conf.example

I used the basic redsocks.rules provided in the package I installed:

*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:REDSOCKS - [0:0]

# Redirect all output through redsocks
-A OUTPUT -p tcp -j REDSOCKS

# Whitelist LANs and some other reserved addresses.
# https://en.wikipedia.org/wiki/Reserved_IP_addresses#Reserved_IPv4_addresses
-A REDSOCKS -d 0.0.0.0/8 -j RETURN
-A REDSOCKS -d 10.0.0.0/8 -j RETURN
-A REDSOCKS -d 127.0.0.0/8 -j RETURN
-A REDSOCKS -d 169.254.0.0/16 -j RETURN
-A REDSOCKS -d 172.16.0.0/12 -j RETURN
-A REDSOCKS -d 192.168.0.0/16 -j RETURN
-A REDSOCKS -d 224.0.0.0/4 -j RETURN
-A REDSOCKS -d 240.0.0.0/4 -j RETURN

# Redirect everything else to redsocks port
-A REDSOCKS -p tcp -j REDIRECT --to-ports 31338

COMMIT

That allowed me to stop using the SOCKS proxy settings on Firefox and luakit which I confirmed with the google.com turning into google.co.jp test.

I figured I still had to enable NAT so I redid:

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

The PS3 apparently bypassed the system-wide proxy and google.com got redirected to google.fr. I then used the redsocks.rules file as it was without masquerading. I believed that anyway I wouldn't need NAT since the redsocks server apparently listens on every interface.

I tried connecting the PS3 again and I got the following message (after the PS3 acquired an IP from my DHCP server and failed at getting an internet connection):

"An error occured during communication with the server. This is a DNS error."

That's where I am right now. I guess it might be a problem with redsocks though, since it uses a DNS server called dnstc which does this according to the documentation:

dnstc {
    // fake and really dumb DNS server that returns "truncated answer" to
    // every query via UDP, RFC-compliant resolver should repeat same query
    // via TCP in this case.
    local_ip = 127.0.0.1;
    local_port = 5300;
}

My wild guess is that my PS3 requests DNS resolution via UDP and that dnstc replies with "truncated answer" all the time. If I understand correctly, it should resend the request through TCP but apparently it produces a DNS error instead??

What should I do? Or more precisely:

  • Is redsocks unnecessary? Am I just iptables-illiterate?
  • Should I install a DNS server and forward the DNS requests? If so, how?

Thanks for reading that wall-of-text! Hope it doesn't suck too much for a first question...


Source: (StackOverflow)

SSH as socks proxy through multiple hosts

Can the following be achieved with SSH.

There are three machines involved:

A. My local machine at home
B. The SSH gateway server at school
C. A workstation in a lab, only reachable through B

I want to setup a SOCKS proxy. I want to be able to surf on my local computer at home, like I am in the lab. This is due some sites that are only reachable from the school's public ip.

So I want to run a SOCKS proxy on host C. But I do not manage to make it work from host A.

I connect to the gateway and from the gateway I connect to the workstation. But I can't make the gateway transfer the traffic properly from and to the proxy.

How can I do this?


Source: (StackOverflow)

OpenVPN vs. SOCKS proxy

I've been trying to set up a secure connection over which I can browse the internet, and it seems like there are two options, and SSH SOCKS proxy or OpenVPN (at least, those two are what I have found, but I'm certainly no expert.)

the SSH SOCKS proxy is really easy to setup - literally just ssh -D {port} -i {key} user@host.

My question is -- what are the advantages of OpenVPN over a SSH SOCKs proxy? It seems like such a pain to set up compared to the SOCKS proxy. Is OpenVPN faster? Is it more secure? (I don't think so, at least according to this post)


Source: (StackOverflow)

How to tunnel HTTP over SSH via SOCKS?

This should be a simple issue to solve, but for some reason it's not working for me.

ssh vps works just fine (I use authentication keys)

I set up the tunnel with the command:

ssh -C2TNv -D 8080 vps

I then modify Firefox network settings:

  • manual config
    • http proxy: localhost, port: 8080
    • use this proxy server for all protocols
    • SOCKS v5
  • about:config
    • network.proxy.socks_remote_dns: true

Terminal output:

$ ssh -C2TNv -D 8080 vps
OpenSSH_6.0p1, OpenSSL 1.0.1a 19 Apr 2012
debug1: Reading configuration data /home/ting/.ssh/config
debug1: /home/ting/.ssh/config line 47: Applying options for vps
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to vps.server.com [1.1.1.1] port 22.
debug1: Connection established.
debug1: identity file /home/ting/.ssh/id_rsa type 1
debug1: identity file /home/ting/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 zlib@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5 zlib@openssh.com
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA <removed>
debug1: Host 'vps.server.com' is known and matches the RSA host key.
debug1: Found key in /home/ting/.ssh/known_hosts:10
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ting/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).
Authenticated to vps.server.com ([1.1.1.1]:22).
debug1: Local connections to LOCALHOST:8080 forwarded to remote address socks:0
debug1: Local forwarding listening on ::1 port 8080.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 8080.
debug1: channel 1: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

I then try visiting a site using Firefox, SSH output:

debug1: Connection to port 8080 forwarding to socks port 0 requested.
debug1: channel 2: new [dynamic-tcpip]
debug1: channel 2: free: dynamic-tcpip, nchannels 3
debug1: Connection to port 8080 forwarding to socks port 0 requested.
debug1: channel 2: new [dynamic-tcpip]
debug1: channel 2: free: dynamic-tcpip, nchannels 3

Despite the proxy seemingly working, visiting any site with Firefox just returns with the error "The connection was reset".


Source: (StackOverflow)

Redirect web traffic (SOCKS proxy) for a specific domain

I have YouTube blocked at my work because reasons.

I’m a scientist and I need YouTube because most of the conferences and talks that I’d like to see are available there. Yes, I actually need YouTube, for science.

I spoke to the network admin at my school here, but he's kind of hard to deal with and doesn’t understand any reasoning. He’s the kind of guy that thinks that the Internet somehow goes through fixed channels and ports and that it is actually possible to block stuff like access to YouTube.

Anyway, fortunately I have a dedicated server somewhere so I can ssh-proxy there like this:

ssh -D 5000 -CN myself@myserver

And then configure Firefox (yes, Firefox, because Chrome is lazy and just relies on OS X settings [yes, I'm on OS X]) to use a SOCKS5 proxy to that port and pretty much have all the Internet I want.

Since the Internet here is pretty cool I don’t have any noticeable latency or bandwith problems.

Thing is that my dedicated server charges me for the bandwidth and I have to turn everything off in order to download some big files (which I also need, because science). So, since I don’t want to be turning on and off this thing each time I want to see a youtube video, I’d like to somehow tell Firefox (or my computer) to just route youtube.com through the SOCKS5 proxy. I see that it can be easily done the other way around (i.e. send all traffic through the proxy if they are NOT for these domains), but I don’t know how the designers didn't thought of the opposite case.

Does someone know of a simple way to achieve this?


Source: (StackOverflow)