Remote Exploit Forums

Go Back   Remote Exploit Forums > Specialist Topics > Programming


Programming A place for our community to discuss their own security related coding projects.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2009, 03:42 PM
Virchanza's Avatar
Senior Member
 
Join Date: Sep 2008
Location: I am not living
Posts: 708
Default Idea for a program: UPnP

I dunno if this program would be really useful, but I think it'd be fun to write and it'd keep my programming skills sharp

Anyway, lately we've been talking about the UPnP protocol which is used by some routers. Basically you can send a request to the router to ask it what ports it is forwarding, and it will reply with a list, e.g.:
TCP port 80 on the WAN goes to TCP port 80 on LAN computer 10.10.10.5.
TCP port 443 on the WAN goes to TCP port 80 on LAN computer 10.10.10.18.


Also you can use this protocol to send requests to forward new ports, or to cancel any port forwarding that's already in place.

I think it'd be really neat to make a tiny little Linux program out of it, something like:

Code:
root@bt:~# portfwd --list
Sending request to router... timeout in 5 seconds...
Router response as follows:

WAN Port        goes to        LAN IP address        LAN Port
-------                        ----------------       -----------
TCP 80                          10.10.10.5             TCP 80
UDP 21                          10.10.10.2             UDP 22
TCP 443                         10.10.10.7             TCP 80

root@bt:~# portfwd --add TCP80 10.10.10.9 TCP81
Sending request to router... timeout in 5 seconds...
Request successful, requested port forwarding has been enabled.

root@bt:~# portfwd --del TCP80
Sending request to router... timeout in 5 seconds...
Request successful, requested port forwarding has been disabled.
Does anyone know of any other little project that does this? I've been searching the net for a little while but I've only found server applications, server libraries and server source code. I've yet to see any client applications like what I'm suggesting.

If you've ever used M$ WinXP, you might have noticed in the system tray in the bottom right corner, that sometimes an icon appears for your network connection saying something like "Intelligent Gateway Device detected on the network". As far as I know, this means it's found a router on the LAN that support UPnP.
__________________
Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".

Last edited by Virchanza; 06-29-2009 at 03:48 PM.
Reply With Quote
  #2 (permalink)  
Old 06-30-2009, 12:27 PM
Senior Member
 
Join Date: Jun 2008
Posts: 354
Default

Hope it helps, could never get the program to work

RapidShare: Easy Filehosting
Reply With Quote
  #3 (permalink)  
Old 07-03-2009, 04:47 PM
Virchanza's Avatar
Senior Member
 
Join Date: Sep 2008
Location: I am not living
Posts: 708
Default

I spent some time searching the web for the specifics of the UPnP protocol, i.e. what kind of packet I have to send to open a port, but couldn't find anything.

There's already a graphical M$Windoze program available for doing this, so I'm gonna boot into WinXP, open up Wireshark, and then run the UPnP program. I'll keep Wireshark running as I open ports, close ports, query which ports are currently forwarded. I'm gonna save the frames I capture and copy them across to Linux, then boot back into Linux and work on writing the frames in C code
__________________
Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".
Reply With Quote
  #4 (permalink)  
Old 07-03-2009, 05:15 PM
Gitsnik's Avatar
Senior Member
 
Join Date: Jun 2009
Location: The Crystal Wind
Posts: 458
Default

I bookmarked this for you the other day when I was searching for something else, but promptly forgot about it.

Anyhow, there was a project: miniupnp.tuxfamily.org (not sure if I can paste url's yet)

But it only works with certain types of UPnP devices. Still, it might be a good place for you to start.

Also make sure you make note of the wiresharp dump to C format option, it is infinitely useful for this sort of thing. (There is also perlupnp which I believe is hosted on sourceforge).
__________________
Never underestimate the power of human stupidity - it is like a force of nature, capable of destroying even the most well laid plans.

Don't trust any code I lay before you - if you don't know what it means, pull it apart before you run it - you never know what might happen.
Reply With Quote
  #5 (permalink)  
Old 07-03-2009, 07:33 PM
Virchanza's Avatar
Senior Member
 
Join Date: Sep 2008
Location: I am not living
Posts: 708
Default

Quote:
Originally Posted by Gitsnik View Post
I bookmarked this for you the other day when I was searching for something else, but promptly forgot about it.

Anyhow, there was a project: miniupnp.tuxfamily.org
That's fantastic thanks, I'm looking over it now. I've downloaded the source code for the Client program, gonna have a look over it tomorrow.

Quote:
Also make sure you make note of the wiresharp dump to C format option, it is infinitely useful for this sort of thing.
I've only learned of this function now! I'd no idea you could make it produce C code!
__________________
Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".
Reply With Quote
  #6 (permalink)  
Old 07-03-2009, 08:30 PM
Junior Member
 
Join Date: Jun 2009
Location: brazil
Posts: 8
Default

I liked the idea.
You know, I really like python. So I have to suggest:
brisa.garage.maemo.org
It is a UPnP framework for python.

Last edited by enonym; 07-03-2009 at 08:57 PM.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:29 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2