Page 2 of 2 First 12
  • Jump to page:
    #16
  1. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Ok all done, dont ask me what exacly was wrong with it.

    I generally went though and tidied it up; i did remove alot of unwanted file() calls which could have something to do with it. I also changed shutil.copy() to shutil.copyfile() but i dout that was the problem.

    Code:
    import urllib, httplib, filecmp, os, shutil
    
    params = urllib.urlencode({'R':'yes','D':'MH'})
    
    h = httplib.HTTP('securityresponse.symantec.com:80')
    h.putrequest('POST', '/avcenter/cgi-bin/updates_msa.cgi')
    h.putheader('Content-length', '%d' % len(params))
    h.putheader('Accept', 'text/plain')
    h.putheader('Host', 'securityresponse.symantec.com')
    h.endheaders()
    h.send(params)
    
    reply, msg, hdrs = h.getreply()
    
    print reply 
    
    data = h.getfile().read()
    
    file('NIDS.html','w').write(data)
    
    print 'Grabbed the HTML and wrote the file.'
    
    match = filecmp.cmp('NIDS.html', 'NIDS_Original.html')
    
    if match == False:  
        shutil.copyfile('NIDS.html', 'c:\\documents and settings\\all users\\desktop\\ALERT Symantec Page Changed.html')
        shutil.copyfile('NIDS.html', 'NIDS_Original.html')
        
        print 'FALSE:  Copied NIDS.html to ALERT on the desktop.'
    else:
    	print 'TRUE:  Deleted the temp file NIDS.html.'
    	
    	os.remove('NIDS.html')
    Anyway test it out and let me know if it works for you .

    Mark.
    programming language development: www.netytan.com Hula

  2. #17
  3. Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    23
    Rep Power
    0
    The page I'm trying to recieve is the Symantec Security Updates page. But before that page will load you have to submit yes to a cgi form. I've grabed the actual POST data of a network capture and found that what is actually submitted to the cgi script is:

    D=MH&R=yes

    Which I think is something like device=manhunt and return=yes. The cgi is actually looking to make sure that you have a support contract and forces you to answer yes to get to the updates page.

    To start off with I have a file called HIDS.html in the directory that I keep that app in which is a copy of the file returned once you submit the data to the cgi script.

    The python app runs and then compares the results to the old HIDS.html file.

    -Rick
  4. #18
  5. Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    23
    Rep Power
    0
    Originally posted by netytan
    Ok all done, dont ask me what exacly was wrong with it.

    I generally went though and tidied it up; i did remove alot of unwanted file() calls which could have something to do with it. I also changed shutil.copy() to shutil.copyfile() but i dout that was the problem.
    Thanks Mark, that works.

    I've been going over it and comparing the differences between it and my code.

    Thanks. I have another script to write that performs the same type of function... hopefully I can get that one done myself.

    Thanks again!

    -Rick
  6. #19
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    No problem Rick, if not then give us a post. Anyway you should luck into sending data by get. Most CGI scripts dont care which method you use and GET is alot easier to use.

    Mark.
    programming language development: www.netytan.com Hula

Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo