|
|
|||||||
I have seen some of the FTP posts, but none seem to be quite what I'm looking for. I want to be able to query the McAfee FTP/HTTP DAT sites to see if there is a newer DAT available. Only query, nothing else. The FTPGet() UDF actually retrieves the file, plus you need to know the name of the file to get. I would only know that the file will be something like "dat-XXXX.zip". Where XXXX is the DAT version. To determine whether it is newer I plan on comparing that to the DAT I currently have to see if it's newer. I was looking at the OS built in FTP, but it seems a bit cumbersome and I don't know if that FTP can return the exist or not exist to Kix. This could also be done using McAfee's HTTP site, but I'm not sure how that would be done either. I've toyed with the wget program, but again that will retrieve the file, which I don't want to do. Would it be easier if I just retrieved the file to a temp location and then do the compare? Or if anyone knows of a way to query without the retrieve I would greatly appreciate it. |
||||||||
|
|
|||||||
Strictly in terms of getting "better" information, would it be wiser to maybe read McAfee's delta.ini file here: http://speedownload.nai.com/Products/CommonUpdater/delta.ini that give this information: [Contents] LatestIncremental=621 Created=Mon Jan 2 04:40:00 2006 CurrentVersion=4665 amongst other things. Than maybe use Kixtart's ReadProfileString func to parse out the latest and greatest info. |
||||||||
|
|
|||||||
Thanks Shawn, didn't even know that location existed. I'll have to check my HTTP site again, but I think it's pointing somewhere else. So would you recommend pulling that down with wget or something similar and then making the comparison? |
||||||||
|
|
|||||||
Well FTP does not support an If Exist contruct directly. You might be able to do some listing to a temporary file and then parse the temporary file though. Here is something that works well on the Symantec site which I'm sure could be modified to work on McAfee's site if wanted. |
||||||||
|
|
|||||||
ja, ftpget seems to do the trick: Code:
|
||||||||
|
|
|||||||
Thanks for the posts. I think what I'm going to end up doing is using the FTPGet() UDF and picking up the delta.ini file that Shawn recommended. Then I'll do my compare. This process is only going to be used for notification and not the actual download. Thanks for the replies. And I see Shawn already replied with the FTPGet code that I will need. PS - I read a post about the FTPGet() showing up as VBS/Psyme (Trojan) and the auto-email from the boards I got at work was picked up by McAfee. Sure enough it was tossed into the quarantine. Heh, oh well. |
||||||||
|
|
|||||||
So where's the rest of the code solution |
||||||||
|
|
|||||||
cyri sounds like he knows what he's talking about. dont think he needs any hand-holding. |
||||||||
|
|
|||||||
ROFLMAO - Okay, be that way |
||||||||
|
|
|||||||
No size or date check needed for Symantec as they update every day - if wanted there is even one that is updated hourly but I think that's a bit overkill. |
||||||||
|
|
|||||||
Oh... don't forget an EXIT code - Shawn is bagging on me on MSN |
||||||||
|
|
|||||||
I am curious how he wants to use this new DAT info and why his approach is to use Kix to check for new DATs. |
||||||||
|
|
|||||||
Not sure. Doesn't McAfee update daily too? |
||||||||
|
|
|||||||
Well I see in one of the post above he mentions notification. But why? Does he not have ePO running on a schedule to update the DATs? Avert sends out new DAT notifications... |
||||||||
|
|
|||||||
What is the alert for? To tell you it did it, or that it failed? Not sure I'd like a page / e-mail every day for that. |
||||||||
|
|
|||||||
The notification I was talking about was an email that gets sent to my team. The script runs at 7am everyday to let us know that ePO has the latest DAT. It's a quick and easy way for those in my team that aren't as familiar with ePO to know if there is an issue with the DATs or not. Putting the why question aside. I do have a problem with the script. Here is my FTPGet command. Code: FTPget("ftp://ftp.mcafee.com/CommonUpdater/delta.ini","C:\delta.ini") When I check the C:\delta.ini file, it is not the current file. I browse to that location with IE and grab the file and it is the latest version. Here is the example of the contents of the delta.ini file. I'll give what FTPGet gives me and what browsing manually gives. FTPGet Version [Contents] LatestIncremental=621 Created=Mon Jan 2 04:40:00 2006 CurrentVersion=4665 Manually browsing via IE Version [Contents] LatestIncremental=626 Created=Mon Jan 9 04:40:00 2006 CurrentVersion=4670 Am I doing something wrong with the FTPGet command? |
||||||||
|
|
|||||||
Maybe check/set your IE cache setting. $IEKey='HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' $SetIECache=WriteValue($IEKey,'SyncMode5',3,REG_DWORD) |
||||||||
|
|
|||||||
This script is running with no logged on user as a scheduled task on a server. It has built in credentials in the task. Would this still apply? |
||||||||
|
|
|||||||
Well then perhaps it's using the Default User profile. Try modifying that one. HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings |
||||||||
|
|
|||||||
I think (personally) that you are running into IE cache issues, here is a snippet of knowledge base: Microsoft Internet Explorer Cache issues Internet Explorer implements caching for GET requests. Authors who are not familiar with HTTP caching expect GET requests not to be cached, or for the cache to be avoided as with the refresh button. In some situations, failing to circumvent caching is a bug. One solution to this is using POST request method, which is never cached, but is intended for non-idempotent operations. A solution using the GET request method is to include a unique querystring with each call, as shown in the example below. req.open("GET", "xmlprovider.php?hash=" + Math.random()); or set the Expires header to an old date in your script that generates the XML content. For PHP that would be header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // disable IE caching header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Pragma: no-cache" ); Alternatively, force the XMLHTTPRequest object to retrieve the content anyway by including this in the request: req.open("GET", "xmlprovider.php"); req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); req.send(null); The source link for above is here. Thinking maybe you could try this "GET request" work-around I highlighted in the first paragraph. Studying this more closely myself. |
||||||||
|
|
|||||||
to make a completely unique string per request, one should use time tags. example: $req.open("GET", "xmlprovider.php?hash=" + @date + @time) |
||||||||
|
|
|||||||
ja, cant test it much but it does seem to at least see past the hash-stuff, and download the file ... hopefully the most recent version ;0) FTPget("ftp://ftp.mcafee.com/CommonUpdater/delta.ini?hash=+@date + @time","e:\delta.ini") |
||||||||
|
|
|||||||
btw - anyone catch that fancy word in that quote above ... non-idempotent ... don't know wtf that means, sounds like some kind of medical condition I don't want to catch. |
||||||||
|
|
|||||||
I tried this code. Code: FTPget("ftp://ftp.mcafee.com/CommonUpdater/delta.ini?hash=+@date + @time","e:\delta.ini") But it's not downloading the file now. Am I missing something? |
||||||||
|
|
|||||||
nah, it was just a shot in the dark. |
||||||||
|
|
|||||||
Shawn : Wiki entry for idempotent |
||||||||
|
|
|||||||
Thanks cappy - I'm having a hard time even pro-nouncing that word, without like - spitting all over my monitor. Anyone want to comment / take a stab at writing a POST request version of FTPGet ? |
||||||||
|
|
|||||||
I'm still playing with this hash used in the first method (below). req.open("GET", "xmlprovider.php?hash=" + Math.random()); The third method (shown below) I tested and it still grabbed the old copy of the file. req.open("GET", "xmlprovider.php"); req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); req.send(null); As for attempting to write a modified UDF. I think thats a bit out of my skill range. I'm not familar enough with XMLHTTP. |
||||||||
|
|
|||||||
And modifying the .DefaultUser profile didn't work? |
||||||||
|
|
|||||||
Quote: You mean to say the task is running under a user account ? If so, might also try (as a test) a scripted DEL of temporary internet files - just as a test I mean. At least you would know for sure whether caching was the issue. |
||||||||
|
|
|||||||
I feel a little sheepish. I got a bit involved in some of the other posts that I didn't even try it...until now. Your reg hack worked NTDOC. Thank you for that. Though I'm sure there is probably a way to do this within XMLHTTP as well without modifying IE settings. |
||||||||
|
|
|||||||
the post version of ftpGet is no biggie. just change the send() to have some sh*t in it: send("hash=sh*t") |
||||||||
|
|
|||||||
ok so try this POST version of FTPGet then ... Code:
-Jaffa |
||||||||
|
|
|||||||
no... you didn't even touch the send method. hmm... on the other hand, we don't have anything really to send. did you didn't try this out yourself? |
||||||||
|
|
|||||||
Make it go. |
||||||||
|
|
|||||||
k, checked out the syntax and this should work for you: Code:
|
||||||||
|
|
|||||||
Cool. By the way, I did try out the other one and it does download the file, but I cant really tell about the cache stuff. Plus your code looks like you put more thought into it ... |
||||||||
|
|
|||||||
but I didn't just ripped some source from bbChecker |
||||||||
|
|
|||||||
Well glad you got it going Cyri, but looks like all of us got a little something more and learned a bit more from this thread so that's cool too. Thanks Shawn and Jooel for the UDF code. |