Learning Python Network Programming

(Sean Pound) #1
Chapter 7
remote_bind_address=(REMOTE_HOST, REMOTE_PORT))

server.start()
print('Connect the remote service via local port: %s'
%server.local_bind_port)
# work with FTP SERVICE via the `server.local_bind_port.
try:
while True:
pass
except KeyboardInterrupt:
print("Exiting user user request.\n")
server.stop()

Let us capture the packet transfer from the local machine 192.168.0.102 to the
remote machine 192.168.0.101. You will see all network traffic is encrypted. When
you run the preceding script, you will get a local port number. Use the ftp command
to connect to that local port number:


$ ftp


If you run the preceding command, then you will get the following screenshot:


In the preceding screenshot, you cannot see any FTP traffic. As you can see, first we
connect to local port 5815 (see the first three packets) and suddenly an encrypted
session started with the remote host. You can continue watching the remote traffic,
but there is no trace of FTP.

Free download pdf