Page 1 of 1 1
Topic Options
#48378 - 1999-10-19 04:27 PM RND not generating random code
Anonymous
Unregistered


KIX 3.61. Having a problem getting random numbers out of RND. Want to use the results to pull files out of a directory to update McAfee files from but am getting the same number generated each time. Here is the code (note the tag file vscan95.tag which controls running this or not):


If EXIST ("C:\Program Files\Network Associates\McAfee VirusScan\vscan95.tag")
ELSE
SRND(5)
$McAfee = RND(5)
Copy "\\NTAPP1\APPS\BackWeb\Vscan\Win95\" + $McAfee + "\*.*" "C:\Program Files\Network Associates\McAfee VirusScan\"
endif


Thanks for any help,

Pete Carstensen

Top
#48379 - 1999-10-27 10:17 AM Re: RND not generating random code
Anonymous
Unregistered


This one pressed my curiosity buttons!

You are basically after one random number each time the script is invoked. Using the same seed each time will result in the same pseudo-random number being generated. Indeed
with such a small range (0-5) it would appear in Kixtart that you need a seed number "randomly" picked from a very large range (at least around 0-10000 approximately) in order
to get a different first number returned from RND(5) each time the script is invoked.

You could use the 3 numbers in @TIME multiplied together to generate the seed like this:

code:

$hh=val(substr(@TIME,1,2))+1
$mm=val(substr(@TIME,4,2))+1
$ss=val(substr(@TIME,7,2))+1
SRND($hh*$mm*$ss)
$McAfee = RND(5)
? $McAfee


Top
#48380 - 1999-10-29 11:39 AM Re: RND not generating random code
Anonymous
Unregistered


Just to nose in on the McAfee issue. Are you trying to use this to update the Dat files? Just copying the files won't work because the program holds open scan.dat and you won't be able to replace it.

That's why McAfee has had to use the autoupgrade/autoupdate system or the Superdats. They stop the service, copy and start the service on NT and on 9x they set up the copy to happen before McAfee starts the next time.

So with that speil, how does your script work? It seems to have the random in the path. It's not like you are copying from different servers, just different directories. Why? Or am I wrong?

------------------

Top
#48381 - 1999-10-30 12:46 AM Re: RND not generating random code
Anonymous
Unregistered


Ok, just a bit more info. I am using the RND function to determine one of six subdirectories to copy the McAfee control files from. In each of these directories, there is a configured avconsole.ini, update.ini, and default.vsh file. These are preconfigured to auto-update at different days and times.

The goal is to avoid having everyone in the company begin the update process all at the same time which would put a significant strain on our network infrastructure. By randomizing the schedule files, and then utilizing the randomize within the hour function of McAfee, we get the dat updates pretty well spread out.

The next issue is that the DAT files are not enough given that the engine is updated almost as much as the DAT files. About the only way I can do the SDAT update is to put it in the login script but want to limit it to run once only.

I am beginning to think that McAfee used Rube Goldberg to plan out their update process!

Pete Carstensen

Top
#48382 - 1999-10-29 02:29 PM Re: RND not generating random code
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
All the Virus protectors have similar problems. It is because they must be one the first thing running in order to protect you from virus introduce during the bootup phase. Windows will not let you replace running files. Thus catch-22. Most auto updates of virus software use a form of runonce & force a reboot. I don't think you can get around this fact. Some virus proctors do provide tools that make this process slicker.
_________________________
Jack

Top
#48383 - 2000-10-20 07:31 AM Re: RND not generating random code
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Sorry to say something so late, but I found this by chance...

The SRND() function does not work with variables:

ie

$r=10
SRND($r)

is not the same as

SRND(10)

in that it doesn't work. If you want to SRND() a variable this is one way:

code:

$seed=val(substr("@time", 7, 2))
$seed=$seed+1
do
$=rnd(1)
$seed=$seed-1
until $seed=0

this can be shortened to

code:

$seed=val(substr("@time", 7, 2)) $seed=$seed+1
do $=rnd(1) $seed=$seed-1 until $seed=0

This is a bs way of doing this, but it is effective enough... it is basically a 1 in 60 chance of a random seed.

cj


[This message has been edited by cj (edited 20 October 2000).]

Top
#48384 - 2000-10-20 04:09 PM Re: RND not generating random code
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Pete:

What version of Mcafee are you using? I have had wonderful success using Mcafee's build in autoupgrade to keep my clients up to date.

just as an example... I DL'd he latest superdat yesterday, placed it in the correct location and renamed it. As of this morning all of my clients will be running 4.0.4100 / 4.0.70

IF you want more information on what I am doing I will be glad to help.

here are a few links

This is what I first did for Win9x
McAfee installation ideas and pointers


Here is something for NT
Modify Mcafee 4.x on NT to use AutoUpgrade

Bryce

[This message has been edited by Bryce (edited 20 October 2000).]

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1160 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.053 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org