Page 1 of 1 1
Topic Options
#76392 - 2003-08-15 02:27 PM W32LoveSAN checker
eVIL tROOPER Offline
Fresh Scripter

Registered: 2003-08-15
Posts: 8
HI

I have wrote a script to check remote your Clients for the W32LoveSAN

code:
; Fenstertitel
SetTitle("Blaster Checker")

;Zählbereich bestimmen
CLS
At (0,0) "Bitte Erste Clientnummer eingeben:"
At (0,34) Gets$First ; Erste Clientnummer 3-stellig
At (1,0) "Bitte Letzte Clientnummer eingeben:"
At (1,35) Gets$Last ; Letzte Clientnummer (999)

; Client Art bestimmen
At (2,0) "Bitte Clientart eingeben:"
At (2,25) Gets$Client_Art

For $COUNTER = $First TO $Last Step 1



;Längenermittlung der Clientnummer
$Laenge = Len ($Counter)

If $Laenge = 1
$Counter_str = "00" + $Counter
EndIf

If $Laenge = 2
$Counter_str = "0" + $Counter
EndIf

If $Laenge = 3
$Counter_str = $Counter
EndIf

; Computernamen aus String erstellen
$Client = "\\" + $Client_Art + $Counter_str


; Funktion ausführen
$msblast = If Exist ("$Client\C$\winnt\system32\msblast.exe"
"$Client\C$\winnt\system32\penis32.exe" OR
"$Client\C$\winnt\system32\penis.exe" OR
"$Client\C$\winnt\system32\teekids.exe" OR
"$Client\C$\winnt\system32\root32.exe" OR
"$Client\C$\winnt\root32.exe")

;CurrentUser auslesen
$user = ReadValue ("$Client\HKEY_LOCAL_MACHINE\SOFTWARE\XX","CurrentUser")

;Ausgabe in Datei
$File = \\server\blaster.txt

;writeline
If Open( 2, "$File", 5) = 0
; WriteLine (2, Chr(10))
WriteLine (2, $Client + ";")
WriteLine (2, $user + ";")
WriteLine (2, @CRLF)
Close (2)
EndIf
EndIf
Next

But i got problems with the "If Exist" function

it only checks if the "msblast.exe" exist and then he go to the next client...

My problem is now why the check for the other files like "penis.exe" OR "penis32.exe" doesn't work??

Hope someone can help me..
And sorry for my bad english. [Smile]
_________________________
Goto are eVIL [TM]
Top
#76393 - 2003-08-15 02:31 PM Re: W32LoveSAN checker
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You are close -

code:
; Funktion ausführen
$msblast = If Exist ("$Client\C$\winnt\system32\msblast.exe") OR
Exist ("$Client\C$\winnt\system32\penis32.exe") OR
Exist ("$Client\C$\winnt\system32\penis.exe") OR
Exist ("$Client\C$\winnt\system32\teekids.exe") OR
Exist ("$Client\C$\winnt\system32\root32.exe") OR
Exist ("$Client\C$\winnt\root32.exe")

HTH,

Kent

[ 15. August 2003, 14:31: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76394 - 2003-08-15 02:33 PM Re: W32LoveSAN checker
eVIL tROOPER Offline
Fresh Scripter

Registered: 2003-08-15
Posts: 8
and you are fast [Smile]

Thank you very much [Smile]
_________________________
Goto are eVIL [TM]
Top
#76395 - 2003-08-15 02:41 PM Re: W32LoveSAN checker
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Whoa !!!

you say (Pseudo)

code:
$Variable = if  condition
or other condition
or yet another condition
endif

Did I miss something obvious recently ???
_________________________



Top
#76396 - 2003-08-15 02:44 PM Re: W32LoveSAN checker
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
this '$msblast = ' should be in best case ignored

But still my poor brain hurts reading it [Wink]
_________________________



Top
#76397 - 2003-08-15 02:46 PM Re: W32LoveSAN checker
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Good place for SELECT..CASE..ENDSELECT.

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

Top
#76398 - 2003-08-15 02:51 PM Re: W32LoveSAN checker
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hmmm.

Assigning a variable to an IF condition results as I expected in an 'Error in Expression' exit message....

How can you say it checks for anything ? do you have a newer version than I have ?

Yours very confused [Confused]
_________________________



Top
#76399 - 2003-08-15 02:52 PM Re: W32LoveSAN checker
eVIL tROOPER Offline
Fresh Scripter

Registered: 2003-08-15
Posts: 8
only delete the $msblast...

you don't need it [Smile]

it was a fault from me.. [Smile]
_________________________
Goto are eVIL [TM]
Top
#76400 - 2003-08-15 02:58 PM Re: W32LoveSAN checker
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
[Eek!]

Your killing me!
_________________________



Top
#76401 - 2003-08-15 03:04 PM Re: W32LoveSAN checker
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
One should rather use the admin$ share for the unlikely case where the system directory is not C:\WINNT.

Additionally, one should put the files to search for into an array and then check each array element. This will make it easier to add additional files to check for further down the road.

Also, using e.g. the COMNetView() UDF would improce the script in such a way that it'll check all computers registered in the domain.
_________________________
There are two types of vessels, submarines and targets.

Top
#76402 - 2003-08-15 03:10 PM Re: W32LoveSAN checker
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
do a search for FileFinder

It is a kixforms app that will enum an OU and check every PC in the OU
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76403 - 2003-08-15 03:31 PM Re: W32LoveSAN checker
eVIL tROOPER Offline
Fresh Scripter

Registered: 2003-08-15
Posts: 8
@sealeopard

Thanks for the tip with $Admin.. [Smile]

i use it now [Smile]
_________________________
Goto are eVIL [TM]
Top
#76404 - 2003-08-15 04:20 PM Re: W32LoveSAN checker
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
this could be modified fairly easily

code:
 
break on

$ou='LDAP://@domain/CN=Computers,dc=Company,dc=com'

$file=@scriptdir+'\complist.txt'
? $ou
? $file

if not exist($file)
$Computers = GetObject($ou)
For each $Item in $computers
$cn=$Item.name
$name=right($cn, len($cn)-3)
$=writeprofilestring($file,'notScanned',$name,1)
next
$computers=''
endif

$P2Pclients='BearShare','Morpheus','LimeWire','Kazaa','Grokster','Gator.com','Napster','WinMX','aim95'
$notscanned=split(readprofilestring($file,'notScanned',''),chr(10))

for each $item in $notscanned
? $item
if wshping($item)[1] >0
$clean=1
for each $app in $P2Pclients
' $app'
if keyexist('\\'+$item+'\hklm\SOFTWARE\'+$app)
;or keyexist('\\'+$item+'\hkcu\SOFTWARE\'+$app)
or keyexist('\\'+$item+'\hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+$app)
or exist('\\'+$item+'\c$\program files\'+$app)
$clean=0
beep
$=writeprofilestring($file,$app,$item,@date)
endif
next
if $clean
$=writeprofilestring($file,'Clean',$item,1)
endif
$=writeprofilestring($file,'notScanned',$item,'')
else
' offline'
endif
NEXT


;********************************************************************************************************
FUNCTION WSHPing($Computer,optional $replies)
dim $ip, $l, $r, $count, $return, $line ,$pos, $avg
if not $replies $replies=1 endif
$ip=$computer $Count=0
$shell='%comspec% /c %windir%\system32\ping $Computer -n $replies '
$return=WSHPipe($shell,1)
if not @error
for each $line in $return
select
case instr($line,"[") $l=instr($line,"[")+1
$r=instr($line,"]")
$ip=substr($line,$l,$r-$l)
case instr($line,"reply from") $Count=$Count+1
case instr($line,"Average") $pos=instr($line,"Average")+8
$avg=val(right("$line",len($line)-$pos))
endselect
if instr($line,"timed out") $Count=$Count-1 endif
next
$WSHPing=$ip,$count,$avg
else
$WSHPing="0.0.0.0","0","0"
exit(487)
endif
ENDFUNCTION
;********************************************************************************************
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $WshShell, $oExec, $AllOutput, $Exit, $WshExitCode
$WshErrorMsg=""
$WshShell=CreateObject("WScript.Shell")
$oExec=$WshShell.Exec($ShellCMD)
While $Exit<>1
Dim $Output
Select
Case Not $oExec.StdOut.AtEndOfStream $Output=$oExec.StdOut.ReadAll
Case Not $oExec.StdErr.AtEndOfStream $Output=$oExec.StdErr.ReadAll
$WshErrorMsg = $Output
Case 1 $Output=-1
EndSelect
If $Output=-1
If $oExec.Status=1 $Exit=1 Endif
Else
If $NoEcho<>1 ? $Output Endif
$AllOutput = $AllOutput + $Output
Endif
Loop
$WshExitCode=$oExec.ExitCode
$WshPipe=split($AllOutput,chr(10))
Exit($WshExitCode)
EndFunction

_________________________
How to ask questions the smart way <-----------> Before you ask

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 895 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.066 seconds in which 0.026 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