Screen Scraping Questions

N

Nick

I need to write a VB.NET application for the network team at work that will
backup a firewall configuration each evening. I found that I may need screen
scraping to do this, but am not quite sure how to go about it as I have never
done it before.

The web login page is at https://firewall/auth.html and contains a form that
looks like: <form name="standardPass" onSubmit="return(processButn());"
action="auth.cgi" method="POST" target="authTgtFrm">

The certificate on the login page isn't trusted as it is self signed. I
have used the following to get around it.

I call this from my console app:

ServicePointManager.ServerCertificateValidationCallback = New
RemoteCertificateValidationCallback(AddressOf
CertificateHandler.ValidateServerCertificate)

Which uses this class:

Imports System
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates

Public Class CertificateHandler

Public Shared Function ValidateServerCertificate(ByVal sender As Object,
ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal
sslPolicyErrors As SslPolicyErrors) As Boolean
Return True
End Function

End Class

The two input boxes in question on the auth page are named userName and pwd.
If the login is successful I get redirected to http://firewall/main.html.
From there I need to download the configuration http://firewall/config.bin.

Does anyone have an idea how I can go about this?
 
A

alex

I need to write a VB.NET application for the network team at work that will
backup a firewall configuration each evening.  I found that I may need screenscrapingto do this, but am not quite sure how to go about it as I have never
done it before.

Theweblogin page is athttps://firewall/auth.htmland contains a form that
looks like: <form name="standardPass" onSubmit="return(processButn());"
action="auth.cgi" method="POST" target="authTgtFrm">

The certificate on the login page isn't trusted as it is self signed.  I
have used the following to get around it.

I call this from my console app:

ServicePointManager.ServerCertificateValidationCallback = New
RemoteCertificateValidationCallback(AddressOf
CertificateHandler.ValidateServerCertificate)

Which uses this class:

Imports System
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates

Public Class CertificateHandler

    Public Shared Function ValidateServerCertificate(ByVal sender As Object,
ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal
sslPolicyErrors As SslPolicyErrors) As Boolean
        Return True
    End Function

End Class

The two input boxes in question on the auth page are named userName and pwd.
 If the login is successful I get redirected tohttp://firewall/main.html..  
From there I need to download the configurationhttp://firewall/config.bin.

Does anyone have an idea how I can go about this?

You can also try SWExplorerAutomation from http://webius.net/ to
record and generate VB.NET automation/scrapping code.
 

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

Top