home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / linksys < prev    next >
Text File  |  2020-01-01  |  2KB  |  60 lines

  1. # get-linksys-addr.ksc
  2. # This script can be used with a Linksys Ethernet Cable/DSL Router 
  3. # to retrieve the IP address for use with Kerberos 5 authentication
  4. # when Network Address Translation (NAT) is enabled.
  5. #  by Frank da Cruz and Jeffrey Altman
  6. #
  7. # Version 1.0
  8.  
  9. if < \v(version) 800200 {
  10.   end 99 This script requires C-Kermit or Kermit 95 version 800200 or higher
  11. }
  12.  
  13. # define some default 
  14. local firewall fwuser fwpwd tempfile \%x addr
  15. define firewall 192.168.1.1             ; default value
  16. define fwuser                           ; default value
  17. define fwpwd    admin                   ; default value
  18. define tempfile \v(tempdir)linksys.htm
  19.  
  20. # Perform HTTP GET and place the Status HTML page into the tempfile
  21. http open \m(firewall)
  22. if failure end 1 Unable to connect to firewall
  23. http /user:\m(fwuser) /password:\m(fwpwd) get /Status.htm \m(tempfile)
  24. if failure end 2 Unable to access Status.htm: \v(http_code): \v(http_message)
  25. http close
  26.  
  27. # Read the contents of the tempfile into the data variable
  28. file open /binary /read \%x \m(tempfile)
  29. if failure end 3 FOPEN \m(tempfile): \f_errmsg()
  30. file read /size:\fsize(\m(tempfile)) \%x data
  31. file close \%x
  32.  
  33. # Delete the tempfile
  34. delete \m(tempfile)
  35.  
  36. # The IP Address of the Router is located in the HTML file
  37. # within a block defined by tags: <!--WAN head--> and <!--WAN tail-->
  38. # We extract the substr defined by the block
  39. .\%x := \findex(<!--WAN head-->,\m(data))
  40. if not \%x end 4 Header <!--WAN head--> not found
  41. .\%y := \findex(<!--WAN tail-->,\m(data),\%x)
  42. if not \%y end 5 Header <!--WAN tail--> not found
  43. .data := \fsubstr(\m(data),\%x,\%y-\%x+15)
  44.  
  45. # The IP Address is located after the string "IP Address:".
  46. # Find its location in the WAN block
  47. .\%x := \findex(IP Address:,\m(data))
  48. if not \%x end 6 IP Address tag not found
  49.  
  50. # Extract the IP Address
  51. .addr := \fipaddress(\m(data),\%x)
  52. if failure end 7 No ip address found
  53.  
  54. # Set the IP address of the Router to be used in Kerberos 5 tickets
  55. set auth k5 addresses \m(addr)
  56.  
  57. # Done
  58. end 0 Kerberos 5 address list set to: \m(addr)
  59.