This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

HTTP issue

Old posts that have not been replied to for several years.
Locked
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

HTTP issue

Post by ppslim »

I have managed to base even my work around eggdrop.

Some of my day to day jobs are done by a Tcl script. This includes obtaining router logs and so on.

Eggdrop will watch a specific file, and see when it's been updated.

It's contents are based on security messages, and other bits.

For the last part, I also wish to see if any of the router have fallen over, and let me know.

SNMP will tell me the routers system uptime, but it will not issue the uptime of a connection.

For this, I either have to parse the output from a telnet connection, or via a web-page.

The system returns 3 values for it's uptime. Time since last reboot, time since it last lost sync with the exchange and time that it's been authenticated to the ISP.

vaklues 2 & 3 usualy stay the same. When both reset, it means I lst connection. When 3 is lower than 2, it means there has been a stability issue. This is what I need to catch.

The web-interface to the router, uses HTTP Basic authentication to protect it. As such, I can't seem to get past it.

Using the http Tcl package, I have tried using

Code: Select all

-headers [list "Authorization" "Basic $base64"]
where $base64 is "user:pass" encoded. I have tried "user:pass", "user : pass" (note the spaces) combination to no avail.

Has any1 had any look with using the http package to navigate WWW-authenticate pages?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The header looks right. Are you sure the base64 encoding is correct?

Try looking in the server logs to see if there is a specific error.

One thing that may help is to set up a dummy server that accepts connections and just prints out exactly what is sent to it. Then you can see if the header is being sent correctly.

In tclsh:

Code: Select all

set vwaiter 0
proc newcon {sock ip port} {
  puts "connection from $ip:$port on $sock"
  fileevent $sock readable [list reader $sock]
  return 0
}

proc reader {sock} {
  set len [gets $sock line]
  if {$len < 0} {
    if {[eof $sock]} {
    global vwaiter
    incr vwaiter
    close $sock
    return 1
    }
    return 0
  }
  puts "sock $sock: $line"
  return 0
}

socket -server newcon 3141
vwait vwaiter
Then try your script connecting to localhost:3141 and see what is printed out.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

First things first - No I aint sure if the BASE64 is correct.

I used a basic converter on a web-page, as I was unable to find any other way to make the conversion.

My guess at this stage, may be the differance between protocol 1.0 and 1.1. A simple change of the package to send 1.1, didn't fix things.

Though more testing will be done later.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

1.0 supports basic auth too, no need to change it.

If you do want to change it, make sure you're sending the "Host: blah.com" header as well. A lot of servers require it.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

After some pratting about, including work on my firewall and the fact my router fails to re-direct traffic aimed at my public IP back into my network from a lan machine (this may also be a ISP issue), I finaly managed to get some output from your script.

However, I am gonna have to do some major work, including making it send fake headers back to the browser.

Output from the my script, showed that the header was sent, including the BASE64 encoded user:pass (I made a small PHP script in the end, just to send me it, it tunred out that I was using the correct encoding).

However, connecting MSIE to the script, refused to send the authenticate header.

I did notice that MSIE sent some changes like MIME types, which I changed in my script, it also sent the port (:3141) atteched to the host header. I changed http.tcl again, to send the port based on it's presense.

My guess was it required two connections, one seeking auth, the second making the auth. This also failed.

I am ready to bail, with the exception of sending a message to Zyxel regarding there non HTTP complient router.
Locked