Linksys Router & Python

B

Brad Tilley

Probably a stupid question, but here goes:

Is there any way to get a scaled down version of Python onto a Linksys
Wireless router? Are there any projects out there that are doing this?
I've googled around a bit, but didn't find much. I want to keep the
router's software as it is, but I also would like to have some scripting
abilities on it as well (like email the router's IP addy every x hours),
etc.

I have scripts that run on my computers that do this sort of thing.

def url_open():
""" Function that gets and returns the IP addy
of my Linksys BEFW11S4 Wireless DSL router."""
import urllib, re
ip = re.compile ('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
f = urllib.urlopen("http://user:[email protected]/RouterStatus.htm")
data = f.read()
f.close()
routerip = ip.findall(data)
print routerip[0]
return routerip[0]

But, when I leave town for vacation, I don't like leaving a computer
running. If I could get the interpreter embedded in the device itself,
then that would solve the problem.

This is probably a shot in the dark, but I thought I'd ask.

Thanks,
Brad
 
J

Josiah Carlson

Brad Tilley said:
Probably a stupid question, but here goes:

Is there any way to get a scaled down version of Python onto a Linksys
Wireless router? Are there any projects out there that are doing this?
I've googled around a bit, but didn't find much. I want to keep the
router's software as it is, but I also would like to have some scripting
abilities on it as well (like email the router's IP addy every x hours),
etc.

Some linksys routers offer support for dynamic hostnames via no-ip.org
or dyndns.org. That is, they connect to the dynamic dns server, tell it
"hey, I'm now ip address ...", and within about 5-10 minutes, the rest
of the world knows it.

- Josiah
 
C

Cliff Wells

Some linksys routers offer support for dynamic hostnames via no-ip.org
or dyndns.org. That is, they connect to the dynamic dns server, tell it
"hey, I'm now ip address ...", and within about 5-10 minutes, the rest
of the world knows it.

There's also a plethora of scripts (several of them in Python) that do
the equivalent. dyndns.org has a listing of many of them.

Regards,
Cliff
 
P

paul koelle

Brad said:
Probably a stupid question, but here goes:
Not stupid but nevertheless I'll try to restate ;):

Has anyone heard of a (probably stipped down) MIPS version of the python
interpreter which may run on openwrt? I'd hate to write scripts in "ash".

Thanks
Paul
 
F

Frithiof Andreas Jensen

Is there any way to get a scaled down version of Python onto a Linksys
Wireless router? Are there any projects out there that are doing this?

Probably - There are some Linux + development tools for the LinkSys WRT54G
router.
http://www.pbs.org/cringely/pulpit/pulpit20040527.html
http://www.i-hacked.com/Computer_Components/Networking/Linksys_WRT54G_and_WRT54GS_Hacking.html

Maybe the devices are somewhat identical:
http://www.batbox.org/nslu2-linux.html
I've googled around a bit, but didn't find much. I want to keep the
router's software as it is, but I also would like to have some scripting
abilities on it as well (like email the router's IP addy every x hours),

Those requirements are mutually exclusive.
 
M

marcus

Brad said:
Probably a stupid question, but here goes:

Is there any way to get a scaled down version of Python onto a Linksys
Wireless router? Are there any projects out there that are doing this?
I've googled around a bit, but didn't find much. I want to keep the
router's software as it is, but I also would like to have some
scripting abilities on it as well (like email the router's IP addy
every x hours), etc.

I have scripts that run on my computers that do this sort of thing.

def url_open():
""" Function that gets and returns the IP addy
of my Linksys BEFW11S4 Wireless DSL router."""
import urllib, re
ip = re.compile ('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
f = urllib.urlopen("http://user:[email protected]/RouterStatus.htm")
data = f.read()
f.close()
routerip = ip.findall(data)
print routerip[0]
return routerip[0]

But, when I leave town for vacation, I don't like leaving a computer
running. If I could get the interpreter embedded in the device itself,
then that would solve the problem.

This is probably a shot in the dark, but I thought I'd ask.

Thanks,
Brad


Tim Gilbert has been attempting to cross-compile just such a beast
fairly recently, and may have had some success by now. Maybe you should
drop him a line:

http://skreak.com/wrt54g/python.php

Good luck :)
 
T

Tony C

BRad

Here's a one-liner way of getting your IP address, but you'd need a
shell
account on a webserver to get it.
I made a python CGI script, and had it print the IP address of the
client as HTML.

import os
print os.environ["REMOTE_ADDR"]

I don't show the code to to format the output as HTML, but that's
rpretty straightforward.

However, this would still require you to have your computer on while
you're away, which isn't your goal. But at least you don't have to
login to your router to get the info.

You can accomplish the same thing by running a python script to
www.myipaddress.com, and scraping the screen.

These are just another ways of getting your IP address.
I copied this from a post on CLP, so I can't take credit for it.
 
T

Tony C

Cliff

Can you provide the full URL to these scripts, or do you need an
account to get them ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top