How can I create a network proxy programming? - sockets

Excuse me. I speak poor English.
I am trying to create a network proxy programming with sock5 protocol. But I have no way to learn it, I can't figure out how a proxy programming works especially the followings:
What is the difference and association between socks5 and the Shadowsocks ?
Can I set a the network proxy configure in macOs instead of using swift or oc ?
such as enabling this check button(socks5 proxy) and filling the specific configure using a language instead of swift or oc:
configure
Once I set the option on macOs in the Question 2,what kind of data will the programming get if it listening the network?
e.g. will the macOs automatically forward the all new TCP connections to 127.0.0.1:1086 and automatically make the connections confirm to the socks5 request standard?
If so, why the final processing programming (transmit the datas to the real remote proxy-server) can make a successful connection? Instead of a forever loop(a.programming create a socket to remote proxy-server -> b. macOs automatically forward it to 127.0.0.1:1086 and make the connection confirm to the socks5 request standard -> a.)
Is it called as a proxy-client? or local proxy-server? what is the job of it. Why do I set a proxy address as a local one instead of a direct remote server?
Why when I setting a fake socks5 option in macOs network proxy options, a UDP programming can still work successfully?
If you can UNDERSTAND CHINESE:
Chinese language

The follow answers are based on my own experience and opinion.
1、socks5 is an Internet protocol that exchanges network packets between a client and server through a proxy server. Sockes
while Shadowsocks is a software use this protocol.
2 、Yes,you can. Install a Shaowsocks don't need any
Programming language, actually it like installing a EXE file on Windows or pkg on MacOS, it's just a software.
3、Socks5 is an Internet protocol like a language between two computer.
The software's message run on you computer will be "translated" by Shadowsocks.
Those translated message will be sent to the remote service (also run a Shadowsocks) then the service can send message to those "blocked" Webs' services.
4、The remote service can be called an proxy service.The local don't do anything except be "translated" by Shadowsocks. Look this picture.
5、The QQ don't use the port 1080, Shadowsocks need a fixed port to "translate" message.

Related

Remote.it and openVPN together

So this is a classic question that I’ve seen many times before...
I’m trying to connect to my home network when not at home using a raspberry pi.
I’m well aware that the way to go with this is to use a vpn server such as OpenVPN.
However, in order to connect to the vpn I would need to forward a port on my router... which I can’t do.
I’ve found remote.it which allows remote connection to a computer (pi) without port forwarding.
What I would like to know is how would I set about using the 2 together, I.e. connecting to remote.it which in turn connects me to my vpn server?
I'm sorry to be finding this question just now, but in case it's still useful to you or to anyone else, here's what you need to do:
Install remote.it
Set-up a remote.it connection to use the protocol (TCP/UDP) and port required by the VPN application
Make a remote.it connection/adding the service to your network (remoteit - Desktop application UI terminology)
Use this connection info (URL/port or localhost:port) with the VPN client
Send an e-mail to support#remote.it if you need help
I would recommend ZeroTier(https://www.zerotier.com/). It haves its own linux client , and you can connect to as many networks as you would like.
You can also configure IP address from the website.
There is also an Android an IOS app that is really simple to connect.

how to access client desktop and to control mouse using tcp/ip protocol from server machine

I'm working on project to develop an software using the TCP/IP protocol. The basic function of the software is to access the client activity running on client machine from server machine, for example information about current running applications.
Also, I want to access desktop screen and mouse from client machine to server machine using TCP/IP protocol. What are the basic steps that I can follow to access the desktop and could handle client mouse from server machine using TCP/IP.
It sounds like you want to build a VNC or RDP -like program. There have been an explosion of these services/programs in the time since you asked the question, though I don't know how many might be open source. I would start by investigating an Open Source VNC client and then see about adding an encrypted tunnel to keep the connection secure.
UltraVNC and TightVNC are popular Open Source VNC clients.

Bluetooth: how to create a socket for connecting to a service with specific UUID with Bluez?

I am working with the BlueZ libraries for managing the bluetooth stack under linux. I am trying to open a socket that should connect with a specific service whose UUID is known. I have successfully tried to open sockets between a server and a client following the examples here:
http://people.csail.mit.edu/albert/bluez-intro/c404.html
where it is also described how to explore services in a remote host; however, what I cannot figure out is how to specify the UUID while connecting the socket. This is something quite straightforward on other contexts, as it happens when using Android libraries; however, with BlueZ I haven't found examples on the web.
Thanks for the help!
Stefano
-- added some details in a reply... don't know if it's right or not; if not, sorry
thanks for your help!
In my post I said I wanted to connect a socket with a specified UUID since I had in mind a function like createRfcommSocketToServiceRecord as can be found in:
http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createRfcommSocketToServiceRecord%28java.util.UUID%29
which returns a socket given a certain UUID. I am developing two softwares, one being the client and the other the server, therefore it's a service I am creating, not a standard one. I publish such service on the server with a specified UUID, and I would like to connect to it from the client. The server is running fine, since with an android platform, exploiting the mentioned createRfcommSocketToServiceRecord method, I am able to connect to the server with the right service.
The example you posted is very clear as well, but unfortunately it is in Python, while (I forgot to point out) I am using Bluez as a C library. I am able to exploit the SDP and inspect services on a remote server; however, when it is the time of setting up the socket, I don't see how to specify the port. I thought about the rc_channel, but as far as I understood it is the bluetooth channel (ranging from 1 to 11 or something similar). Could you please point out Where I should be able to specify the port while creating the socket in the client? And where am I able to find the right port in the complex structure the sdp is dealing with? -- referred to:
http://people.csail.mit.edu/albert/bluez-intro/x604.html
Thanks again for the help!
You don't connect sockets by UUID. You use a socket to connect to remote device and browse its SDP to discover the UUIDs it offers, and map that to a socket port. Here's an example of this process using PyBluez, python wrappers above BlueZ
http://people.csail.mit.edu/albert/bluez-intro/x290.html

How to capture loopback traffic in Windows Server 2008

Setup:
I have client C connecting to server S
Both C and S are on the same machine
In C the server address is hardcoded to 127.0.0.1. Likewise, in S the client address is hardcoded to 127.0.0.1
Problem:
I want to be able to sniff the traffic between the client and the server.
Due to the configuration, I cannot move the client nor the server to different locations (the address are hardcoded)
Installing the loopback interface and using tools like Wireshark+WinPcap doesn't lead anywhere (was actually already known but was worth a try)
RawCap, suggested in another topic, doesn't work. IP 127.0.0.1 is listed, but does not record any traffic.
Using rinetd to route the traffic elsewhere, as suggested here doesn't work (cannot bind on 127.0.0.1)
Not interested in using a HTTP local proxy, such as Fiddler, because I'd like to capture also other protocols
Two commercial tools work, specifically CommView and Local Network Monitor, which means it must be possible to do that ;)
How can I do to capture the traffic?
Any pointer on functions I should use or documentation I should read?
Thanks!
Basically you need to write a TDI filter driver to achieve that... for some pointers see:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff565685%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff563317%28v=VS.85%29.aspx
Another option is to write a WinSock LSP.
BEWARE
Since Windows 8 it is strongly encouraged to use WFP (Windows Filtering Platform) for this sort of thing...
Although it might be more cost-effective to just use/buy an existing solution - esp. if you are not a very experienced driver developer...
Use RawCap, which can solve your concerns, see this

How to set up http server on iPhone behind firewall

I want to develop an iPhone app with a simple IM feature. I am thinking about setting up an HTTP server on an iPhone. If the iPhone is using wifi and is behind a firewall, how can I make sure that other iPhone clients can connect to it?
It's not the firewall that will disturb the connection as much it is the NAT.
When you are connected through wireless router to connect the internet you are surfing via NAT. it means you dont really have an extenral IP but once you initiate connection the router will map your intenral IP to one of his externatl ports and for certain time window he will pass connections to you if he will get it to the right port.
That being said, there is no actual way of setting a server behind a NAT unless you can configure port forwarding in the router and internal static IP.
Hope i was clear enough, good luck
I do not really think that you need to get an HTPP server up and running on iPhone to make an application that can send and receive messages (IM). The idea of making one iPhone user to directly connect to one another does not seem right to me since the users will need to know IP addresses of one another to do that.
Interconnectivity between different users of the chat can be solved by making your application communicate via a dedicated TCP port. It is generally advisable to choose ports with a number higher than 1024 since those below are generally found on the list of so-called well-known ports and are used for Web (like port 80), FTP (port 21), SSH (22), DNS (53), etc., it will be the responsibility of the user to make sure the port used by your application is open on the firewall. In order to solve this problem you can actually use port 80 for communication if you find that the port you have selected is blocked. You can do this because you know that this port will not be blocked in most cases. Indeed Yahoo Messenger is reported to use this technique when the firewall blocks the port it uses for communication.
The port should be used by your application to connect to the Web-server that will actually store user credentials, perform authentication, message transmission, etc., and the server should reside on capable hardware to be able to support large number of simultaneous connections. I can suggest using either a VPS (like the one provided by Linode) or a cloud (like Amazon EC2, Google Application Engine, Rackspace).