Page 1 of 1 1
Topic Options
#125409 - 2004-08-21 12:06 AM READVALUE Problem
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
I've been playing with Kix for about a year mainly for logon scripts and I've slowly been playing with other code to read and write to the registry. Mainly to help battle virus outbreaks.

I've been trying to write a script that will read a registry key, and if it exists copy down the symantec removal tool from the server and run it. I can do everything but the READVALUE will not read the string registry type, only the DWORD.

My script that does the read is as follows:

$VIRI = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" ,"drvddll.exe")

I test this by simulating the registry key, but the only data type I've been able to get work is the DWORD. Is there something I'm not seening in the command reference on the site or in the manual that I need to have to read string keys?

Thanks for any help in advance...

JTT

Top
#125410 - 2004-08-21 12:22 AM Re: READVALUE Problem
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
JTT,

I ran this @home:
Code:
 ">>> "+ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" ,"msnmsgr")+" <<<" ? 


which gave me:
>>> "C:\Program Files\MSN Messenger\msnmsgr.exe" /background <<<

What you've got in the registry?
Try debugging your script and see what value is returned.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#125411 - 2004-08-21 12:25 AM Re: READVALUE Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That makes no sense to me. Maybe it is in the way you try to use the $VIRI returned.

This code:
Break On
$MSN = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" ,"msnmsgr")
$MSN ?

Returns:
"C:\Program Files\MSN Messenger\msnmsgr.exe" /background

C:\KiXScripts>

In the reg, it is REG_SZ.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125412 - 2004-08-21 12:26 AM Re: READVALUE Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
LOL
We both tested on the same thing. How great minds think alike eh?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125413 - 2004-08-21 12:28 AM Re: READVALUE Problem
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Lol indeed...

Think it's cause we're infected by the KiX virus...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#125414 - 2004-08-21 12:28 AM Re: READVALUE Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, and MSN too.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125415 - 2004-08-21 12:39 AM Re: READVALUE Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
in groud stupidity is increased, or how the saying goes?...?...
_________________________
!

download KiXnet

Top
#125416 - 2004-08-22 05:03 PM Re: READVALUE Problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Using the var $VIRI does not sit right with me (IMHO).. I know that is what you are trying to target.. Just trying to out-think the virus authors..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125417 - 2004-08-26 09:02 PM Re: READVALUE Problem
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
Les-

You are right it has something to do with the way that I'm using the returned variable. If I run the code the way you've presented it I do get the value returned to me.

I also relized that I'm wanting the EXISTKEY function and not the readvalue, because I simply want to know if the key exists and if it does run the subroutine. So if I understand the command reference correctly I should only need to do the following:

$BVC = ExistKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\drdvdll.exe")

If $BVC = 0

? "Key exists...."

Endif

Top
#125418 - 2004-08-26 09:10 PM Re: READVALUE Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You don't know your "keys" form your "values". The key is "run" and what you are looking at is a value!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125419 - 2004-08-26 09:11 PM Re: READVALUE Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if there is such key (not value), sure that would work.
_________________________
!

download KiXnet

Top
#125420 - 2004-08-26 09:39 PM Re: READVALUE Problem
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah
Les-

Actually I do know my keys from my values. The virus puts the subkey "drvddll.exe" under the run, the value of the subkey is actually "%System%\drvddll.exe".


Top
#125421 - 2004-08-26 09:41 PM Re: READVALUE Problem
JTT Offline
Fresh Scripter

Registered: 2002-10-14
Posts: 32
Loc: Utah

I have it working with this simple code to check to see if it exists:
$BVC = KeyExist("\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\drdvdll.exe")
If $BVC = 0
RUN Subroutine
ENDIF



Edited by JTT (2004-08-26 09:53 PM)

Top
#125422 - 2004-08-26 09:44 PM Re: READVALUE Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I hope you know.
there is almost never subkeys in that run key.
_________________________
!

download KiXnet

Top
#125423 - 2004-08-26 09:47 PM Re: READVALUE Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Actually I do know my keys from my values.



Actually, you don't.
In Regedit, does it show in the treeview on the left? I doubt it.

Values have 2 components, ValueName (drvddll.exe) and ValueData (%System%\drvddll.exe).
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


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

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

Generated in 0.034 seconds in which 0.012 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