; IF setconsole("hide") ; ENDIF ; ; NT/95 file associations - Kixtart 3.63, 4.00 ; ; (c) scripting@wanadoo.nl - 2001 ; ; vs 1.04 - program ; ; 1.00 (20010301) original version. ; 1.01 (20010401) - kixtart 2001 beta1 compliancy ; - add user information about output generation ; 1.02 (20010701) - using %tmp% value ; 1.03 (20010710) - standardization of $debug_file value ; 1.04 (20011120) - suppress SetConsole("hide") ; $prgrm_version="1.04" ; $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) = "\") $tmp_directory=substr($tmp_directory,1,len($tmp_directory)-1) ENDIF ; --------------------------------------------------------------------------- ; - site defined settings - ; --------------------------------------------------------------------------- ; - ; - 1. "$file" log file associations information to specified file. ; - (dynamic list) ; - advise: use a hidden directory on server with read + write access. ; - 2. "$debug_mode". usefull for kixtar programmers. ; - 3. "$debug_file". log file associations debug information to specified file "$debug_file". ; - 4. "$history_mode". log file associations information to specified file "$file". ; -------------------------------------------------------------------------- $file=$tmp_directory+"\FilesExt.lst" $debug_mode="yes" ; - no/yes - for additional information about checking registry keys - $debug_file=$tmp_directory+"\kix-info.log" $history_mode="yes" ; - yes/no- ; --------------------------------------------------------------------------- ; - - ; --------------------------------------------------------------------------- $time_start=@time ; $cr=CHR(10) $lf=CHR(13) $eol=$lf ; - $cr+$lf - IF (@inwin = 1) $NT_mode="yes" ELSE $NT_mode="no" ENDIF IF (len(@ipaddress0) = 0) $offline_mode="yes" ELSE $offline_mode="no" ENDIF ; -------------------------------------------------------------------------- ; - - ; -------------------------------------------------------------------------- $domain="" $ldomain="" IF ($NT_mode = "yes") $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (ExistKey($ikey) = 0) $domain=ReadValue($ikey, "DefaultDomainName") ENDIF $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (ExistKey($ikey) = 0) $ldomain=ReadValue($ikey, "CachePrimaryDomain") ENDIF ELSE $ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP2\NetworkProvider" IF (ExistKey($ikey) = 0) $domain=ReadValue($ikey, "AuthenticatingAgent") ENDIF $ikey="HKEY_LOCAL_MACHINE\Security\Provider" IF (ExistKey($ikey) = 0) $ldomain=ReadValue($ikey, "Container") ENDIF ENDIF IF (len($domain) = 0) IF (len(@ldomain) <> 0) $domain=@ldomain ELSE $domain=@domain ENDIF IF (len($domain) = 0) $domain="~domain" ; - unknown @domain/@ldomain value - ENDIF ENDIF IF (len($ldomain) = 0) $ldomain=$domain ENDIF ; break off MD "c:\temp" IF (@error = 0) ENDIF IF ($debug_mode = "yes") break on IF (RedirectOutput($debug_file,1) = 0) ENDIF ; IF ($NT_mode = "yes") ? "KIX-FILEs: DEVELOPMENT (NT - kixtart "+@kix+" vs "+$prgrm_version+")" ELSE ? "KIX-FILEs: DEVELOPMENT (95 - kixtart "+@kix+" vs "+$prgrm_version+")" ENDIF ? ELSE IF (RedirectOutput("nul",1) = 0) ENDIF ENDIF flushkb IF ($NT_mode = "yes") $time_stop=@time $log_info="Kixtart-FILE "+$prgrm_version+" script started" $log_info=$log_info+" for '"+LCASE(@userid)+"'" $log_info=$log_info+" ("+$time_start+" - '"+@ipaddress0+"')" IF logevent(0, 1, $log_info, "", "Kixtart FILE @kix") ENDIF ENDIF ; -------------------------------------------------------------------------- ; - special variables settings - ; -------------------------------------------------------------------------- $section=substr(@date,1,4) IF (@ydayno < 10) $section=$section+"00"+@ydayno ELSE IF (@ydayno < 100) $section=$section+"0"+@ydayno ELSE $section=$section+@ydayno ENDIF ENDIF $key=$section+"_" $key=$key+substr(@date,3,2)+substr(@date,6,2)+substr(@date,9,2) $key=$key+"_" $key=$key+@time $key=$key+" "+$domain $x="" $tmp="" $tmp_short="" IF (len(@ipaddress0) = 0) $offline_mode="yes" IF ($NT_mode = "yes") $x=$x+"(NT - vs "+$prgrm_version+" - off-line )" ELSE $x=$x+"(95 - vs "+$prgrm_version+" - off-line )" ENDIF ELSE $offline_mode="no" IF (len(@lserver) = 0) $lserver="~lserver " ELSE $lserver=@lserver ; - \\spln99999 - ENDIF IF (LCASE($domain) = LCASE($ldomain)) IF ($NT_mode = "yes") $x=$x+"(NT - vs "+$prgrm_version+" L $domain $lserver)" ELSE $x=$x+"(95 - vs "+$prgrm_version+" L $domain $lserver)" ENDIF ELSE IF ($NT_mode = "yes") $x=$x+"(NT - vs "+$prgrm_version+" - $domain $lserver)" ELSE $x=$x+"(95 - vs "+$prgrm_version+" - $domain $lserver)" ENDIF ENDIF ENDIF $tmp_short=$x IF (len(@ipaddress0) = 15) $i=1 $ip_old=@ipaddress0 $ip_new="" DO IF (substr($ip_old,$i,1) <> " ") $ip_new=$ip_new+substr($ip_old,$i,1) ELSE $ip_new=$ip_new+"0" ENDIF $i=$i+1 UNTIL ($i > 15) ELSE $ip_new="xxx.xxx.xxx.xxx" ENDIF $x=$x+" "+$ip_new IF (len(@address) = 0) $address="xxxxxxxxxxxx" ; $address="xx-xx-xx-xx-xx-xx" ELSE $address=@address ; $address= substr(@address,1,2)+"-"+substr(@address,3,2)+"-"+substr(@address,5,2) ; $address=$address+"-"+substr(@address,7,2)+"-"+substr(@address,9,2)+"-"+substr(@address,11,2) ENDIF $x=$x+" "+$address $user="" IF ($NT_mode = "yes") $ikey="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" IF (ExistKey($ikey) = 0) $user=ReadValue($ikey, "DefaultUserName") ENDIF ELSE $ikey="HKEY_LOCAL_MACHINE\System\CurrentControlSet\control" IF (ExistKey($ikey) = 0) $user=ReadValue($ikey, "Current User") ENDIF ENDIF IF (len($user) = 0) $user=@userid IF (len($user) = 0) $user="~user" ENDIF ENDIF $x=$x+" "+$user $tmp_short=$tmp_short+" "+$user IF (len(@wksta) = 0) $x=$x+" ~wksta" $tmp_short=$tmp_short+" ~wksta" ELSE $x=$x+" "+@wksta $tmp_short=$tmp_short+" "+@wksta ENDIF IF (len(@fullname) = 0) IF (len(@comment) = 0) $x=$x+" ('~fullname')" ELSE $x=$x+" ('~fullname'+'"+@comment+"')" ENDIF $tmp_short=$tmp_short+" '~fullname'" $fullname=$user ELSE IF (len(@comment) = 0) $x=$x+" ('@fullname')" ELSE $x=$x+" ('"+@fullname+"'+'"+@comment+"')" ENDIF $tmp_short=$tmp_short+" '"+@fullname+"'" $fullname=$user ENDIF ; $admin_user="no" IF (INGROUP("Administrators") = 1) OR (INGROUP("Administrators") = 2) $admin_user="yes" ENDIF IF (INGROUP("Domain Admins") = 1) OR (INGROUP("Domain Admins") = 2) $admin_user="yes" ENDIF $tmp=$x ; $license="yes" ; -------------------------------------------------------------------------- ; - get file associations information - ; -------------------------------------------------------------------------- ; - show specific file associations including program location - $max_ikeys=9 DIM $ikeys[$max_ikeys+1] $ikeys[1]="batfile" $ikeys[2]="cmdfile" $ikeys[3]="comfile" $ikeys[4]="exefile" $ikeys[5]="inifile" $ikeys[6]="regfile" $ikeys[7]="scrfile" $ikeys[8]="vbsfile" $ikeys[9]="unknown" ; IF ($debug_mode = "yes") ? ? "HKEY_CLASSES_ROOT\???\Shell\open\command" ENDIF $i=1 $x=$tmp+" HKCR.specials=(" $first="" WHILE ($i <= $max_ikeys) $ikey="HKEY_CLASSES_ROOT\"+$ikeys[$i]+"\Shell\open\command" IF (ExistKey($ikey) = 0) $icode=ENUMVALUE($ikey, $index) $ivalue=ReadValue($ikey, $icode) IF ($debug_mode = "yes") ? " ["+substr($ikeys[$i]+" ",1,14)+"]="+$ivalue ENDIF $x=$x+$first+$ikeys[$i]+"='"+$ivalue+"'" $first="," ENDIF $i=$i+1 LOOP $x=$x+")" ; - show all file associations including program location - $execute_mode="yes" ; IF (LCASE(@day) = "sunday") OR (LCASE(@day) = "monday") OR (LCASE(@day) = "saturday") ; $execute_mode="yes" ; ELSE ; $execute_mode="no" ; ENDIF IF ($debug_mode = "yes") $execute_mode="yes" ENDIF ; IF ($execute_mode = "yes") IF ($debug_mode = "yes") ? ? "HKEY_CLASSES_ROOT\???" ENDIF ; $ikey="HKEY_CLASSES_ROOT" IF (existkey($ikey) = 0) $completed="no" $first="" $x=$x+" HKCR.all=(" DO $icode=ENUMKEY($ikey, $index) IF (@error = 0) ; IF ($debug_mode = "yes") ; ? $ikey+"\"+$icode ; ENDIF IF (len($icode) <> 0) AND (substr($icode,1,1) = '.') $ivalue=ReadValue($ikey+"\"+$icode, ENUMKEY($ikey+"\"+$icode, 0)) IF (@error <> 0) $ivalue=ReadValue($ikey+"\"+$icode, ENUMVALUE($ikey+"\"+$icode, 0)) IF (@error <> 0) ? "Warning "+$ikey+"\"+$icode+": "+@serror ENDIF ENDIF IF (len($ivalue) <> 0) $ikey1="HKEY_CLASSES_ROOT\"+$ivalue+"\Shell\open\command" IF (ExistKey($ikey1) = 0) $ivalue1=ReadValue($ikey1, ENUMKEY($ikey1, 0)) IF (@error <> 0) $ivalue1=ReadValue($ikey1, ENUMVALUE($ikey1, 0)) IF (@error <> 0) ? "Warning "+$ikey1+": "+@serror ENDIF ENDIF IF (len($ivalue1) <> 0) $x=$x+$first+$icode+"='"+$ivalue+"("+$ivalue1+")'" $first="," ENDIF IF ($debug_mode = "yes") IF (len($ivalue1) <> 0) ? " ["+substr($icode+" ",1,14)+"]="+$ivalue+" -> "+$ivalue1 ELSE ? " ["+substr($icode+" ",1,14)+"]="+$ivalue ENDIF ENDIF ELSE IF ($debug_mode = "yes") ? " ["+substr($icode+" ",1,14)+"]="+$ivalue ENDIF ENDIF ENDIF ENDIF ELSE $completed="yes" ENDIF $index=$index+1 UNTIL ($completed = "yes") $x=$x+")" ENDIF ENDIF $file1=$file IF ($debug_mode = "yes") ? ? " file = "+UCASE($file1) ? " key = "+$key ? " x = "+$x ? ENDIF IF ($history_mode = "yes") IF (open(9, $file1, 5) = 0) IF writeline(9, $key+"="+$x+$eol) ENDIF ENDIF IF close(9) ENDIF ENDIF ; -------------------------------------------------------------------------- ; - end - ; -------------------------------------------------------------------------- :end_script ; IF (@priv = "ADMIN") ; color R+/W ; ? "Your are SUPERVISOR!" ; play "0g500f120t" ; sleep 5 ; ENDIF $time_stop=@time IF ($NT_mode = "yes") $log_info="Kixtart-FILE "+$prgrm_version+" script completed successfully" $log_info=$log_info+" for '"+LCASE($user)+"' "+UCASE($domain) $log_info=$log_info+" ("+$time_start+" - "+$time_stop+" - '"+$ip_new+"')" IF (len($fullname) > 0) $log_info=$log_info+" '"+LCASE($fullname)+"'" $log_info=$log_info+" '"+$previous_logon_message+"'" $log_info=$log_info+" '"+$previous_workstation+"'" ENDIF ; IF logevent(0, 1, $log_info, "", "Kixtart FILE @kix"+"s") ENDIF ENDIF ; IF (RedirectOutput("CON",1) = 0) ENDIF IF ($history_mode = "yes") ? "Informative FilesExt.KIX: create dynamic list '"+$file+"'" ELSE ? "Informative FilesExt.KIX: no creation of dynamic list '"+$file+"'" ENDIF IF ($debug_mode = "yes") ? "Informative FilesExt.KIX: create debug list '"+$debug_file+"'" ELSE ? "Informative FilesExt.KIX: no creation of debug list '"+$debug_file+"'" ENDIF break on flushkb