Jump to content
Sign in to follow this  

_INetGetSource Unable to Get Text

Recommended Posts


I've been trying to rewrite a script that was originally written in Python, and I'm nearly done. The only issue is the function to get the OU information from a web-database we have.

Here's the original Python scripting for this function:

url = 'https://glacier.gccaz.edu/hwdb/name.plx?nic='
regexp = re.compile("^CN=([^$]*)[$],(.*)")
regloc = re.compile("(GCC(Main|North))")

def getMacAddr():
    Gets all of the mac address from the computer and returns them as an array
    varMacList = []
    if varOS == 'Windows-XP':
        for line in os.popen('ipconfig /all'):
            if line.lstrip().startswith('Physical Address'):
                varMac = line.split(':')[1].strip()
                if len(varMac) == 17:
        for line in os.popen('/sbin/ifconfig'):
            if line.find('Ether') > -1:
                varMac = line.split()[4]
    return varMacList

def main():
    Main Function
    macList = getMacAddr()
    for entry in macList:
        print 'Trying %s' % entry
        varDataArray = urllib.urlopen(url + entry).read().split()
        if varDataArray:
            print 'Found %s' % entry
            data = regexp.findall(varDataArray[0])[0]
            dloc = regloc.findall(varDataArray[0])[0]
            varName = data[0]
            varOU = data[1]
            varCampus = dloc[0]
            print "varName is %s" % varName
            print "varOU is %s" % varOU
            print "varCampus is %s" % varCampus
            setComputerName(varName) # commented out for testing
            setCampus(varCampus) # commented out for testing
            setOU(varOU) # commented out for testing

The output of the URL should reads like this:


That's the full page. Source and all. There are no html markups.

So I've got the GetMACFromIP function here, and that works fine! I did alter it to have a dash (-) instead of a colon (:) for our URL checkup.

My testing code goes like this:

#include <GetMAC.au3>
#include <INet.au3>

$macAddr = _GetMACFromIP(@IPAddress1)
$url = "https://glacier.gccaz.edu/hwdb/name.plx?nic="
$ou = _INetGetSource($url & $macAddr)

MsgBox(0, "OU Info", $ou)

However, this does not return the information at all. I even went to the point of replacing the URL with other websites, and they work just fine, so it's not that the INetGetSource function is bad. I've gone to great lengths to test and retest in various degrees.

Share this post

Link to post
Share on other sites

Wait. Stop, nevermind.

Seems that our DNS was resolving to a different server when used in a web browser. _INetGetSource was not.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this