Invisible UPnP proxy version 1.1 Authors: Martin Olsson molsson@csee.usf.edu and Jakob Klamra jklamra@csee.usf.edu This program allows UPnP devices to enter power sleep mode. The proxy can: * Make a discovery of the network and save all services that answer into a data structure. * Receive SSDP:alive from new devices on a network and add them to a data structure. * Spoof SSDP:alive for devices that have not sent any messages for a certain time. * Answer a discovery by spoofing HTTP OK for these devices. * Recieve and respond(spoof) ARP messages destined for a sleeping device. * Wake up the device using WOL when there is an incoming TCP connection for that device. * Remove devices from the datastructrure when SSDP:byebye is received. This program can only be run under Windows. The ZIP file containing the project also contains a special version of the netwib library. The version is 5.29.1. Netwib is a c library for network programming and it can be found at http://www.laurentconstantin.com/en/netw/netwib/ To compile this project Visual C++ or Dev C++ has to be used. (Tested with Visual C++ 6 and Dev C++ 4.9.9.2) Dev C++ is a visual tool for programming and it can be downloaded for free from http://www.bloodshed.net/devcpp.html. ================================================================================ Installation ******************************************************************************** Step 0 prequsites Make sure you have the lates version of WinPcap installed. The latest verson can be downloaded from: http://winpcap.polito.it/ ******************************************************************************** Step 1 Extract the zip file. Step 2 Copy netwib5291.dll to Windows\system32. Step 3 Before you run the program make sure that available UPnP devices have power sleep and WOL enabled. Also make sure that all firewalls are turned off. Step 4 Run the proxy. The exe file is available at Project\invproxy\invproxy.exe (Compiled with Dev C++) or Project\invproxy\invproxy\Debug\invproxy.exe (Compiled with Visual C++). Usage: proxy [ip address of proxy] [port of proxy] [minutes before start proxying] Example proxy 1.2.3.4 5678 2 Step 5 After running the program take a look at the buglist with known bugs (Project\invproxy\buglist.txt). ================================================================================ ================================================================================ Important files included in this project ******************************************************************************** Project\Readme.txt - This file Project\netwib5291.dll - The dll for the netwib library ******************************************************************************** Project\include\ - The source code of the netwib library ******************************************************************************** Project\invproxy\buglist.txt - The list of known bugs and comments to the program Project\invproxy\invproxy.dev - The Dev C++ project file Project\invproxy\invproxy.exe - Executable of the proxy compiled with Dev C++ Project\invproxy\proxy_funcs.h - Defines structures and functions used in the program. Project\invproxy\proxy.c - Main function for the program. Starts by making a discovery of the complete network. Sniffs packets and process them. ARP and discovery for sleeping devices are answered. SSDP:alive messages are added to the data structure. Incoming TCP connections to sleeping devices result in a WOL to the sleeping device. Project\invproxy\proxy_data.c - Functions used for the data structures The data structures are of type netwib_ring (linked lists) and the functions in this file are used to find, extract and delete items from the structure. Project\invproxy\proxy_updatecache.c - Functions used by threads to search the data structures. Check if it is time to start proxying for a device and if it is time to spoof SSDP:alive for a device we are proxying for. Project\invproxy\proxy_send.c - Functions for sending and spoofing messages such as SDDP:discover, SSDP:alive, HTTP OK, ARP and WOL. Project\invproxy\proxy_receive.c - Functions for receiving and parsing packets. There are functions for retrieveng SSDP headers from raw packets and a function for sniffing packets. Parsed packets are processed and services and devices are added to the data structure. ******************************************************************************** Project\invproxy\invproxy\invproxy.dsw - The Visual C++ workspace file Project\invproxy\invproxy\Debug\invproxy.exe - Executable of the proxy compiled with Visual C++ ******************************************************************************** Project\lib\netwib5291.lib - The netwib library file ================================================================================