Starting from:

$29.99

Implement a simple port forwarding & logging program

CPSC 526 - Assignment 2
In this assignment you are going to implement a simple port forwarding & logging program. This program could be used for many different purposes: debugging protocols, circumventing firewalls, or even as a base for man-in-the-middle applications. The program will be invoked with at least 3 arguments: ./proxy [logOptions] srcPort server dstPort where srcPort is the port on which your program will listen, server is the name or address of a remote server, and dstPort is the destination port on the remote server. Your program will listen on the given port for new connections. When a new connection is initiated, your program will open a socket to the remote server on the requested destination port. It will then relay all data from srcPort to the server’s dstPort, and vice versa. Your program will also log all data to standard output. The argument logOptions will control the format of the logged data: Option Description If no logging option is given, no data logging will happen. Your program should still output information about incoming connections though. -raw All data will be logged as is, i.e. assumed to be ascii. Make sure to label each line of text with outgoing or incoming prefix (see examples). -strip Similar to the -raw option, but only printable characters will be printed. Non-printable characters will be replaced with a dot ‘.’. Printable characters include whitespaces. -hex All data will be logged in a format identical to the output of the linux ‘hexdump -C’ utility. This is useful for binary-only communications. -autoN All data segments will be divided into N-byte long chunks, and each chunk will be displayed separately, on its own line. Each byte in the chunk will be displayed based on its value. If the byte is a backslash, tab, newline or carriage return, it’ll be reported in escaped form, i.e. ‘\\’, ‘\t’, ‘\n’ and ‘\r’ respectively. If the byte is in range 32..127, it

More products