Frage

I was thinking about making an application that scrapes pages of my linksys router administration website. But since this is protected using a java login dialog I'm not able to get the webpage, look for elements (username, password) and then submit the data. Is there another way to do this?

Kind regards, Tobias

War es hilfreich?

Lösung

The following python code allowed me to extract the status page from my Linksys model WRT320N router:

import urllib2
from base64 import encodestring

LOGIN  = 'admin'
PASSWD = '<your router password>'
URL    = 'http://<router IP address>/Status_Router.asp'

url    = urllib2.Request(URL)
b64str = encodestring('%s:%s' % (LOGIN, PASSWD))[:-1]
url.add_header("Authorization", "Basic %s" % b64str)


f = urllib2.urlopen(url)
for line in f.readlines():
    print line,

f.close()

I was also able to do it with the "wget" utility using the user and password options.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top