#50792 - 2000-07-29 05:46 AM
KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,Another program we are referencing a time ago is finished for publishing. Goal: make source code difficult to debug/make source code easilier to read Available at site http://home.wanadoo.nl/scripting programname kixstrip.exe. It will do two things:
- strip your kixtart source code by removing comments, empty lines,
spaces & tabs at the beginning of a line. after this operation it will combine the statements to one line and place label-statements on separates lines. for you as user it is possible to add a license agreement to it. possible syntax warnings are added at the end as comment. during the analyze it check the block-structures.
- reformatting your kixtart source code by inserting spaces by
changing the block-structure. so it is easilier to read an unfor- matted source code. in this case is check also the block structure.
remark: it is important you respect the syntax of the manual. it is the same requirement for kixref.exe. The help information of the program is: kixstrip ?
code:
Kixstrip 3.62 (vs 1.35e) MCA - scripting@wanadoo.nl - 2000 ------------------------------------------------------------------------------ kixstrip [input] [output] /Block_Check or /BC /Combine /License /License=[var] /NoCombine or /NC /NoLicense /NoPrint /Print /TAB=[num] (default: 2) ? default: /Combine /License /NoPrint other: /Block_Check /Tab=2 (auto set: /NoCombine /NoLicense /Print) /Print (don't remove print statements ) input to file "kix-info.kix" output to file "kix-info.out"
Example of input: code:
IF setconsole("hide") ENDIF ; ; NT/95 cleanup - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (cleanup recent list, set HKCR keys, set BOOT.INI, set TaskMgr) ; ; 1.00 (20000715) original version ; $prgrm_version="1.00" ; $debug_mode="no" ; - yes/no - IF (@inwin = 1) $NT_mode="yes" ELSE $NT_mode="no" ENDIF ; break off flushkb $info="" ; -------------------------------------------------------------------------- ; - taskmgr settings. all counters - ; -------------------------------------------------------------------------- $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\TaskManager" IF (ExistKey($ikey) = 0) $ikey_ex="preferences" $taskmgr_prefs= "ac000000a00f00000200000001000000020000000000000020" $taskmgr_prefs=$taskmgr_prefs+"000000de030000d70200000200000000000000010000000200" $taskmgr_prefs=$taskmgr_prefs+"00000300000004000000050000000600000007000000080000" $taskmgr_prefs=$taskmgr_prefs+"00090000000a0000000b0000000c0000000d000000ffffffff" $taskmgr_prefs=$taskmgr_prefs+"6b000000320000002300000046000000460000004600000046" $taskmgr_prefs=$taskmgr_prefs+"000000460000004600000046000000460000003c0000003c00" $taskmgr_prefs=$taskmgr_prefs+"00003c000000460000004b0000000000000000000000" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_BINARY" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $taskmgr_prefs) IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, $result_data_type) <> 0) IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, "REG_BINARY") <> 0) ENDIF ENDIF $info=$info+" taskmgr."+$ikey_ex IF ($debug_mode = "yes") ? " taskmgr.["+$ikey_ex+"]="+$ivalue ENDIF ENDIF ENDIF ; -------------------------------------------------------------------------- ; - update BOOT.INI timer - ; -------------------------------------------------------------------------- IF ($NT_mode = "yes") $filename="c:\boot.ini" ; - NT boot menu - $file_attr=getfileattr($filename) IF setfileattr($filename, 128) ENDIF IF (readprofilestring($filename, "boot loader", "timeout") <> "1") IF (writeprofilestring($filename, "boot loader", "timeout", "1") = 0) $info=$info+" boot.timeout=1" IF ($debug_mode = "yes") ? " "+$filename+" (attr: "+$file_attr+") -> [boot loader] timeout=1" ENDIF ENDIF ENDIF IF setfileattr($filename, $file_attr) ENDIF ENDIF ; -------------------------------------------------------------------------- ; - add "Quickview with Notepad" to menu, when no file association exist - ; -------------------------------------------------------------------------- ; - enabling 'quickview with notepad' - IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF ; -------------------------------------------------------------------------- ; - change "regfile" + "vbsfile" to edit mode - ; -------------------------------------------------------------------------- $ikey="HKEY_CLASSES_ROOT\regfile\shell" $ikey_ex=ENUMVALUE($ikey, 0) $default_key="edit" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $default_key) IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) ENDIF ENDIF $info=$info+" "+$ikey+"="+$default_key ENDIF ; $ikey="HKEY_CLASSES_ROOT\vbsfile\shell" $ikey_ex=ENUMVALUE($ikey, 0) $default_key="edit" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $default_key) IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) ENDIF ENDIF $info=$info+" "+$ikey+"="+$default_key ENDIF ; -------------------------------------------------------------------------- ; - cleanup 'recent list' - ; -------------------------------------------------------------------------- $max_ikeys=23 DIM $ikeys[$max_ikeys+1] $ikeys[01]="HKEY_CURRENT_USER\Software\Binary Research Ltd\Ghost Explorer\Recent File List" $ikeys[02]="HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" $ikeys[03]="HKEY_CURRENT_USER\Software\Microsoft\Microsoft Management Console\Recent File List" $ikeys[04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\Recent File List" $ikeys[05]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\MS Project\Recent File List" $ikeys[06]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\PowerPoint\Recent File List" $ikeys[07]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Recent File List" $ikeys[08]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\MS Project\Recent File List" $ikeys[09]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\PowerPoint\Recent File List" $ikeys[10]="HKEY_CURRENT_USER\Software\Microsoft\Outlook Express\Recent Stationery List" $ikeys[11]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List" $ikeys[12]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\WordPad\Recent File List" $ikeys[13]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\DesktopStreamMRU" $ikeys[14]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU" $ikeys[15]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU" $ikeys[16]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU" $ikeys[17]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs" $ikeys[18]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" $ikeys[19]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU" $ikeys[20]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Preload" $ikeys[21]="HKEY_CURRENT_USER\Software\Netscape\Netscape Navigator\URL History" $ikeys[22]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\extract" $ikeys[23]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\filemenu" ; $i=1 WHILE ($i <= $max_ikeys) $ikey=$ikeys[$i] $i=$i+1 IF (ExistKey($ikey) = 0) IF ($debug_mode = "yes") ? "input -> ["+$ikey+"]" ENDIF $index=0 DO $icode=ENUMVALUE($ikey, $index) IF (len($icode) <> 0) $ivalue=ReadValue($ikey, $icode) $result=DelValue($ikey, $icode) IF ($debug_mode = "yes") IF ($result = 0) ? " "+$icode+"="+$ivalue ELSE ? " error "+$icode+"="+$ivalue+" -> "+$result ENDIF ENDIF IF ($result <> 0) $index=$index+1 ENDIF ENDIF UNTIL (len($icode) = 0) $index=$index+1 DO $icode=ENUMVALUE($ikey, $index) IF (len($icode) <> 0) $ivalue=ReadValue($ikey, $icode) $result=DelValue($ikey, $icode) IF ($debug_mode = "yes") IF ($result = 0) ? " "+$icode+"="+$ivalue ELSE ? " error "+$icode+"="+$ivalue+" -> "+$result ENDIF ENDIF IF ($result <> 0) $index=$index+1 ENDIF ENDIF UNTIL (len($icode) = 0) ENDIF LOOP ; $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" IF (Exist($ikey) = 0) $ivalue=ReadValue($ikey, "Recent") IF ($debug_mode = "yes") ? "recent.user_shell_folders -> "+$ivalue+"="+ExpandEnvironmentVars($ivalue) ENDIF IF (len($ivalue) <> 0) del ExpandEnvironmentVars($ivalue)+"\*.lnk" ENDIF ENDIF ; $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" IF (Exist($ikey) = 0) $ivalue=ReadValue($ikey, "Recent") IF ($debug_mode = "yes") ? "recent.shell_folders -> "+$ivalue+"="+ExpandEnvironmentVars($ivalue) ENDIF IF (len($ivalue) <> 0) del ExpandEnvironmentVars($ivalue)+"\*.lnk" ENDIF ENDIF ; del "c:\ffastun*.*" del "c:\file*.chk" del "c:\temp\~*.*" del "c:\temp\*.~*" del "c:\temp\*.??~" del "c:\temp\*.tmp" del "c:\temp\mscreate.dir" del "c:\temp\*.---" IF ($NT_mode = "yes") del "c:\winnt\~*.*" del "c:\winnt\*.~*" del "c:\winnt\*.??~" del "c:\winnt\*.tmp" del "c:\winnt\mscreate.dir" del "c:\winnt\*.---" del "c:\winnt\temp\~*.*" del "c:\winnt\temp\*.~*" del "c:\winnt\temp\*.??~" del "c:\winnt\temp\*.tmp" del "c:\winnt\temp\mscreate.dir" del "c:\winnt\temp\*.---" ELSE del "c:\windows\~*.*" del "c:\windows\*.~*" del "c:\windows\*.??~" del "c:\windows\*.tmp" del "c:\windows\mscreate.dir" del "c:\windows\*.---" del "c:\windows\temp\~*.*" del "c:\windows\temp\*.~*" del "c:\windows\temp\*.??~" del "c:\windows\temp\*.tmp" del "c:\windows\temp\mscreate.dir" del "c:\windows\temp\*.---" ENDIF ; $max_ikeys=8 DIM $ikeys[$max_ikeys+1] DIM $sub_ikeys[$max_ikeys+1] $ikeys [01]="HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\4.0\AdobeViewer" $sub_ikeys[01]="AVPrecentFile" ; <nr> $ikeys [02]="HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\4.0\AdobeViewer" $sub_ikeys[02]="AVPrecentFile" ; <nr> $ikeys [03]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $sub_ikeys[03]="MRU" ; <nr> $ikeys [04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $sub_ikeys[04]="MRUFlags" ; <nr> $ikeys [05]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $sub_ikeys[05]="MRU" ; <nr> $ikeys [06]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $sub_ikeys[06]="MRUFlags" ; <nr> $ikeys [07]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $sub_ikeys[07]="LastFile" ; <nr> $ikeys [08]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $sub_ikeys[08]="LastType" ; <nr> ; $i=1 WHILE ($i <= $max_ikeys) $ikey=$ikeys[$i] $sub_ikey=$sub_ikeys[$i] IF (ExistKey($ikey) = 0) IF ($debug_mode = "yes") ? "input -> ["+$ikey+"]+["+$sub_ikey+"??]" ENDIF $k=0 WHILE ($k <= 10) $ivalue=ReadValue($ikey, $sub_ikey+$k) $result=DelValue($ikey, $sub_ikey+$k) IF ($debug_mode = "yes") IF ($result = 0) ? " "+$sub_ikey+$k+"="+$ivalue ELSE ; ? " error "+$sub_ikey+$k+"="+$ivalue+" -> "+$result ENDIF ENDIF $k=$k+1 LOOP ENDIF $i=$i+1 LOOP ; $info=$info+" cleanup.recent" ; -------------------------------------------------------------------------- :end_script IF ($debug_mode = "yes") ? $info ENDIF break on flushkb :end
Example of output after calling: kixstrip cleanup.kix cleanup.txt code:
Kixstrip 3.62 (vs 1.35e) input 341 cleanup.kix output 277 cleanup.txt -skip- 64 -blocks- 0 -labels- 2 license: MCA - scripting@wanadoo.nl - 2000
code:
; ; Kixtart 3.62 ; ; (c) MCA - scripting@wanadoo.nl - 2000 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; IF setconsole("hide") ENDIF $prgrm_version="1.00" $debug_mode="no" IF (@inwin = 1) $NT_mode="yes" ELSE $NT_mode="no" ENDIF break off flushkb $info="" $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\TaskManager" IF (ExistKey($ikey) = 0) $ikey_ex="preferences" $taskmgr_prefs= "ac000000a00f00000200000001000000020000000000000020" $taskmgr_prefs=$taskmgr_prefs+"000000de030000d70200000200000000000000010000000200" $taskmgr_prefs=$taskmgr_prefs+"00000300000004000000050000000600000007000000080000" $taskmgr_prefs=$taskmgr_prefs+"00090000000a0000000b0000000c0000000d000000ffffffff" $taskmgr_prefs=$taskmgr_prefs+"6b000000320000002300000046000000460000004600000046" $taskmgr_prefs=$taskmgr_prefs+"000000460000004600000046000000460000003c0000003c00" $taskmgr_prefs=$taskmgr_prefs+"00003c000000460000004b0000000000000000000000" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_BINARY" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $taskmgr_prefs) IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, $result_data_type) <> 0) IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, "REG_BINARY") <> 0) ENDIF ENDIF $info=$info+" taskmgr."+$ikey_ex IF ($debug_mode = "yes") ENDIF ENDIF ENDIF IF ($NT_mode = "yes") $filename="c:\boot.ini" $file_attr=getfileattr($filename) IF setfileattr($filename, 128) ENDIF IF (readprofilestring($filename, "boot loader", "timeout") <> "1") IF (writeprofilestring($filename, "boot loader", "timeout", "1") = 0) $info=$info+" boot.timeout=1" IF ($debug_mode = "yes") ENDIF ENDIF ENDIF IF setfileattr($filename, $file_attr) ENDIF ENDIF IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF $ikey="HKEY_CLASSES_ROOT\regfile\shell" $ikey_ex=ENUMVALUE($ikey, 0) $default_key="edit" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $default_key) IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) ENDIF ENDIF $info=$info+" "+$ikey+"="+$default_key ENDIF $ikey="HKEY_CLASSES_ROOT\vbsfile\shell" $ikey_ex=ENUMVALUE($ikey, 0) $default_key="edit" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (ReadValue($ikey, $ikey_ex) <> $default_key) IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) ENDIF ENDIF $info=$info+" "+$ikey+"="+$default_key ENDIF $max_ikeys=23 DIM $ikeys[$max_ikeys+1] $ikeys[01]="HKEY_CURRENT_USER\Software\Binary Research Ltd\Ghost Explorer\Recent File List" $ikeys[02]="HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" $ikeys[03]="HKEY_CURRENT_USER\Software\Microsoft\Microsoft Management Console\Recent File List" $ikeys[04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\Recent File List" $ikeys[05]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\MS Project\Recent File List" $ikeys[06]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\PowerPoint\Recent File List" $ikeys[07]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Recent File List" $ikeys[08]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\MS Project\Recent File List" $ikeys[09]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\PowerPoint\Recent File List" $ikeys[10]="HKEY_CURRENT_USER\Software\Microsoft\Outlook Express\Recent Stationery List" $ikeys[11]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List" $ikeys[12]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\WordPad\Recent File List" $ikeys[13]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\DesktopStreamMRU" $ikeys[14]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU" $ikeys[15]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU" $ikeys[16]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU" $ikeys[17]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs" $ikeys[18]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" $ikeys[19]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU" $ikeys[20]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Preload" $ikeys[21]="HKEY_CURRENT_USER\Software\Netscape\Netscape Navigator\URL History" $ikeys[22]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\extract" $ikeys[23]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\filemenu" $i=1 WHILE ($i <= $max_ikeys) $ikey=$ikeys[$i] $i=$i+1 IF (ExistKey($ikey) = 0) IF ($debug_mode = "yes") ENDIF $index=0 DO $icode=ENUMVALUE($ikey, $index) IF (len($icode) <> 0) $ivalue=ReadValue($ikey, $icode) $result=DelValue($ikey, $icode) IF ($debug_mode = "yes") IF ($result = 0) ELSE ENDIF ENDIF IF ($result <> 0) $index=$index+1 ENDIF ENDIF UNTIL (len($icode) = 0) $index=$index+1 DO $icode=ENUMVALUE($ikey, $index) IF (len($icode) <> 0) $ivalue=ReadValue($ikey, $icode) $result=DelValue($ikey, $icode) IF ($debug_mode = "yes") IF ($result = 0) ELSE ENDIF ENDIF IF ($result <> 0) $index=$index+1 ENDIF ENDIF UNTIL (len($icode) = 0) ENDIF LOOP $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" IF (Exist($ikey) = 0) $ivalue=ReadValue($ikey, "Recent") IF ($debug_mode = "yes") ENDIF IF (len($ivalue) <> 0) del ExpandEnvironmentVars($ivalue)+"\*.lnk" ENDIF ENDIF $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" IF (Exist($ikey) = 0) $ivalue=ReadValue($ikey, "Recent") IF ($debug_mode = "yes") ENDIF IF (len($ivalue) <> 0) del ExpandEnvironmentVars($ivalue)+"\*.lnk" ENDIF ENDIF del "c:\ffastun*.*" del "c:\file*.chk" del "c:\temp\~*.*" del "c:\temp\*.~*" del "c:\temp\*.??~" del "c:\temp\*.tmp" del "c:\temp\mscreate.dir" del "c:\temp\*.---" IF ($NT_mode = "yes") del "c:\winnt\~*.*" del "c:\winnt\*.~*" del "c:\winnt\*.??~" del "c:\winnt\*.tmp" del "c:\winnt\mscreate.dir" del "c:\winnt\*.---" del "c:\winnt\temp\~*.*" del "c:\winnt\temp\*.~*" del "c:\winnt\temp\*.??~" del "c:\winnt\temp\*.tmp" del "c:\winnt\temp\mscreate.dir" del "c:\winnt\temp\*.---" ELSE del "c:\windows\~*.*" del "c:\windows\*.~*" del "c:\windows\*.??~" del "c:\windows\*.tmp" del "c:\windows\mscreate.dir" del "c:\windows\*.---" del "c:\windows\temp\~*.*" del "c:\windows\temp\*.~*" del "c:\windows\temp\*.??~" del "c:\windows\temp\*.tmp" del "c:\windows\temp\mscreate.dir" del "c:\windows\temp\*.---" ENDIF $max_ikeys=8 DIM $ikeys[$max_ikeys+1] DIM $sub_ikeys[$max_ikeys+1] $ikeys [01]="HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\4.0\AdobeViewer" $sub_ikeys[01]="AVPrecentFile" $ikeys [02]="HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\4.0\AdobeViewer" $sub_ikeys[02]="AVPrecentFile" $ikeys [03]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $sub_ikeys[03]="MRU" $ikeys [04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $sub_ikeys[04]="MRUFlags" $ikeys [05]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $sub_ikeys[05]="MRU" $ikeys [06]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $sub_ikeys[06]="MRUFlags" $ikeys [07]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $sub_ikeys[07]="LastFile" $ikeys [08]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $sub_ikeys[08]="LastType" $i=1 WHILE ($i <= $max_ikeys) $ikey=$ikeys[$i] $sub_ikey=$sub_ikeys[$i] IF (ExistKey($ikey) = 0) IF ($debug_mode = "yes") ENDIF $k=0 WHILE ($k <= 10) $ivalue=ReadValue($ikey, $sub_ikey+$k) $result=DelValue($ikey, $sub_ikey+$k) IF ($debug_mode = "yes") IF ($result = 0) ELSE ENDIF ENDIF $k=$k+1 LOOP ENDIF $i=$i+1 LOOP $info=$info+" cleanup.recent" :end_script IF ($debug_mode = "yes") ENDIF break on flushkb :end
Other examples of the program you will find at the next part. Greetings.
[This message has been edited by MCA (edited 29 July 2000).]
|
|
Top
|
|
|
|
#50793 - 2000-07-29 05:47 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Additional examples:We are using the original kixtart script <i>notepad.kix</i>. 1. run kixstrip notepad1.kix notepad1.txt /nolicense
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
code:
Kixstrip 3.62 (vs 1.35e) input 47 notepad1.kix output 35 notepad1.txt -skip- 12 -blocks- 0 -labels- 1 license: (not.specified)
code:
IF setconsole("hide") ENDIF $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
2. example of reformatting source code. run kixstrip notepad1.kix notepad1.txt /block_check /tab=5.
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
code:
Kixstrip 3.62 (vs 1.35e) input 47 notepad2.kix output 47 notepad2.txt block_check block_count=0 label=1 tab=5 (default) license: (not.specified)
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
3. example of checking source code. run kixstrip notepad1.kix notepad1.txt /block_check /tab=5. There are added three mistakes:
- warning 1: a bracket too must.
IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0)) ; - warning 1 -
- warning 2: during execution it checks the about of brackets in the same
line. in this case it doesn't first find the last one and secondly it doesn't find the firts one. $result_data_type=ReadType($ikey, $ikey_ex) ; - warning 2 -
- warning 3: spelling failure in ENDIF statement.
EENDIF ; - warning 3 -
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0)) ; - warning 1 - $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ; - warning 2 - ELSE $result_data_type="REG_SZ" EENDIF ; - warning 3 - IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
By run: kixstrip notepad3.kix notepad3.txt /block_check /tab=5
code:
Kixstrip 3.62 (vs 1.35e) input 48 notepad3.kix output 48 notepad3.txt block_check -ERROR- block_count=1 label=1 tab=2 (default) Warning KIXSTRIP: 1 block is incompleted. license: (not.specified)
By run: kixstrip notepad3.kix notepad3.txt
code:
Kixstrip 3.62 (vs 1.35e) Warning KIXSTRIP: 14 line incompleted. Warning KIXSTRIP: 24 line incompleted. Warning KIXSTRIP: 25 line incompleted. input 48 notepad3.kix output 36 notepad3.txt -skip- 12 -blocks- 0 -labels- 1 Warning KIXSTRIP: 1 block is incompleted. Warning KIXSTRIP: 3 lines are incompleted. license: MCA - scripting@wanadoo.nl - 2000
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0)) ; - warning 1 - $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ; - warning 2 - ELSE $result_data_type="REG_SZ" EENDIF ; - warning 3 - IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end; ; sat 29-jul-2000 04:17:52 ; ;Warning KIXSTRIP: 1 block is incompleted.
Greetings. MCA
|
|
Top
|
|
|
|
#50794 - 2000-08-08 01:01 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,We have make some extension to the earlier version. Some new options has been add:
- /Debug = insert "line numbers" for each printed line to the output
file. so it is very easily to show which lines are executed or not. by a correct kixtart script you only runs: kixtart input.kix output.kix as command. example: ?"- 1-" ?"-999-"
- /ShowErrors = it insert error messages in the output file. the format
is a kixtart print statement. examples: ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"-------> Warning KIXSTRIP: next line incomplete (square brackets)." ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"-------> Warning KIXSTRIP: next line incomplete (double quotation)."
The help information looks like (kixstrip.exe ?): code:
Kixstrip 3.62 (vs 1.44e) MCA - scripting@wanadoo.nl - 2000 ------------------------------------------------------------------------------ kixstrip [input] [output] /Block_Check or /BC /Combine <-> /NoCombine /Debug <-> /NoDebug /License <-> /NoLicense /License=[var] /Print <-> /NoPrint /ShowErrors or /SE <-> /NoShowErrors or /NoSE /TAB=[num] (default: 4) ? default: /Combine /License /NoDebug /NoPrint /NoShowErrors other: /Block_Check /Tab=2 (auto set: /NoCombine /NoLicense /Print ) /Debug (auto set: /NoLicense /Print /ShowErrors ) /Block_Check (reformat kixtart code inc. block structure ) /Combine (combine lines to one line ) /Debug (insert "line numbers" for each printed line ) /Print (do not remove print statements ) /ShowErrors (insert error messages in output file )
Example of kixtart code: code:
$MACADD = @address $StDir = @startdir call '01login.kix' $filename = $INIFILE $section = 'Survey' $key = 'StartTime' $string = $STIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $ETIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD = '000000000000' Select Case Open(1,'c:\demerge\report.msd') = 0 $line = Readline(1) ;"Physical Station Number: 00CO:4F8C:B1FB" :again WHILE @ERROR = 0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) close (1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line = Readline(1) $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) close (1) goto 'contin' ENDSELECT $line = Readline(1) LOOP close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MESSAGEBOX($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX (8,21,20,61,Å) ; 'shadow' of the box Color g+/n BOX (7,20,19,60,FULL) ; 'border of box $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB $Selection = 'MAC ADDRESS: ' $LenIns1 = 20 + ((40 - (LEN($instruct1))/2) $LenIns2 = 20 + ((40 - (LEN($instruct2))/2) AT(9,$LenIns1) $instruct1 AT(11,24) $instruct2 AT(17,24) $Selection $x = (LEN($Selection) + 24) AT(17,$x) Get $Ans Select Case LEN($Ans) = 12 $MACADD = $Ans goto 'contin' Case LEN($Ans) <> 12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" get $x quit EndSelect EndIF :contin $filename = $INIFILE $section = 'Computer' $key = 'MacAddress' $string = $MACADD $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' call 'messenger.kix'
1a. call of kixstrip.exe input.kix output.kix code:
; ; Kixtart 3.62 ; ; (c) MCA - scripting@wanadoo.nl - 2000 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; $MACADD=@address $StDir=@startdir call '01login.kix' $filename=$INIFILE $section='Survey' $key='StartTime' $string=$STIME $WriteString=WRITEPROFILESTRING('$filename','$section','$key', '$string') $key='EndTime' $string=$ETIME $WriteString=WRITEPROFILESTRING('$filename','$section','$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD='000000000000' Select Case Open(1,'c:\demerge\report.msd')=0 $line=Readline(1) :again WHILE @ERROR=0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD=SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))- 13,4) $MACADD=$MACADD+ SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))-8,4) $MACADD=$MACADD+ SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))-3,4) close(1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line=Readline(1) $MACADD=SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))- 11,12) close(1) goto 'contin' ENDSELECT $line=Readline(1) LOOP close(1) $mheader='Unable to find MacAddress' $message=$mheader+Chr(10)+Chr(10) $message=$message+'WINIPCFG will be launched.'+Chr(10) $message=$message+'Enter MacAddress on the next Survey Screen' $selection=MESSAGEBOX($message,$mheader,16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX(8,21,20,61,Å) Color g+/n BOX(7,20,19,60,FULL) $instruct1='Enter "Adapter Address" below' $instruct2='Example -> 00CO4F8CB1FB $Selection='MAC ADDRESS: ' $LenIns1=20+((40-(LEN($instruct1))/2) $LenIns2=20+((40-(LEN($instruct2))/2) AT(9,$LenIns1)$instruct1 AT(11,24)$instruct2 AT(17,24)$Selection $x=(LEN($Selection)+24) AT(17,$x)Get $Ans Select Case LEN($Ans)=12 $MACADD=$Ans goto 'contin' Case LEN($Ans)<>12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd')<>0 get $x quit EndSelect EndIF :contin $filename=$INIFILE $section='Computer' $key='MacAddress' $string=$MACADD $WriteString=WRITEPROFILESTRING('$filename','$section','$key', '$string') $messenger='Credit4Survey' call 'messenger.kix' ; ; mon 07-aug-2000 22:30:35 ; ;Warning KIXSTRIP: 15 lines are incompleted.
1b. output code:
Warning KIXSTRIP: 8 line incompleted. Warning KIXSTRIP: 9 line incompleted. Warning KIXSTRIP: 12 line incompleted. Warning KIXSTRIP: 13 line incompleted. Warning KIXSTRIP: 28 line incompleted. Warning KIXSTRIP: 29 line incompleted. Warning KIXSTRIP: 39 line incompleted. Warning KIXSTRIP: 40 line incompleted. Warning KIXSTRIP: 51 line incompleted. Warning KIXSTRIP: 52 line incompleted. Warning KIXSTRIP: 61 line incompleted. Warning KIXSTRIP: 63 line incompleted. Warning KIXSTRIP: 64 line incompleted. Warning KIXSTRIP: 88 line incompleted. Warning KIXSTRIP: 89 line incompleted. input 91 input.kix output 88 output.kix -skip- 3 -blocks- 0 -labels- 5 Warning KIXSTRIP: 15 lines are incompleted. /Combine /License: MCA - scripting@wanadoo.nl - 2000 /NoDebug /NoPrint /NoShowErrors
2a. call of kixstrip.exe input.kix output.kix /Block_Check code:
$MACADD = @address $StDir = @startdir call '01login.kix' $filename = $INIFILE $section = 'Survey' $key = 'StartTime' $string = $STIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $ETIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD = '000000000000' Select Case Open(1,'c:\demerge\report.msd') = 0 $line = Readline(1) :again WHILE @ERROR = 0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) close (1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line = Readline(1) $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) close (1) goto 'contin' ENDSELECT $line = Readline(1) LOOP close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MESSAGEBOX($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX (8,21,20,61,Å) Color g+/n BOX (7,20,19,60,FULL) $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB $Selection = 'MAC ADDRESS: ' $LenIns1 = 20 + ((40 - (LEN($instruct1))/2) $LenIns2 = 20 + ((40 - (LEN($instruct2))/2) AT(9,$LenIns1) $instruct1 AT(11,24) $instruct2 AT(17,24) $Selection $x = (LEN($Selection) + 24) AT(17,$x) Get $Ans Select Case LEN($Ans) = 12 $MACADD = $Ans goto 'contin' Case LEN($Ans) <> 12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" get $x quit EndSelect EndIF :contin $filename = $INIFILE $section = 'Computer' $key = 'MacAddress' $string = $MACADD $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' call 'messenger.kix'; ; mon 07-aug-2000 22:30:44 ; ;Warning KIXSTRIP: 15 lines are incompleted.
2b. output code:
Warning KIXSTRIP: 8 line incompleted. Warning KIXSTRIP: 9 line incompleted. Warning KIXSTRIP: 12 line incompleted. Warning KIXSTRIP: 13 line incompleted. Warning KIXSTRIP: 28 line incompleted. Warning KIXSTRIP: 29 line incompleted. Warning KIXSTRIP: 39 line incompleted. Warning KIXSTRIP: 40 line incompleted. Warning KIXSTRIP: 51 line incompleted. Warning KIXSTRIP: 52 line incompleted. Warning KIXSTRIP: 61 line incompleted. Warning KIXSTRIP: 63 line incompleted. Warning KIXSTRIP: 64 line incompleted. Warning KIXSTRIP: 88 line incompleted. Warning KIXSTRIP: 89 line incompleted. input 91 input.kix output 91 output.kix block_check block_count=0 label=5 tab=4 (default) Warning KIXSTRIP: 15 lines are incompleted. /BlockCheck /Combine /NoDebug /NoLicense: (not.specified) /NoShowErrors /Print
3a. call of kixstrip.exe input.kix output.kix /Debug the result will show also the deletion of unused spaces. code:
?"- 1-" $MACADD=@address ?"- 2-" $StDir=@startdir ?"- 3-" call '01login.kix' ?"- 4-" $filename=$INIFILE ?"- 5-" $section='Survey' ?"- 6-" $key='StartTime' ?"- 7-" $string=$STIME ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 8-" $WriteString=WRITEPROFILESTRING('$filename','$section','$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 9-" '$string') ?"- 10-" $key='EndTime' ?"- 11-" $string=$ETIME ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 12-" $WriteString=WRITEPROFILESTRING('$filename','$section','$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 13-" '$string') ?"- 14-" call '02globvar.kix' ?"- 15-" call '03ulckdktp.kix' ?"- 16-" call '04uaffil.kix' ?"- 17-" call '05runmsd.kix' ?"- 18-" :readrpt ?"- 19-" :checkmac ?"- 20-" IF $MACADD='000000000000' ?"- 21-" Select ?"- 22-" Case Open(1,'c:\demerge\report.msd')=0 ?"- 23-" $line=Readline(1) ?"- 24-" :again ?"- 25-" WHILE @ERROR=0 ?"- 26-" SELECT ?"- 27-" CASE INSTR($line,"Physical Station Number:") ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 28-" $MACADD=SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))- ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 29-" 13,4) ?"- 30-" $MACADD=$MACADD+ ?"- 31-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))-8,4) ?"- 32-" $MACADD=$MACADD+ ?"- 33-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))-3,4) ?"- 34-" close(1) ?"- 35-" goto 'contin' ?"- 36-" CASE INSTR($line,"NetBIOS Card Information:") ?"- 37-" $line=Readline(1) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 38-" $MACADD=SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line)))- ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 39-" 11,12) ?"- 40-" close(1) ?"- 41-" goto 'contin' ?"- 42-" ENDSELECT ?"- 43-" $line=Readline(1) ?"- 44-" LOOP ?"- 45-" close(1) ?"- 46-" $mheader='Unable to find MacAddress' ?"- 47-" $message=$mheader+Chr(10)+Chr(10) ?"- 48-" $message=$message+'WINIPCFG will be launched.'+Chr(10) ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 49-" $message=$message+'Enter MacAddress on the next Survey ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 50-" Screen' ?"- 51-" $selection=MESSAGEBOX($message,$mheader,16) ?"- 52-" RUN 'c:\windows\winipcfg.exe' ?"- 53-" :nomac ?"- 54-" Color b/n ?"- 55-" BOX(8,21,20,61,Å) ?"- 56-" Color g+/n ?"- 57-" BOX(7,20,19,60,FULL) ?"- 58-" $instruct1='Enter "Adapter Address" below' ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 59-" $instruct2='Example -> 00CO4F8CB1FB ?"- 60-" $Selection='MAC ADDRESS: ' ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 61-" $LenIns1=20+((40-(LEN($instruct1))/2) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 62-" $LenIns2=20+((40-(LEN($instruct2))/2) ?"- 63-" AT(9,$LenIns1)$instruct1 ?"- 64-" AT(11,24)$instruct2 ?"- 65-" AT(17,24)$Selection ?"- 66-" $x=(LEN($Selection)+24) ?"- 67-" AT(17,$x)Get $Ans ?"- 68-" Select ?"- 69-" Case LEN($Ans)=12 ?"- 70-" $MACADD=$Ans ?"- 71-" goto 'contin' ?"- 72-" Case LEN($Ans)<>12 ?"- 73-" goto 'nomac' ?"- 74-" EndSelect ?"- 75-" Case Open(1,'c:\demerge\report.msd')<>0 ?"- 76-" ?"Unable to open 'report.msd'... survey halted!" ?"- 77-" get $x ?"- 78-" quit ?"- 79-" EndSelect ?"- 80-" EndIF ?"- 81-" :contin ?"- 82-" $filename=$INIFILE ?"- 83-" $section='Computer' ?"- 84-" $key='MacAddress' ?"- 85-" $string=$MACADD ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 86-" $WriteString=WRITEPROFILESTRING('$filename','$section','$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 87-" '$string') ?"- 88-" $messenger='Credit4Survey' ?"- 89-" call 'messenger.kix' ; ; mon 07-aug-2000 22:30:55 ; ;Warning KIXSTRIP: 15 lines are incompleted.
3b. output code:
Warning KIXSTRIP: 8 line incompleted. Warning KIXSTRIP: 9 line incompleted. Warning KIXSTRIP: 12 line incompleted. Warning KIXSTRIP: 13 line incompleted. Warning KIXSTRIP: 28 line incompleted. Warning KIXSTRIP: 29 line incompleted. Warning KIXSTRIP: 39 line incompleted. Warning KIXSTRIP: 40 line incompleted. Warning KIXSTRIP: 51 line incompleted. Warning KIXSTRIP: 52 line incompleted. Warning KIXSTRIP: 61 line incompleted. Warning KIXSTRIP: 63 line incompleted. Warning KIXSTRIP: 64 line incompleted. Warning KIXSTRIP: 88 line incompleted. Warning KIXSTRIP: 89 line incompleted. input 91 input.kix output 89 output.kix -skip- 2 -blocks- 0 -labels- 5 Warning KIXSTRIP: 15 lines are incompleted. /Combine /Debug /NoLicense: (not.specified) /Print /ShowErrors
4a. call of kixstrip.exe input.kix output.kix /Block_Check /Debug the result will show that unused spaces aren't deleted, because the selected option was /Block_Check. code:
?"- 1-" $MACADD = @address ?"- 2-" $StDir = @startdir ?"- 3-" call '01login.kix' ?"- 4-" $filename = $INIFILE ?"- 5-" $section = 'Survey' ?"- 6-" $key = 'StartTime' ?"- 7-" $string = $STIME?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 8-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 9-" '$string') ?"- 10-" $key = 'EndTime' ?"- 11-" $string = $ETIME ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 12-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 13-" '$string') ?"- 14-" call '02globvar.kix' ?"- 15-" call '03ulckdktp.kix' ?"- 16-" call '04uaffil.kix' ?"- 17-" call '05runmsd.kix' ?"- 18-" :readrpt ?"- 19-" :checkmac ?"- 20-" IF $MACADD = '000000000000' ?"- 21-" Select ?"- 22-" Case Open(1,'c:\demerge\report.msd') = 0 ?"- 23-" $line = Readline(1) ?"- 24-" :again ?"- 25-" WHILE @ERROR = 0 ?"- 26-" SELECT ?"- 27-" CASE INSTR($line,"Physical Station Number:") ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 28-" $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 29-" 13 , 4 ) ?"- 30-" $MACADD = $MACADD + ?"- 31-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) ?"- 32-" $MACADD = $MACADD + ?"- 33-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) ?"- 34-" close (1) ?"- 35-" goto 'contin' ?"- 36-" ?"- 37-" CASE INSTR($line,"NetBIOS Card Information:") ?"- 38-" $line = Readline(1) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 39-" $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 40-" 11 , 12 ) ?"- 41-" close (1) ?"- 42-" goto 'contin' ?"- 43-" ?"- 44-" ENDSELECT ?"- 45-" $line = Readline(1) ?"- 46-" LOOP ?"- 47-" close (1) ?"- 48-" $mheader = 'Unable to find MacAddress' ?"- 49-" $message = $mheader + Chr(10) + Chr(10) ?"- 50-" $message = $message + 'WINIPCFG will be launched.' + Chr(10) ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 51-" $message = $message + 'Enter MacAddress on the next Survey ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 52-" Screen' ?"- 53-" $selection = MESSAGEBOX($message, $mheader, 16) ?"- 54-" RUN 'c:\windows\winipcfg.exe' ?"- 55-" :nomac ?"- 56-" Color b/n ?"- 57-" BOX (8,21,20,61,Å) ?"- 58-" Color g+/n ?"- 59-" BOX (7,20,19,60,FULL) ?"- 60-" $instruct1 = 'Enter "Adapter Address" below' ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 61-" $instruct2 = 'Example -> 00CO4F8CB1FB ?"- 62-" $Selection = 'MAC ADDRESS: ' ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 63-" $LenIns1 = 20 + ((40 - (LEN($instruct1))/2) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 64-" $LenIns2 = 20 + ((40 - (LEN($instruct2))/2) ?"- 65-" AT(9,$LenIns1) $instruct1 ?"- 66-" AT(11,24) $instruct2 ?"- 67-" AT(17,24) $Selection ?"- 68-" $x = (LEN($Selection) + 24) ?"- 69-" AT(17,$x) Get $Ans ?"- 70-" Select ?"- 71-" Case LEN($Ans) = 12 ?"- 72-" $MACADD = $Ans ?"- 73-" goto 'contin' ?"- 74-" Case LEN($Ans) <> 12 ?"- 75-" goto 'nomac' ?"- 76-" EndSelect ?"- 77-" Case Open(1,'c:\demerge\report.msd') <> 0 ?"- 78-" ? "Unable to open 'report.msd'... survey halted!" ?"- 79-" get $x ?"- 80-" quit ?"- 81-" EndSelect ?"- 82-" EndIF ?"- 83-" :contin ?"- 84-" $filename = $INIFILE ?"- 85-" $section = 'Computer' ?"- 86-" $key = 'MacAddress' ?"- 87-" $string = $MACADD ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 88-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 89-" '$string') ?"- 90-" $messenger = 'Credit4Survey' ?"- 91-" call 'messenger.kix' ; ; mon 07-aug-2000 22:42:43 ; ;Warning KIXSTRIP: 15 lines are incompleted.
4b. output code:
Warning KIXSTRIP: 8 line incompleted. Warning KIXSTRIP: 9 line incompleted. Warning KIXSTRIP: 12 line incompleted. Warning KIXSTRIP: 13 line incompleted. Warning KIXSTRIP: 28 line incompleted. Warning KIXSTRIP: 29 line incompleted. Warning KIXSTRIP: 39 line incompleted. Warning KIXSTRIP: 40 line incompleted. Warning KIXSTRIP: 51 line incompleted. Warning KIXSTRIP: 52 line incompleted. Warning KIXSTRIP: 61 line incompleted. Warning KIXSTRIP: 63 line incompleted. Warning KIXSTRIP: 64 line incompleted. Warning KIXSTRIP: 88 line incompleted. Warning KIXSTRIP: 89 line incompleted. input 91 input.kix output 91 output.kix block_check block_count=0 label=5 tab=4 (default) Warning KIXSTRIP: 15 lines are incompleted. /BlockCheck /Combine /Debug /NoLicense: (not.specified) /Print /ShowErrors /TAB=4
Each reaction of remark is welcome. greetings.
|
|
Top
|
|
|
|
#50795 - 2000-08-15 11:52 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,A new version of the kixstrip program is out. A lot of new functions have been added:
- a script will be handle faster.
- a progress bar about the amount of lines currently handled.
- an elapse time counter.
- new options:
/headers = a footer will be inserted automatically after detection of a warning. /translate = commands, macros, variables will be translate by default.
- new capability:
a block starting with a line with symbol ";(begin)" and ending with a line with symbol ";(end) will automatically be removed.
- more possible problems about commands and functions will be checked.
more error report information will be added. more user information will be showed.
- complex block structures can be handle. it is no longer necessary that
a block structures commands start a the beginning of a line. f.e. if (@wksta = "server") ? "welcome to server" else ? "welcome "+@userid endif can be handle.
- structures are using the new format of strings. See kixtart 3.62 manual (pag 22)
old style format: "Welcome to @wksta" new style format: "Welcome to "+@wksta other advices and remarks of manual kixtart 3.62 are also be using. f.e. IF(1=1)?"ok"else?"error"endif must be IF (1=1) ?"ok" ELSE ?"error" ENDIF remark: by option /Block_check the format will not be changed. without option /Block_Check additional spaces will be added or superfluous spaces will be removed.
- commands start also on a newline after selection of option "/Block_Check".
- commands will be translate to uppercase by default.
macros + variables will be lowercase by default. the options "/translate" + "/notranslate: may influence it.
- all TAB characters will be replaced by spaces.
site: http://home.wanadoo.nl/scripting program: kixstrip.exe (vs 1.70) Structure after selection of "/Block_Check" will be:
code:
DO ...command part... UNTIL ...logical part... ...command part... ...command part... IF ...logical part... ...command part... ...command part... ELSE ...command part... ENDIF ...command part...
SELECT CASE ...logical part... ...command part... ...command part... CASE ...logical part... ...command part... ...command part... ENDSELECT ...command part...
WHILE ...logical part... ...command part... ...command part... LOOP ...command part...
Actual help information. created with kixstrip ?:
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 ------------------------------------------------------------------------------ kixstrip [input] [output] /Block_Check or /BC <-> /NoBlock_Check or /NoBC /Combine <-> /NoCombine /Debug <-> /NoDebug /Headers <-> /NoHeaders /License <-> /NoLicense /License=[var] /Print <-> /NoPrint /Show_Errors or /SE <-> /NoShow_Errors or /NoSE /TAB=[num] (default: 6) <-> /NoTab /Translate <-> /NoTranslate ? default: /Combine /Headers /License /NoDebug /NoPrint /NoShow_Errors /NoTab other: - /Block_Check /Tab=2 (auto set: /NoCombine /NoLicense /Print ) /Debug (auto set: /NoLicense /Print /Show_Errors ) - /Block_Check (reformat kixtart code inc. block structure ) /Combine (combine lines to one line ) /Headers (insert summary report as footer ) /Debug (insert "line numbers" for each printed line ) /Print (do not remove print statements ) /Show_Errors (insert error messages in output file ) /Translate (convert keywords to upper/lower-case )
Explanation:
- /Block_Check
a reformat of block structure. a kind of checks will be done. no insertion of header. by possible warnings a footer will be inserted. footer can be suppress by option "/NoHeaders".
- /Combine
a lines will be combine to one line. labels will always start a newline.
- /Debug
insert "line numbers" for each printed line. f.e. if (@wksta = "server") ? "welcome to server" else ? "welcome "+@userid endif ? @date will be ?"- 1-" IF (@wksta = "server) ? "welcome to server" ELSE ?"welcome "+@userid ENDIF ?"- 2-" ? @date after selection of "/Debug" automatically "/NoCombine", "/NoLicense" and "/Print" will be selected.
- /Headers
insert a summary report as footer. automatically a footer will be inserted when the program find possible problems.
- /License
a personal license note will be added.
- /Print
do not remove print statement from a line. a line started with "?" symbol will be look at a print statement. remark: by no specification of any option automatically those print-statement lines will be removed.
- /Show_Errors
insert a summary report as footer. even we don't detected any possible error.
- TAB
amount of spaces which will be inserted.
- /Translate
translate keywords to upper- and lowercase. commands and boolean operators will be uppercase. macros and variables will be lowercase.
A short list of possible errors:
- line incomplete "single quotation".
- line incomplete "double quotation".
- line incomplete "left square brackets".
- line incomplete "right square brackets".
- line incomplete "left parenthesis".
- line incomplete "right parenthesis".
- block "do/until" incompleted. starting point of block structure missing.
f.e. if ... ... else ... endif endif
- block "if/else/endif" incompleted. starting point of block structure missing.
- block "select/case/endselect" incompleted. starting point of block structure missing.
- block "while/loop" incompleted. starting point of block structure missing.
- block incompleted.
- line incompleted.
- line contains unknown function.
f.e. (old style format) @wksta.txt new style format: @wksta+".txt"
- line contains too much keywords. rerun program with output as input file.
it is possible that you are using too much keywords in one line. to prevent an unwanted range check error we have limited it to 1024 keywords. after a rerun of the program the next 1024 keywords of that line will be interpreted.
The user screen information can be:
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 8000 ....................................E(8720) Warning KIXSTRIP: 6355 "@wksta.txt", 6356 "@wksta.txt", 6360 "@wksta.txt", 6402 "@wksta.txt", 6403 "@wksta.txt" line contains unknown function. Kixstrip 3.62 (vs 1.70e) 81.28 (sec) input 8720 kixtest.kix output 6908 kixtest.new -skip- 1812 -blocks- 0 -labels- 1 Warning KIXSTRIP: 5 lines contain unknown function. options: /Combine /Headers /NoBlock_Check /NoDebug /NoPrint /NoShow_Errors /NoTAB /NoTranslate /License: MCA - scripting@wanadoo.nl - 2000
Benchmark info about 100 lines/second. Remarks
Greetings
|
|
Top
|
|
|
|
#50796 - 2000-08-15 11:56 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
The original file:
code:
IF (@inwin = 1) $NT_mode="yes" ELSE $NT_mode="no" ENDIF ; $memory=0 IF ($NT_mode = "yes") ; ;Physical Memory (K) ; Total: 64,948 ; Available: 31,840 ; File Cache: 14,652 ; IF (Exist("c:\temp\memory.txt") = 1) del "c:\temp\"+@wksta.txt ENDIF cd "c:\temp" shell "%comspec% /c winmsd /s /f" ; - /s = summary; /f = to file - shell '%comspec% /c type '+@wksta.txt+' | find " Total:" >c:\temp\memory.txt' ; IF (Open(9,"c:\temp\memory.txt") = 0) WHILE (@error = 0) $result=ReadLine(9) $pos=INSTR(LCASE($result), "total:") IF ($pos <> 0) $memory=substr($result,$pos+6,len($result)-$pos-1) ENDIF LOOP IF (CLOSE(9) <> 0) ENDIF ENDIF ELSE ; ;Memory Type Total Used Free ;---------------- -------- -------- -------- ;Conventional 640K 86K 554K ;Upper 0K 0K 0K ;Reserved 0K 0K 0K ;Extended (XMS) 65.472K ? 129.764K ;---------------- -------- -------- -------- ;Total memory 66.112K ? 130.318K ; IF (Exist("c:\temp\mem.txt") = 1) del "c:\temp\mem.txt" ENDIF shell "%comspec% /c mem >c:\temp\mem.txt" shell '%comspec% /c type c:\temp\mem.txt | find "Total memory" >c:\temp\memory.txt' ; IF (Open(9,"c:\temp\memory.txt") = 0) WHILE (@error = 0) $result=ReadLine(9) $pos=INSTR(LCASE($result), "total memory") IF ($pos <> 0) $memory=substr($result,41,len($result)-41) ENDIF LOOP IF (CLOSE(9) <> 0) ENDIF ENDIF ENDIF IF (Exist("c:\temp\memory.txt") = 1) del "c:\temp\"+@wksta.txt ENDIF IF (Exist("c:\temp\mem.txt") = 1) del "c:\temp\mem.txt" ENDIF IF (Exist("c:\temp\memory.txt") = 1) del "c:\temp\memory.txt" ENDIF ; ? "Memory: "+$memory+" KBytes"
Output of kixstrip memory.kix memory.new (with warnings): code:
;($begin) ; ; Kixtart 3.62 ; ; (c) MCA - scripting@wanadoo.nl - 2000 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; ;($end) if (@inwin=1) $nt_mode="yes" else $nt_mode="no" endif $memory=0 if ($nt_mode="yes") if (Exist("c:\temp\memory.txt")=1) del "c:\temp\"+@wksta.txt endif cd "c:\temp" shell "%comspec% /c winmsd /s /f" shell '%comspec% /c type '+@wksta.txt+' | find " Total:" >c:\temp\memory.txt' if (Open(9,"c:\temp\memory.txt")=0) while (@error=0) $result=ReadLine(9) $pos=INSTR(LCASE($result),"total:") if ($pos<>0) $memory=substr($result,$pos+6,len($result)-$pos-1) endif loop if (CLOSE(9)<>0) endif endif else if (Exist("c:\temp\mem.txt")=1) del "c:\temp\mem.txt" endif shell "%comspec% /c mem >c:\temp\mem.txt" shell '%comspec% /c type c:\temp\mem.txt | find "Total memory" >c:\temp\memory.txt' if (Open(9,"c:\temp\memory.txt")=0) while (@error=0) $result=ReadLine(9) $pos=INSTR(LCASE($result),"total memory") if ($pos<>0) $memory=substr($result,41,len($result)-41) endif loop if (CLOSE(9)<>0) endif endif endif if (Exist("c:\temp\memory.txt")=1) del "c:\temp\"+@wksta.txt endif if (Exist("c:\temp\mem.txt")=1) del "c:\temp\mem.txt" endif if (Exist("c:\temp\memory.txt")=1) del "c:\temp\memory.txt" endif ;($begin) ; ; tue 15-aug-2000 11:31:55 ; ;Warning KIXSTRIP: some lines contains errors or possible errors. ; 3 line contains unknown function. ;Informative KIXSTRIP: 15 block_structures found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ;Informative KIXSTRIP: 4 SHELL ; ;($end) ;($begin) ; ;Warning KIXSTRIP: 16 "@wksta.txt", 20 "@wksta.txt", 63 "@wksta.txt" line contains unknown function. ; ;($end)
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 1 ....E(72) Warning KIXSTRIP: 16 "@wksta.txt", 20 "@wksta.txt", 63 "@wksta.txt" line contains unknown function. Kixstrip 3.62 (vs 1.70e) 0.61 (sec) input 72 memory.kix output 51 memory.new -skip- 21 -blocks- 0 -labels- 0 Warning KIXSTRIP: 3 lines contain unknown function. options: /Combine /Headers /NoBlock_Check /NoDebug /NoPrint /NoShow_Errors /NoTAB /NoTranslate /License: MCA - scripting@wanadoo.nl - 2000
Output of kixstrip memory.kix memory.new /block_check /debug (with warnings): code:
?"- 1-" $nt_mode="' ; <- warning 1-> '" ?"- 2-" IF (@inwin = 1) $NT_mode="yes" ELSE $nt_mode="no" ENDIF ?"- 3-" ENDIF ; <- warning 2 -> ; -------> Warning KIXSTRIP: 3 block "if/else/endif" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 3 block incompleted. ?"- 4-" IF (@inwin = 1) $NT_mode="yes" ELSE $nt_mode="no" ENDIF ?"- 5-" IF(@inwin = 1)$NT_mode="yes" ELSE $NT_mode="no" ENDIF ?"- 6-" ?"- 7-" ; ?"- 8-" $memory=0 ?"- 9-" IF ($nt_mode = "yes")) ; <- warning 3 -> ; -------> Warning KIXSTRIP: 9 line incomplete "right parenthesis". ; -------> Warning KIXSTRIP: 9 line incompleted. ?"- 10-" ; ?"- 11-" ;Physical Memory (K) ?"- 12-" ; Total: 64,948 ?"- 13-" ; Available: 31,840 ?"- 14-" ; File Cache: 14,652 ?"- 15-" ; ?"- 16-" IF (Exist("c:\temp\memory.txt") = 1) ?"- 17-" DEL "c:\temp\"+@wksta.txt ; -------> Warning KIXSTRIP: 17 line contains unknown function. ?"- 18-" ENDIF ?"- 19-" CD "c:\temp" ?"- 20-" SHELL "%comspec% /c winmsd /s /f" ; - /s = summary; /f = to file - ?"- 21-" SHELL '%comspec% /c type '+@wksta.txt+' | find " Total:" >c:\temp\memory.txt' ; -------> Warning KIXSTRIP: 21 line contains unknown function. ?"- 22-" ; ?"- 23-" IF (Open(9,"c:\temp\memory.txt") = 0) ?"- 24-" WHILE (@error = 0) ?"- 25-" $result=ReadLine(9) ?"- 26-" $pos=INSTR(LCASE($result), "total:") ?"- 27-" IF ($pos <> 0) ?"- 28-" $memory=substr($result,$pos+6,len($result)-$pos-1) ?"- 29-" ENDIF ?"- 30-" LOOP ?"- 31-" IF (CLOSE(9) <> 0) ?"- 32-" ENDIF ?"- 33-" ENDIF ?"- 34-" ELSE ?"- 35-" ; ?"- 36-" ;Memory Type Total Used Free ?"- 37-" ;---------------- -------- -------- -------- ?"- 38-" ;Conventional 640K 86K 554K ?"- 39-" ;Upper 0K 0K 0K ?"- 40-" ;Reserved 0K 0K 0K ?"- 41-" ;Extended (XMS) 65.472K ? 129.764K ?"- 42-" ;---------------- -------- -------- -------- ?"- 43-" ;Total memory 66.112K ? 130.318K ?"- 44-" ; ?"- 45-" IF (Exist("c:\temp\mem.txt") = 1) ?"- 46-" DEL "c:\temp\mem.txt" ?"- 47-" ENDIF ?"- 48-" SHELL "%comspec% /c mem >c:\temp\mem.txt" ?"- 49-" SHELL '%comspec% /c type c:\temp\mem.txt | find "Total memory" >c:\temp\memory.txt' ?"- 50-" ; ?"- 51-" IF (Open(9,"c:\temp\memory.txt") = 0) ?"- 52-" WHILE (@error = 0) ?"- 53-" $result=ReadLine(9) ?"- 54-" $pos=INSTR(LCASE($result), "total memory") ?"- 55-" IF ($pos <> 0) ?"- 56-" $memory=substr($result,41,len($result)-41) ?"- 57-" ENDIF ?"- 58-" LOOP ?"- 59-" IF (CLOSE(9) <> 0) ?"- 60-" ENDIF ?"- 61-" ENDIF ?"- 62-" ENDIF ?"- 63-" IF (Exist("c:\temp\memory.txt") = 1) ?"- 64-" DEL "c:\temp\"+@wksta.txt ; -------> Warning KIXSTRIP: 64 line contains unknown function. ?"- 65-" ENDIF ?"- 66-" IF (Exist("c:\temp\mem.txt") = 1) ?"- 67-" DEL "c:\temp\mem.txt" ?"- 68-" ENDIF ?"- 69-" IF (Exist("c:\temp\memory.txt") = 1) ?"- 70-" DEL "c:\temp\memory.txt" ?"- 71-" ENDIF ?"- 72-" ; ?"- 73-" ? "Memory: "+$memory+" KBytes";($begin) ; ; tue 15-aug-2000 09:35:30 ; ;Warning KIXSTRIP: 1 block is incompleted. ; missing "do/until", "if/else/endif", "while/loop" ; "select/case/endselect" statement. ; - do/until [0:0] ; - if/else/endif [15:4:16] ; - select/case/endselect [0:0:0] ; - while/loop [2:2] ;Warning KIXSTRIP: 1 line is incompleted. ;Warning KIXSTRIP: some lines contains errors or possible errors. ; 1 line incomplete "right parenthesis". ; 1 block "if/else/endif" incompleted. starting point of block structure missing. ; 1 block incompleted. ; 1 line incompleted. ; 3 line contains unknown function. ;Informative KIXSTRIP: 17 block_structures found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ;Informative KIXSTRIP: 4 SHELL ; ;($end) ;($begin) ; ;Warning KIXSTRIP: 9 line incomplete "right parenthesis". ;Warning KIXSTRIP: 3 block "if/else/endif" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 3 block incompleted. ;Warning KIXSTRIP: 9 line incompleted. ;Warning KIXSTRIP: 17 "@wksta.txt", 21 "@wksta.txt", 64 "@wksta.txt" line contains unknown function. ; ;($end)
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 1 ....E(72) Warning KIXSTRIP: 16 "@wksta.txt", 20 "@wksta.txt", 63 "@wksta.txt" line contains unknown function. Kixstrip 3.62 (vs 1.70e) 0.66 (sec) input 72 memory.kix output 51 memory.new -skip- 21 -blocks- 0 -labels- 0 Warning KIXSTRIP: 3 lines contain unknown function. options: /Combine /Headers /NoBlock_Check /NoDebug /NoPrint /NoShow_Errors /NoTAB /NoTranslate /License: MCA - scripting@wanadoo.nl - 2000
Output of kixstrip memory.new memory.kix /block_check /debug /headers (without warnings): code:
;($begin) ; ; Kixtart 3.62 ; ; (c) MCA - scripting@wanadoo.nl - 2000 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; ;($end) if (@inwin=1) $nt_mode="yes" else $nt_mode="no" endif $memory=0 if ($nt_mode="yes") if (Exist("c:\temp\memory.txt")=1) del "c:\temp\"+@wksta+".txt" endif cd "c:\temp" shell "%comspec% /c winmsd /s /f" shell '%comspec% /c type '+@wksta+'.txt | find " Total:" >c:\temp\memory.txt' if (Open(9,"c:\temp\memory.txt")=0) while (@error=0) $result=ReadLine(9) $pos=INSTR(LCASE($result),"total:") if ($pos<>0) $memory=substr($result,$pos+6,len($result)-$pos-1) endif loop if (CLOSE(9)<>0) endif endif else if (Exist("c:\temp\mem.txt")=1) del "c:\temp\mem.txt" endif shell "%comspec% /c mem >c:\temp\mem.txt" shell '%comspec% /c type c:\temp\mem.txt | find "Total memory" >c:\temp\memory.txt' if (Open(9,"c:\temp\memory.txt")=0) while (@error=0) $result=ReadLine(9) $pos=INSTR(LCASE($result),"total memory") if ($pos<>0) $memory=substr($result,41,len($result)-41) endif loop if (CLOSE(9)<>0) endif endif endif if (Exist("c:\temp\memory.txt")=1) del "c:\temp\"+@wksta+".txt" endif if (Exist("c:\temp\mem.txt")=1) del "c:\temp\mem.txt" endif if (Exist("c:\temp\memory.txt")=1) del "c:\temp\memory.txt" endif ;($begin) ; ; tue 15-aug-2000 11:38:05 ; ;Informative KIXSTRIP: no errors found. ; ;Informative KIXSTRIP: 15 block_structures found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ;Informative KIXSTRIP: 4 SHELL ; ;($end)
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 1 ....E(72) Kixstrip 3.62 (vs 1.70e) 0.60 (sec)
input 72 mem3 output 51 mem3d -skip- 21 -blocks- 0 -labels- 0 Informative KIXSTRIP: no errors found. options: /Combine /Headers /NoBlock_Check /NoDebug /NoPrint /NoShow_Errors /NoTAB /NoTranslate /License: MCA - scripting@wanadoo.nl - 2000
|
|
Top
|
|
|
|
#50797 - 2000-08-15 11:59 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Another example (original):code:
;--------------------------------------------------------------------- ; ; This kixtart script tries to scan your network and ; find any share drives and local usernames is ; possible. It is writen for NT Administartors ; and I do not take any resposibility for malign ; use of it especially with the aggressive scan. ; You can see the scanning results at your screen; ; a report file also will be created on current directory. ; ; All you have to do is to specify the ip range you want to ; scan when you promped with the following syntax : ; ; ; ; *.12.12.* will scan all the addrsses ; from 1 to 254 .12.12. from 1 to 254 ; 12.12.[100-110].100 will scan all the addrsses ; 12.12. from 100 to 110 .100 ; other valid ip ranges can be: ; *.*.*.* or [1-10].*.[200-223].* ; ; ; ; Please send me your commnents ; or any improvements you have made on it ! ; ; ; George Bouras ; bourasg@unisystems.gr ; ;--------------------------------------------------------------------- ; Here is just some information boxes and the prompt for the ip range cls break on dim $inboxmsg[10] :chooserange color r+/n box(0,0,2,39,double) box(0,40,2,79,double) box(3,0,5,39,double) box(3,40,5,79,double) color c+/n at(1,2) "Local Ip Address : " @ipaddress0 at(1,42) "Local host Name : " @hostname at(4,2) @mdayno " " @day " " @year " ** " @time at(4,42) "Current dir : " @curdir color g+/n box(10,5,14,73,double) color c+/n at(12,7) " Enter the IP range : " color y+/n gets $string ; Lets check if there are any dots in the range at all ! if len($string)=0 gosub badip goto "chooserange" endif $n=0 do $dot=substr($string,$n,1) if $dot=. goto "dotok" endif $n=$n+1 until $n=len($string) gosub badip goto "chooserange" endif :dotok :choosemode color g+/n box(16,5,20,73,double) color c+/n at(18,7) " Press " color y+/n "1" color c+/n " for Quick" color y+/n " 2 " color c+/n "for Normal" color y+/n " 3 " color c+/n "for Aggresive Scan or" color y+/n " X " color c+/n "to exit" at(23,78) get $mode if $mode=x goto "end" endif if $mode=1 or $mode=2 or $mode=3 else goto "choosemode" endif ; -------- Now I am going to analyse the IP range --------- ; -------- and found the boundaries of each octet --------- $inboxmsg[1] = "Please wait while I analyse" $inboxmsg[2] = " the IP range" $boxstyle = double gosub dosbox $delimeter=. gosub split if $nomore_sub <> 4 gosub badip goto "chooserange" endif if substr($sector1,1,1)="[" $n=1 do $dot = substr($sector1,$n,1) $n=$n+1 if $n=len($sector1) and $dot <> "-" gosub badip goto "chooserange" endif until $dot="-" $a1=val(rtrim(ltrim(substr($sector1,2,$n-3)))) $a2=val(rtrim(ltrim(substr($sector1,$n,len($sector1)-$n)))) else if substr($sector1,1,1) <> "*" $a1=val($sector1) $a2=$a1 endif if substr($sector1,1,1)="*" $a1=1 $a2=254 endif endif if substr($sector2,1,1)="[" $n=1 do $dot = substr($sector2,$n,1) $n=$n+1 if $n=len($sector2) and $dot <> "-" gosub badip goto "chooserange" endif until $dot="-" $b1=val(rtrim(ltrim(substr($sector2,2,$n-3)))) $b2=val(rtrim(ltrim(substr($sector2,$n,len($sector2)-$n)))) else if substr($sector2,1,1) <> "*" $b1=val($sector2) $b2=$b1 endif if substr($sector2,1,1)="*" $b1=1 $b2=254 endif endif if substr($sector3,1,1)="[" $n=1 do $dot = substr($sector3,$n,1) $n=$n+1 if $n=len($sector3) and $dot <> "-" gosub badip goto "chooserange" endif until $dot="-" $c1=val(rtrim(ltrim(substr($sector3,2,$n-3)))) $c2=val(rtrim(ltrim(substr($sector3,$n,len($sector3)-$n)))) else if substr($sector3,1,1) <> "*" $c1=val($sector3) $c2=$c1 endif if substr($sector3,1,1)="*" $c1=1 $c2=254 endif endif if substr($sector4,1,1)="[" $n=1 do $dot = substr($sector4,$n,1) $n=$n+1 if $n=len($sector4) and $dot <> "-" gosub badip goto "chooserange" endif until $dot="-" $d1=val(rtrim(ltrim(substr($sector4,2,$n-3)))) $d2=val(rtrim(ltrim(substr($sector4,$n,len($sector4)-$n)))) else if substr($sector4,1,1) <> "*" $d1=val($sector4) $d2=$d1 endif if substr($sector4,1,1)="*" $d1=1 $d2=254 endif endif ;---------------------------------------------------------------------------------- ; ------------- lets count now the total number of IPs we must scan ... ;---------------------------------------------------------------------------------- $n= ($a2-$a1+1)*($b2-$b1+1)*($c2-$c1+1)*($d2-$d1+1) $inboxmsg[1] = "You select to scan $n" $inboxmsg[2] = " IP Addresses." $inboxmsg[3] = " Please wait ..." $boxstyle = double gosub dosbox sleep 2 ; ------------- What I have now is the boundaries ----------------------- ; ------------- of every octet. ----------------------------------------- ; ------------- $a1 and $a2 for the first octet ------------------------- ; ------------- $b1 and $b2 for the second octet ------------------------ ; ------------- $c1 and $c2 for the third octet ------------------------- ; ------------- $d1 and $d2 for the forth octet ------------------------- ; ------------- so we can go for the super loop !!! --------------------- if exist (@curdir + "\cache.log") del @curdir + "\cache.log" endif if $null=open(1,@curdir + "\cache.log",3) goto "checklog" endif
$inboxmsg[1] = "Could not create the transaction file" $inboxmsg[2] = " inside the current directory." $inboxmsg[3] = " Proccess stoped" $inboxmsg[4] = " Press any key to exit" $boxstyle = double gosub dosbox get $null goto "end" :checklog $null=close(1) $logfile=@curdir + "\" + @mdayno + @month + @year + "@@" + substr(@time,1,2) + substr(@time,4,2) + substr(@time,7,2) + ".txt" if exist($logfile) del $logfile endif if $null=open(2,$logfile,5) goto "check_nt" endif $null=close(2) $inboxmsg[1] = "Could not create the report file" $inboxmsg[2] = " Proccess stoped." $inboxmsg[3] = " Press any key to exit." $boxstyle = double gosub dosbox get $null goto "end" :check_nt if $mode=3 else goto "startloop" endif if @inwin <> 1 $inboxmsg[1] = "Sorry but you can Perform an" $inboxmsg[2] = " Aggressive scan only from" $inboxmsg[3] = " an WinNT or Win2000 box" $inboxmsg[4] = " Press anu key to exit" $boxstyle = double gosub dosbox $null=close(2) get $null goto "end" endif
shell "%comspec% /c global.exe > " + @curdir + "\cache.log" cls if @error=1 $null="global.exe" goto "notexist" endif shell "%comspec% /c local.exe > " + @curdir + "\cache.log" cls if @error=1 $null="local.exe" else goto "startloop" endif :notexist $inboxmsg[1] = "I could not locate the file : " + $null $inboxmsg[2] = "This file is a NT Resource kit utility" $inboxmsg[3] = "Place this file somewhere to your path" $inboxmsg[4] = " or install NT resourse kit and try" $inboxmsg[5] = " again. Press any key to exit" $boxstyle = double gosub dosbox $null=close(2) get $null goto "end" :startloop color r+/n cls ? ? box(0,0,2,24,single) color c+/n at(1,1) select case $mode=1 " Quick " case $mode=2 " Normal " case $mode=3 "Aggressive " endselect "scan started" ? ? ; Even if we can a use a loop procedure with four nested ; loops in order to do all the scanning, we are going to ; use two different loop procedures (every one with four ; nested loops) . The one loop procedure will be for the ; quick and normal scan and the other loop procedure will ; be only for the aggressive scan. The reason is to speed ; up the script execution during the scan as many if ; statements will be executed once and not every time a ; new ip address will be proccessed. So may the script ; code will be a litle bit biger but it will finish sooner.
if val($mode) <= 2 goto "scan12" else goto "scan3" endif ; --------- start loop for quick or normal scan --------- :scan12 $b1_temp=$b1 $c1_temp=$c1 $d1_temp=$d1 while $a2=>$a1 $b1=$b1_temp while $b2=>$b1 $c1=$c1_temp while $c2=>$c1 $d1=$d1_temp while $d2=>$d1 ; **************************************************************** ; ************ Here is the code inside the inner loop ************ ; **************************************************************** $ip="$a1.$b1.$c1.$d1" select case $mode=1 shell "%comspec% /c ping -n 1 -l 64 -w 1000 " + $ip + " > " + @curdir + "\cache.log" case $mode=2 shell "%comspec% /c ping -a -n 1 -l 64 -w 2000 " + $ip + " > " + @curdir + "\cache.log" endselect ; lets wait a litle until the log file created ... while open(1, @curdir + "\cache.log" ,2) <> 0 sleep 1 loop readline(1) readline(1) $data=readline(1) if $mode=1 $name="undefined" goto "bypassname" endif $n=0 $k=0 $dot="" do $dot=substr($data,$n,1) if $dot="[" or $dot="]" $k=$k+1 endif $n=$n+1 until $n=len($data) if $k=2 ; this means that the name retreived $n=0 do $dot=substr($data,$n,1) $n=$n+1 until $dot="[" $name=substr($data,9,$n-11) else ; the name could not be retreived $name="undefined" endif :bypassname readline(1) readline(1) readline(1) $data=readline(1) ; now I am going to check if the host is alive or not if substr($data,1,5)="Reply" $result="alive" else $result="down" endif select case $mode=1 color w/n " host " color c+/n $ip chr(9) color w/n " is " if $result="down" color r+/n else color g+/n endif $result ? $scan_result="host " + $ip + " is " + $result case $mode=2 color w/n "host " color c+/n $ip chr(9) color w/n " with name " if $name="undefined" color r+/n else color g+/n endif $name chr(9) color w/n " is " if $result="down" color r+/n else color g+/n endif $result ? $scan_result="host " + $ip + " with name " + $name + " is " + $result endselect $null=writeline(2,$scan_result+chr(13)+chr(10)) $null=close(1) ; **************************************************************** ; *************** Here stops the code of inner loop ************** ; **************************************************************** $d1=$d1+1 loop $c1=$c1+1 loop $b1=$b1+1 loop $a1=$a1+1 loop goto "endloop" ; quick or normal scan is stoped ; **************************************************************** ; **************************************************************** ; --------- start loop for aggressive scan --------- :scan3 $b1_temp=$b1 $c1_temp=$c1 $d1_temp=$d1 while $a2=>$a1 $b1=$b1_temp while $b2=>$b1 $c1=$c1_temp while $c2=>$c1 $d1=$d1_temp while $d2=>$d1 ; **************************************************************** ; ************ Here is the code inside the inner loop ************ ; **************************************************************** $ip="$a1.$b1.$c1.$d1" shell "%comspec% /c ping -a -n 1 -l 64 -w 2000 " + $ip + " > " + @curdir + "\cache.log" ; lets wait a litle until the log file created ... while open(1, @curdir + "\cache.log" ,2) <> 0 sleep 1 loop readline(1) readline(1) $data=readline(1) $n=0 $k=0 $dot="" do $dot=substr($data,$n,1) if $dot="[" or $dot="]" $k=$k+1 endif $n=$n+1 until $n=len($data) if $k=2 ; this means that the name retreived $n=0 do $dot=substr($data,$n,1) $n=$n+1 until $dot="[" $name=substr($data,9,$n-11) else ; the name could not be retreived $name="undefined" endif readline(1) readline(1) readline(1) $data=readline(1) ; now I am going to check if the host is alive or not if substr($data,1,5)="Reply" $result="alive" else $result="down" endif color w/n "host " color c+/n $ip chr(9) color w/n " with name " if $name="undefined" color r+/n else color g+/n endif $name chr(9) color w/n " is " if $result="down" color r+/n else color g+/n endif $result ? $scan_result="host " + $ip + " with name " + $name + " is " + $result
$null=close(1) $null=writeline(2,$scan_result+chr(13)+chr(10)) if $result="down" goto "nextip" endif ; Now I am going to Retreive the remote Registered names with ; the use of " nbtstat -A ip " command color w/n ? "Please wait. Retreiving remote Registered names of " color c+/n $ip ? shell "%comspec% /c nbtstat -A " + $ip + " > " + @curdir + "\cache.log" ; lets wait a litle until the log file created ... while open(1, @curdir + "\cache.log" ,2) <> 0 sleep 1 loop $null=readline(1) if substr($null,1,4)=host or len($null)=4 or substr($null,1,5)="There" color r+/n chr(9)+"could not get values" ? ? $null=close(1) goto "resources" endif ; here is some text formatting commands do $null=readline(1) until substr($null,1,11)="MAC Address" $null=readline(1) $null=writeline(2,chr(13)+chr(10)+"Remote Registered Names for the host "+ $ip +" are") $null=writeline(2,chr(13)+chr(10)+"-------------------------------------------------------") $null=writeline(2,chr(13)+chr(10)) color g+/n do $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) $null=readline(1) chr(9) $null ? until len($null)=0 or @error=-1 $null=writeline(2,chr(13)+chr(10)) $null=close(1) ; ******************************************************************** ; ******************************************************************** ; ** Here is the code for Trying to Retreive the Remote resources ** ; ******************************************************************** ; ********************************************************************
:resources color w/n "Trying connect to host " color c+/n $ip color w/n " Please wait ... "
use "\\$ip\ipc$" if @error=0 goto "goodip" endif use "\\$ip\ipc$" /user:"Administrator" /password:"" if @error<>0 color r+/n " connection failed." ? ? goto "nextip" endif :goodip color g+/n " connection succeed !" ? ? $n=1 do select case $n=1 $target="Administrators" $method="local" case $n=2 $target="Users" $method="local" case $n=3 $target="Domain Admins" $method="global" case $n=4 $target="Domain Users" $method="global" endselect color w/n "Retreiving remote $method $target, at host " color c+/n $ip color w/n " Please wait ..." ? "----------------------------------------------------------------------------" ? $null=writeline(2, "Remote " + $method + " " + $target + " at host " + $ip + " are"+chr(13)+chr(10)) $null=writeline(2,"-----------------------------------------------------"+chr(13)+chr(10)) shell "%comspec% /c $method " +'"'+ $target + '" \\$ip > @curdir\cache.log' ; lets wait a litle until the log file created ... while open(1, @curdir + "\cache.log" ,2) <> 0 sleep 1 loop if getfilesize(@curdir + "\cache.log")=0 $null="There are not any " + $method + " " + $target color r+/n chr(9)+$null color w/n ? ? $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) goto "nonethere" endif $null=readline(1) color g+/n chr(9)+$null ? do $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) $null=readline(1) chr(9)+$null ? until @error=-1 :nonethere $null=close(1) $null=writeline(2,chr(13)+chr(10)) $n=$n+1 until $n=5 $null=close(1) color w/n "Discovering remote share resources, at host " color c+/n $ip color w/n " Please wait ..." ? "----------------------------------------------------------------------------" ? $null=writeline(2, "Remote Shares at host " + $ip + " are"+chr(13)+chr(10)) $null=writeline(2,"-----------------------------------------------------"+chr(13)+chr(10)) shell "%comspec% /c net view \\$ip > @curdir\cache.log"
; lets wait a litle until the log file created ... while open(1, @curdir + "\cache.log" ,2) <> 0 sleep 1 loop if getfilesize(@curdir + "\cache.log")=0 $null="Could not get shares" color r+/n chr(9)+$null color w/n ? ? $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) $null=close(1) goto "nextip" endif if substr(readline(1),1,5)="There" color r+/n chr(9)+"There is not any share resource" ? ? $null=writeline(2,chr(9)+ "There is not any share resource"+chr(13)+chr(10)+chr(13)+chr(10)) $null=close(1) goto "nextip" endif ; here is some text formatting commands do $null=readline(1) until substr($null,1,2)="--" or @error=-1 $null=readline(1) color g+/n do $null ? $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) $null=readline(1) until substr($null,1,7)="The com" or @error=-1 $null=writeline(2,chr(13)+chr(10)) $null=close(1) ? :nextip ; **************************************************************** ; *************** Here stops the code of inner loop ************** ; **************************************************************** $d1=$d1+1 loop $c1=$c1+1 loop $b1=$b1+1 loop $a1=$a1+1 loop ; ---- aggressive loop is stoped :endloop $null=close(2) if exist (@curdir + "\cache.log") del @curdir + "\cache.log" endif ; ****************************************************************** ; * * ; * Here is the Repository place for Custom Subroutines * ; * * ; ****************************************************************** goto "end"
; Here is my split Subroutine which brings the power ; of Perl to Kixtart Enviroment. With Split ; SubRoutine, You can split every string which is ; seperated internal with the specified delimiter, to ; sequential array entries. The array is created ; automaticaly with the appropriate length. Unfortune- ; ly in kix if you want to use an array you have to ; declare it at the start. Thats why exist the ; translation table at the end of the code. ; Now it is a piece of cace to edit and procced Ip ; addresses and CSV files. ; ; Before call this SubRoutine you must have specify ; the $string and the $delimeter variables ; ; George Bouras ; netcom@matrix.kapatel.gr ; :split $n=0 $n_subrout=1 $k_subrout=0 do $dot=substr($string,$n_subrout,1) if $dot=$delimeter $k_subrout=$k_subrout+1 endif $n_subrout=$n_subrout+1 until $n_subrout=len($string) dim $sector[$k_subrout+2] do $sector[$k_subrout]="" $k_subrout=$k_subrout-1 until $k_subrout=0 $sector[0]="" $n_subrout=1 do $dot=substr($string,$n_subrout,1) if $dot=$delimeter $k_subrout=$k_subrout+1 goto "skip" endif $sector[$k_subrout]=$sector[$k_subrout]+$dot :skip $n_subrout=$n_subrout+1 until $n_subrout=len($string)+1 $n_subrout=$k_subrout do $sector[$n_subrout+1]=ltrim(rtrim($sector[$n_subrout])) $n_subrout=$n_subrout-1 until $n_subrout=-1 $nomore_sub=$k_subrout + 1 if $nomore_sub => 1 $sector1 = $sector[1] else goto "endsplit" endif if $nomore_sub => 2 $sector2 = $sector[2] else goto "endsplit" endif if $nomore_sub => 3 $sector3 = $sector[3] else goto "endsplit" endif if $nomore_sub => 4 $sector4 = $sector[4] else goto "endsplit" endif if $nomore_sub => 5 $sector5 = $sector[5] else goto "endsplit" endif if $nomore_sub => 6 $sector6 = $sector[6] else goto "endsplit" endif if $nomore_sub => 7 $sector7 = $sector[7] else goto "endsplit" endif if $nomore_sub => 8 $sector8 = $sector[8] else goto "endsplit" endif if $nomore_sub => 9 $sector9 = $sector[9] else goto "endsplit" endif if $nomore_sub => 10 $sector10 = $sector[10] else goto "endsplit" endif if $nomore_sub => 11 $sector11 = $sector[11] else goto "endsplit" endif if $nomore_sub => 12 $sector12 = $sector[12] else goto "endsplit" endif if $nomore_sub => 13 $sector13 = $sector[13] else goto "endsplit" endif if $nomore_sub => 14 $sector14 = $sector[14] else goto "endsplit" endif if $nomore_sub => 15 $sector15 = $sector[15] else goto "endsplit" endif if $nomore_sub => 16 $sector16 = $sector[16] else goto "endsplit" endif if $nomore_sub => 17 $sector17 = $sector[17] else goto "endsplit" endif if $nomore_sub => 18 $sector18 = $sector[18] else goto "endsplit" endif if $nomore_sub => 19 $sector19 = $sector[19] else goto "endsplit" endif if $nomore_sub => 20 $sector20 = $sector[20] else goto "endsplit" endif :endsplit return ; Here is some information about the right syntax of IP range :badip cls color g+/n ? " The IP range you enter has invalid format" ? " The general syntax of IP range is the following : " ? ? color y+/n " a.b.c.d" color g+/n " where every letter can be" ? ? color y+/n " a number " color g+/n " between 1 and 254" color y+/n ? " *" color g+/n " for the whole range from 1 to 254" ? color y+/n " [m-n]" color g+/n " for the range from m to n" ? ? " Some valid suntaxes are : " ? ? color c+/n " 192.168.0.2" ? ? " 10.*.1.[12-14]" ? ? " [10-11].*.123.[200-212]" ? ? " *.*.[1-4].[100-110]" ? ? color g+/n " Press any key to continue ... " get $null color w/n cls return ; ----- A subroutine to draw a -------------------------------- ; ----- message box to the center ----------------------------- ; ----- of the scren ------------------------------------------
:dosbox cls :dosboxnocls $n=1 do $n=$n+1 until $inboxmsg[$n]=""
$startline = 8 - ($n/2) $startcolumn = 37 - len($inboxmsg[1])/2 color y+/n box ($startline-1,$startcolumn,$startline+2*$n-1, $startcolumn+len($inboxmsg[1])+3,$boxstyle) color c+/n $n=1 do at ($startline + 2*$n - 1 , $startcolumn+2) $inboxmsg[$n] $n=$n+1 until $inboxmsg[$n]="" at(22,1) $n=1 do $inboxmsg[$n]="" $n=$n+1 until $n=10 return ; -------- End of functions repository -------------------------------- :end color w/n
|
|
Top
|
|
|
|
#50798 - 2000-08-16 12:00 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
After running kixstrip network.kix network.new /block_check /debug:code:
?"- 1-" ?"- 2-" ;--------------------------------------------------------------------- ?"- 3-" ; ?"- 4-" ; This kixtart script tries to scan your network and ?"- 5-" ; find any share drives and local usernames is ?"- 6-" ; possible. It is writen for NT Administartors ?"- 7-" ; and I do not take any resposibility for malign ?"- 8-" ; use of it especially with the aggressive scan. ?"- 9-" ; You can see the scanning results at your screen; ?"- 10-" ; a report file also will be created on current directory. ?"- 11-" ; ?"- 12-" ; All you have to do is to specify the ip range you want to ?"- 13-" ; scan when you promped with the following syntax : ?"- 14-" ; ?"- 15-" ; ?"- 16-" ; ?"- 17-" ; *.12.12.* will scan all the addrsses ?"- 18-" ; from 1 to 254 .12.12. from 1 to 254 ?"- 19-" ; 12.12.[100-110].100 will scan all the addrsses ?"- 20-" ; 12.12. from 100 to 110 .100 ?"- 21-" ; other valid ip ranges can be: ?"- 22-" ; *.*.*.* or [1-10].*.[200-223].* ?"- 23-" ; ?"- 24-" ; ?"- 25-" ; ?"- 26-" ; Please send me your commnents ?"- 27-" ; or any improvements you have made on it ! ?"- 28-" ; ?"- 29-" ; ?"- 30-" ; George Bouras ?"- 31-" ; bourasg@unisystems.gr ?"- 32-" ; ?"- 33-" ;--------------------------------------------------------------------- ?"- 34-" ?"- 35-" ; Here is just some information boxes and the prompt for the ip range ?"- 36-" ?"- 37-" CLS BREAK on ?"- 38-" DIM $inboxmsg[10] ?"- 39-" :chooserange ?"- 40-" COLOR r+/n ?"- 41-" box(0,0,2,39,double) box(0,40,2,79,double) ?"- 42-" box(3,0,5,39,double) box(3,40,5,79,double) ?"- 43-" ?"- 44-" COLOR c+/n ?"- 45-" at(1,2) "Local Ip Address : " @ipaddress0 ?"- 46-" at(1,42) "Local host Name : " @hostname ?"- 47-" at(4,2) @mdayno " " @day " " @year " ** " @time ?"- 48-" at(4,42) "Current dir : " @curdir ?"- 49-" ?"- 50-" COLOR g+/n box(10,5,14,73,double) COLOR c+/n ?"- 51-" at(12,7) " Enter the IP range : " COLOR y+/n GETS $string ?"- 52-" ?"- 53-" ; Lets check if there are any dots in the range at all ! ?"- 54-" IF len($string)=0 GOSUB badip GOTO "chooserange" ENDIF ?"- 55-" $n=0 ?"- 56-" DO ?"- 57-" $dot=substr($string,$n,1) ?"- 58-" IF $dot=. GOTO "dotok" ENDIF ?"- 59-" $n=$n+1 ?"- 60-" UNTIL $n=len($string) ?"- 61-" GOSUB badip GOTO "chooserange" ENDIF ; -------> Warning KIXSTRIP: 61 block "if/else/endif" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 61 block incompleted. ?"- 62-" :dotok ?"- 63-" :choosemode ?"- 64-" COLOR g+/n box(16,5,20,73,double) COLOR c+/n ?"- 65-" ?"- 66-" at(18,7) " Press " COLOR y+/n "1" COLOR c+/n " for Quick" COLOR y+/n ?"- 67-" " 2 " COLOR c+/n "for Normal" COLOR y+/n " 3 " COLOR c+/n ?"- 68-" "for Aggresive Scan or" COLOR y+/n " X " COLOR c+/n "to exit" ?"- 69-" at(23,78) GET $mode ?"- 70-" IF $mode=x GOTO "end" ENDIF ?"- 71-" IF $mode=1 OR $mode=2 OR $mode=3 ELSE GOTO "choosemode" ENDIF ?"- 72-" ?"- 73-" ; -------- Now I am going to analyse the IP range --------- ?"- 74-" ; -------- and found the boundaries of each octet --------- ?"- 75-" ?"- 76-" $inboxmsg[1] = "Please wait while I analyse" ?"- 77-" $inboxmsg[2] = " the IP range" ?"- 78-" $boxstyle = double ?"- 79-" GOSUB dosbox ?"- 80-" ?"- 81-" $delimeter=. ?"- 82-" GOSUB split ?"- 83-" IF $nomore_sub <> 4 GOSUB badip GOTO "chooserange" ENDIF ?"- 84-" ?"- 85-" IF substr($sector1,1,1)="[" ?"- 86-" $n=1 ?"- 87-" DO ?"- 88-" $dot = substr($sector1,$n,1) ?"- 89-" $n=$n+1 ?"- 90-" IF $n=len($sector1) AND $dot <> "-" GOSUB badip GOTO "chooserange" ENDIF ?"- 91-" UNTIL $dot="-" ?"- 92-" $a1=val(rtrim(ltrim(substr($sector1,2,$n-3)))) ?"- 93-" $a2=val(rtrim(ltrim(substr($sector1,$n,len($sector1)-$n)))) ?"- 94-" ELSE IF substr($sector1,1,1) <> "*" $a1=val($sector1) $a2=$a1 ENDIF ?"- 95-" IF substr($sector1,1,1)="*" $a1=1 $a2=254 ENDIF ENDIF ?"- 96-" ?"- 97-" IF substr($sector2,1,1)="[" ?"- 98-" $n=1 ?"- 99-" DO ?"- 100-" $dot = substr($sector2,$n,1) ?"- 101-" $n=$n+1 ?"- 102-" IF $n=len($sector2) AND $dot <> "-" GOSUB badip GOTO "chooserange" ENDIF ?"- 103-" UNTIL $dot="-" ?"- 104-" $b1=val(rtrim(ltrim(substr($sector2,2,$n-3)))) ?"- 105-" $b2=val(rtrim(ltrim(substr($sector2,$n,len($sector2)-$n)))) ?"- 106-" ELSE IF substr($sector2,1,1) <> "*" $b1=val($sector2) $b2=$b1 ENDIF ?"- 107-" IF substr($sector2,1,1)="*" $b1=1 $b2=254 ENDIF ENDIF ?"- 108-" ?"- 109-" IF substr($sector3,1,1)="[" ?"- 110-" $n=1 ?"- 111-" DO ?"- 112-" $dot = substr($sector3,$n,1) ?"- 113-" $n=$n+1 ?"- 114-" IF $n=len($sector3) AND $dot <> "-" GOSUB badip GOTO "chooserange" ENDIF ?"- 115-" UNTIL $dot="-" ?"- 116-" $c1=val(rtrim(ltrim(substr($sector3,2,$n-3)))) ?"- 117-" $c2=val(rtrim(ltrim(substr($sector3,$n,len($sector3)-$n)))) ?"- 118-" ELSE IF substr($sector3,1,1) <> "*" $c1=val($sector3) $c2=$c1 ENDIF ?"- 119-" IF substr($sector3,1,1)="*" $c1=1 $c2=254 ENDIF ENDIF ?"- 120-" ?"- 121-" IF substr($sector4,1,1)="[" ?"- 122-" $n=1 ?"- 123-" DO ?"- 124-" $dot = substr($sector4,$n,1) ?"- 125-" $n=$n+1 ?"- 126-" IF $n=len($sector4) AND $dot <> "-" GOSUB badip GOTO "chooserange" ENDIF ?"- 127-" UNTIL $dot="-" ?"- 128-" $d1=val(rtrim(ltrim(substr($sector4,2,$n-3)))) ?"- 129-" $d2=val(rtrim(ltrim(substr($sector4,$n,len($sector4)-$n)))) ?"- 130-" ELSE IF substr($sector4,1,1) <> "*" $d1=val($sector4) $d2=$d1 ENDIF ?"- 131-" IF substr($sector4,1,1)="*" $d1=1 $d2=254 ENDIF ENDIF ?"- 132-" ?"- 133-" ;---------------------------------------------------------------------------------- ?"- 134-" ; ------------- lets count now the total number of IPs we must scan ... ?"- 135-" ;---------------------------------------------------------------------------------- ?"- 136-" ?"- 137-" $n= ($a2-$a1+1)*($b2-$b1+1)*($c2-$c1+1)*($d2-$d1+1) ?"- 138-" ?"- 139-" $inboxmsg[1] = "You select to scan $n" ?"- 140-" $inboxmsg[2] = " IP Addresses." ?"- 141-" $inboxmsg[3] = " Please wait ..." ?"- 142-" $boxstyle = double ?"- 143-" GOSUB dosbox ?"- 144-" SLEEP 2 ?"- 145-" ?"- 146-" ; ------------- What I have now is the boundaries ----------------------- ?"- 147-" ; ------------- of every octet. ----------------------------------------- ?"- 148-" ; ------------- $a1 and $a2 for the first octet ------------------------- ?"- 149-" ; ------------- $b1 and $b2 for the second octet ------------------------ ?"- 150-" ; ------------- $c1 and $c2 for the third octet ------------------------- ?"- 151-" ; ------------- $d1 and $d2 for the forth octet ------------------------- ?"- 152-" ; ------------- so we can go for the super loop !!! --------------------- ?"- 153-" ?"- 154-" ?"- 155-" IF exist (@curdir + "\cache.log") DEL @curdir + "\cache.log" ENDIF ?"- 156-" IF $null=open(1,@curdir + "\cache.log",3) GOTO "checklog" ENDIF ?"- 157-" ?"- 158-" $inboxmsg[1] = "Could not create the transaction file" ?"- 159-" $inboxmsg[2] = " inside the current directory." ?"- 160-" $inboxmsg[3] = " Proccess stoped" ?"- 161-" $inboxmsg[4] = " Press any key to exit" ?"- 162-" $boxstyle = double ?"- 163-" GOSUB dosbox ?"- 164-" GET $null ?"- 165-" GOTO "end" ?"- 166-" ?"- 167-" :checklog ?"- 168-" $null=close(1) ?"- 169-" $logfile=@curdir + "\" + @mdayno + @month + @year + "@@" + ?"- 170-" substr(@time,1,2) + substr(@time,4,2) + substr(@time,7,2) + ".txt" ?"- 171-" IF exist($logfile) DEL $logfile ENDIF ?"- 172-" IF $null=open(2,$logfile,5) GOTO "check_nt" ENDIF ?"- 173-" $null=close(2) ?"- 174-" ?"- 175-" $inboxmsg[1] = "Could not create the report file" ?"- 176-" $inboxmsg[2] = " Proccess stoped." ?"- 177-" $inboxmsg[3] = " Press any key to exit." ?"- 178-" $boxstyle = double ?"- 179-" GOSUB dosbox ?"- 180-" GET $null ?"- 181-" GOTO "end" ?"- 182-" ?"- 183-" ?"- 184-" :check_nt ?"- 185-" IF $mode=3 ELSE GOTO "startloop" ENDIF ?"- 186-" IF @inwin <> 1 ?"- 187-" $inboxmsg[1] = "Sorry but you can Perform an" ?"- 188-" $inboxmsg[2] = " Aggressive scan only from" ?"- 189-" $inboxmsg[3] = " an WinNT or Win2000 box" ?"- 190-" $inboxmsg[4] = " Press anu key to exit" ?"- 191-" $boxstyle = double ?"- 192-" GOSUB dosbox ?"- 193-" $null=close(2) ?"- 194-" GET $null ?"- 195-" GOTO "end" ?"- 196-" ENDIF ?"- 197-" ?"- 198-" SHELL "%comspec% /c global.exe > " + @curdir + "\cache.log" CLS ?"- 199-" IF @error=1 $null="global.exe" GOTO "notexist" ENDIF ?"- 200-" SHELL "%comspec% /c local.exe > " + @curdir + "\cache.log" CLS ?"- 201-" IF @error=1 $null="local.exe" ELSE GOTO "startloop" ENDIF ?"- 202-" ?"- 203-" :notexist ?"- 204-" $inboxmsg[1] = "I could not locate the file : " + $null ?"- 205-" $inboxmsg[2] = "This file is a NT Resource kit utility" ?"- 206-" $inboxmsg[3] = "Place this file somewhere to your path" ?"- 207-" $inboxmsg[4] = " or install NT resourse kit and try" ?"- 208-" $inboxmsg[5] = " again. Press any key to exit" ?"- 209-" $boxstyle = double ?"- 210-" GOSUB dosbox ?"- 211-" $null=close(2) ?"- 212-" GET $null ?"- 213-" GOTO "end" ?"- 214-" :startloop ?"- 215-" ?"- 216-" COLOR r+/n CLS ? ? box(0,0,2,24,single) COLOR c+/n at(1,1) ?"- 217-" SELECT CASE $mode=1 " Quick " ?"- 218-" CASE $mode=2 " Normal " ?"- 219-" CASE $mode=3 "Aggressive " ?"- 220-" ENDSELECT "scan started" ? ? ?"- 221-" ?"- 222-" ?"- 223-" ; Even if we can a use a loop procedure with four nested ?"- 224-" ; loops in order to do all the scanning, we are going to ?"- 225-" ; use two different loop procedures (every one with four ?"- 226-" ; nested loops) . The one loop procedure will be for the ?"- 227-" ; quick and normal scan and the other loop procedure will ?"- 228-" ; be only for the aggressive scan. The reason is to speed ?"- 229-" ; up the script execution during the scan as many if ?"- 230-" ; statements will be executed once and not every time a ?"- 231-" ; new ip address will be proccessed. So may the script ?"- 232-" ; code will be a litle bit biger but it will finish sooner. ?"- 233-" ?"- 234-" IF val($mode) <= 2 GOTO "scan12" ELSE GOTO "scan3" ENDIF ?"- 235-" ?"- 236-" ?"- 237-" ?"- 238-" ; --------- start loop for quick or normal scan --------- ?"- 239-" :scan12 ?"- 240-" $b1_temp=$b1 ?"- 241-" $c1_temp=$c1 ?"- 242-" $d1_temp=$d1 ?"- 243-" WHILE $a2=>$a1 ?"- 244-" $b1=$b1_temp ?"- 245-" WHILE $b2=>$b1 ?"- 246-" $c1=$c1_temp ?"- 247-" WHILE $c2=>$c1 ?"- 248-" $d1=$d1_temp ?"- 249-" WHILE $d2=>$d1 ?"- 250-" ?"- 251-" ; **************************************************************** ?"- 252-" ; ************ Here is the code inside the inner loop ************ ?"- 253-" ; **************************************************************** ?"- 254-" ?"- 255-" $ip="$a1.$b1.$c1.$d1" ?"- 256-" SELECT ?"- 257-" CASE $mode=1 ?"- 258-" SHELL "%comspec% /c ping -n 1 -l 64 -w 1000 " + $ip + " > " + @curdir + "\cache.log" ?"- 259-" CASE $mode=2 ?"- 260-" SHELL "%comspec% /c ping -a -n 1 -l 64 -w 2000 " + $ip + " > " + @curdir + "\cache.log" ?"- 261-" ENDSELECT ?"- 262-" ?"- 263-" ; lets wait a litle until the log file created ... ?"- 264-" WHILE open(1, @curdir + "\cache.log" ,2) <> 0 ?"- 265-" SLEEP 1 ?"- 266-" LOOP ?"- 267-" readline(1) ?"- 268-" readline(1) ?"- 269-" $data=readline(1) ?"- 270-" ?"- 271-" IF $mode=1 $name="undefined" GOTO "bypassname" ENDIF ?"- 272-" ?"- 273-" $n=0 $k=0 $dot="" ?"- 274-" DO ?"- 275-" $dot=substr($data,$n,1) ?"- 276-" IF $dot="[" OR $dot="]" $k=$k+1 ENDIF ?"- 277-" $n=$n+1 ?"- 278-" UNTIL $n=len($data) ?"- 279-" ?"- 280-" IF $k=2 ; this means that the name retreived ?"- 281-" $n=0 ?"- 282-" DO ?"- 283-" $dot=substr($data,$n,1) ?"- 284-" $n=$n+1 ?"- 285-" UNTIL $dot="[" ?"- 286-" $name=substr($data,9,$n-11) ?"- 287-" ?"- 288-" ELSE ; the name could not be retreived ?"- 289-" $name="undefined" ?"- 290-" ENDIF ?"- 291-" :bypassname ?"- 292-" readline(1) ?"- 293-" readline(1) ?"- 294-" readline(1) ?"- 295-" $data=readline(1) ?"- 296-" ?"- 297-" ; now I am going to check if the host is alive or not ?"- 298-" ?"- 299-" IF substr($data,1,5)="Reply" ?"- 300-" $result="alive" ?"- 301-" ELSE ?"- 302-" $result="down" ?"- 303-" ENDIF ?"- 304-" ?"- 305-" SELECT ?"- 306-" CASE $mode=1 ?"- 307-" COLOR w/n " host " COLOR c+/n $ip chr(9) COLOR w/n " is " ?"- 308-" IF $result="down" COLOR r+/n ELSE COLOR g+/n ENDIF $result ? ?"- 309-" $scan_result="host " + $ip + " is " + $result ?"- 310-" ?"- 311-" CASE $mode=2 ?"- 312-" COLOR w/n "host " COLOR c+/n $ip chr(9) ?"- 313-" COLOR w/n " with name " ?"- 314-" IF $name="undefined" COLOR r+/n ELSE COLOR g+/n ENDIF $name ?"- 315-" chr(9) COLOR w/n " is " ?"- 316-" IF $result="down" COLOR r+/n ELSE COLOR g+/n ENDIF $result ? ?"- 317-" $scan_result="host " + $ip + " with name " + $name + " is " + $result ?"- 318-" ?"- 319-" ENDSELECT ?"- 320-" $null=writeline(2,$scan_result+chr(13)+chr(10)) ?"- 321-" $null=close(1) ?"- 322-" ?"- 323-" ; **************************************************************** ?"- 324-" ; *************** Here stops the code of inner loop ************** ?"- 325-" ; **************************************************************** ?"- 326-" ?"- 327-" $d1=$d1+1 ?"- 328-" LOOP ?"- 329-" $c1=$c1+1 ?"- 330-" LOOP ?"- 331-" $b1=$b1+1 ?"- 332-" LOOP ?"- 333-" $a1=$a1+1 ?"- 334-" LOOP ?"- 335-" GOTO "endloop" ?"- 336-" ; quick or normal scan is stoped ?"- 337-" ?"- 338-" ?"- 339-" ?"- 340-" ; **************************************************************** ?"- 341-" ; **************************************************************** ?"- 342-" ?"- 343-" ?"- 344-" ?"- 345-" ; --------- start loop for aggressive scan --------- ?"- 346-" :scan3 ?"- 347-" $b1_temp=$b1 ?"- 348-" $c1_temp=$c1 ?"- 349-" $d1_temp=$d1 ?"- 350-" WHILE $a2=>$a1 ?"- 351-" $b1=$b1_temp ?"- 352-" WHILE $b2=>$b1 ?"- 353-" $c1=$c1_temp ?"- 354-" WHILE $c2=>$c1 ?"- 355-" $d1=$d1_temp ?"- 356-" WHILE $d2=>$d1 ?"- 357-" ?"- 358-" ; **************************************************************** ?"- 359-" ; ************ Here is the code inside the inner loop ************ ?"- 360-" ; **************************************************************** ?"- 361-" ?"- 362-" $ip="$a1.$b1.$c1.$d1" ?"- 363-" ?"- 364-" SHELL "%comspec% /c ping -a -n 1 -l 64 -w 2000 " + $ip + " > " + @curdir + "\cache.log" ?"- 365-" ; lets wait a litle until the log file created ... ?"- 366-" WHILE open(1, @curdir + "\cache.log" ,2) <> 0 ?"- 367-" SLEEP 1 ?"- 368-" LOOP ?"- 369-" readline(1) ?"- 370-" readline(1) ?"- 371-" $data=readline(1) ?"- 372-" ?"- 373-" $n=0 $k=0 $dot="" ?"- 374-" DO ?"- 375-" $dot=substr($data,$n,1) ?"- 376-" IF $dot="[" OR $dot="]" $k=$k+1 ENDIF ?"- 377-" $n=$n+1 ?"- 378-" UNTIL $n=len($data) ?"- 379-" ?"- 380-" IF $k=2 ; this means that the name retreived ?"- 381-" $n=0 ?"- 382-" DO ?"- 383-" $dot=substr($data,$n,1) ?"- 384-" $n=$n+1 ?"- 385-" UNTIL $dot="[" ?"- 386-" $name=substr($data,9,$n-11) ?"- 387-" ?"- 388-" ELSE ; the name could not be retreived ?"- 389-" $name="undefined" ?"- 390-" ENDIF ?"- 391-" readline(1) ?"- 392-" readline(1) ?"- 393-" readline(1) ?"- 394-" $data=readline(1) ?"- 395-" ?"- 396-" ; now I am going to check if the host is alive or not ?"- 397-" ?"- 398-" IF substr($data,1,5)="Reply" ?"- 399-" $result="alive" ?"- 400-" ELSE ?"- 401-" $result="down" ?"- 402-" ENDIF ?"- 403-" ?"- 404-" ?"- 405-" COLOR w/n "host " COLOR c+/n $ip chr(9) ?"- 406-" COLOR w/n " with name " ?"- 407-" IF $name="undefined" COLOR r+/n ELSE COLOR g+/n ENDIF $name ?"- 408-" chr(9) COLOR w/n " is " ?"- 409-" IF $result="down" COLOR r+/n ELSE COLOR g+/n ENDIF $result ? ?"- 410-" $scan_result="host " + $ip + " with name " + $name + " is " + $result ?"- 411-" ?"- 412-" $null=close(1) ?"- 413-" $null=writeline(2,$scan_result+chr(13)+chr(10)) ?"- 414-" IF $result="down" GOTO "nextip" ENDIF ?"- 415-" ?"- 416-" ?"- 417-" ?"- 418-" ; Now I am going to Retreive the remote Registered names with ?"- 419-" ; the use of " nbtstat -A ip " command ?"- 420-" ?"- 421-" COLOR w/n ? ?"- 422-" "Please wait. Retreiving remote Registered names of " COLOR c+/n $ip ? ?"- 423-" ?"- 424-" SHELL "%comspec% /c nbtstat -A " + $ip + " > " + @curdir + "\cache.log" ?"- 425-" ; lets wait a litle until the log file created ... ?"- 426-" WHILE open(1, @curdir + "\cache.log" ,2) <> 0 ?"- 427-" SLEEP 1 ?"- 428-" LOOP ?"- 429-" $null=readline(1) ?"- 430-" IF substr($null,1,4)=host OR len($null)=4 OR substr($null,1,5)="There" ?"- 431-" COLOR r+/n chr(9)+"could not get values" ? ? ?"- 432-" $null=close(1) ?"- 433-" GOTO "resources" ?"- 434-" ENDIF ?"- 435-" ?"- 436-" ; here is some text formatting commands ?"- 437-" DO $null=readline(1) ?"- 438-" UNTIL substr($null,1,11)="MAC Address" $null=readline(1) ?"- 439-" ?"- 440-" $null=writeline(2,chr(13)+chr(10)+"Remote Registered Names for the host "+ $ip +" are") ?"- 441-" $null=writeline(2,chr(13)+chr(10)+"-------------------------------------------------------") ?"- 442-" $null=writeline(2,chr(13)+chr(10)) ?"- 443-" ?"- 444-" COLOR g+/n ?"- 445-" DO ?"- 446-" $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) ?"- 447-" $null=readline(1) ?"- 448-" chr(9) $null ? ?"- 449-" UNTIL len($null)=0 OR @error=-1 ?"- 450-" $null=writeline(2,chr(13)+chr(10)) ?"- 451-" $null=close(1) ?"- 452-" ?"- 453-" ?"- 454-" ; ******************************************************************** ?"- 455-" ; ******************************************************************** ?"- 456-" ; ** Here is the code for Trying to Retreive the Remote resources ** ?"- 457-" ; ******************************************************************** ?"- 458-" ; ******************************************************************** ?"- 459-" ?"- 460-" ?"- 461-" :resources ?"- 462-" COLOR w/n ?"- 463-" "Trying connect to host " COLOR c+/n $ip COLOR w/n " Please wait ... " ?"- 464-" ?"- 465-" ?"- 466-" ?"- 467-" USE "\\$ip\ipc$" ?"- 468-" IF @error=0 GOTO "goodip" ENDIF ?"- 469-" USE "\\$ip\ipc$" /user:"Administrator" /password:"" ?"- 470-" IF @error<>0 COLOR r+/n " connection failed." ? ? GOTO "nextip" ENDIF ?"- 471-" ?"- 472-" :goodip ?"- 473-" COLOR g+/n " connection succeed !" ? ? ?"- 474-" ?"- 475-" $n=1 ?"- 476-" DO ?"- 477-" SELECT ?"- 478-" CASE $n=1 $target="Administrators" $method="local" ?"- 479-" CASE $n=2 $target="Users" $method="local" ?"- 480-" CASE $n=3 $target="Domain Admins" $method="global" ?"- 481-" CASE $n=4 $target="Domain Users" $method="global" ?"- 482-" ENDSELECT ?"- 483-" ?"- 484-" COLOR w/n ?"- 485-" "Retreiving remote $method $target, at host " COLOR c+/n $ip COLOR w/n " Please wait ..." ? ?"- 486-" "----------------------------------------------------------------------------" ? ?"- 487-" $null=writeline(2, ; -------> Warning KIXSTRIP: 487 line incomplete "left parenthesis". ; -------> Warning KIXSTRIP: 487 line incompleted. ?"- 488-" "Remote " + $method + " " + $target + " at host " + $ip + " are"+chr(13)+chr(10)) ; -------> Warning KIXSTRIP: 488 line incomplete "right parenthesis". ; -------> Warning KIXSTRIP: 488 line incompleted. ?"- 489-" $null=writeline(2,"-----------------------------------------------------"+chr(13)+chr(10)) ?"- 490-" ?"- 491-" SHELL "%comspec% /c $method " +'"'+ $target + '" \\$ip > @curdir\cache.log' ?"- 492-" ?"- 493-" ; lets wait a litle until the log file created ...
[This message has been edited by MCA (edited 15 August 2000).]
|
|
Top
|
|
|
|
#50799 - 2000-08-16 12:04 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
code:
?"- 490-" ?"- 491-" SHELL "%comspec% /c $method " +'"'+ $target + '" \\$ip > @curdir\cache.log' ?"- 492-" ?"- 493-" ; lets wait a litle until the log file created ... ?"- 494-" WHILE open(1, @curdir + "\cache.log" ,2) <> 0 ?"- 495-" SLEEP 1 ?"- 496-" LOOP ?"- 497-" ?"- 498-" IF ?"- 499-" getfilesize(@curdir + "\cache.log")=0 ?"- 500-" $null="There are not any " + $method + " " + $target ?"- 501-" COLOR r+/n chr(9)+$null COLOR w/n ? ? ?"- 502-" $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) ?"- 503-" GOTO "nonethere" ?"- 504-" ENDIF ?"- 505-" ?"- 506-" $null=readline(1) COLOR g+/n chr(9)+$null ? ?"- 507-" DO ?"- 508-" $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) ?"- 509-" $null=readline(1) ?"- 510-" chr(9)+$null ? ?"- 511-" UNTIL @error=-1 ?"- 512-" :nonethere ?"- 513-" $null=close(1) ?"- 514-" $null=writeline(2,chr(13)+chr(10)) ?"- 515-" $n=$n+1 ?"- 516-" UNTIL $n=5 ?"- 517-" $null=close(1) ?"- 518-" ?"- 519-" COLOR w/n ?"- 520-" "Discovering remote share resources, at host " COLOR c+/n $ip COLOR w/n " Please wait ..." ? ?"- 521-" "----------------------------------------------------------------------------" ? ?"- 522-" $null=writeline(2, ; -------> Warning KIXSTRIP: 522 line incomplete "left parenthesis". ; -------> Warning KIXSTRIP: 522 line incompleted. ?"- 523-" "Remote Shares at host " + $ip + " are"+chr(13)+chr(10)) ; -------> Warning KIXSTRIP: 523 line incomplete "right parenthesis". ; -------> Warning KIXSTRIP: 523 line incompleted. ?"- 524-" $null=writeline(2,"-----------------------------------------------------"+chr(13)+chr(10)) ?"- 525-" ?"- 526-" ?"- 527-" SHELL "%comspec% /c net view \\$ip > @curdir\cache.log" ?"- 528-" ?"- 529-" ; lets wait a litle until the log file created ... ?"- 530-" WHILE open(1, @curdir + "\cache.log" ,2) <> 0 ?"- 531-" SLEEP 1 ?"- 532-" LOOP ?"- 533-" ?"- 534-" IF getfilesize(@curdir + "\cache.log")=0 ?"- 535-" $null="Could not get shares" ?"- 536-" COLOR r+/n chr(9)+$null COLOR w/n ? ? ?"- 537-" $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) ?"- 538-" $null=close(1) ?"- 539-" GOTO "nextip" ?"- 540-" ENDIF ?"- 541-" ?"- 542-" IF substr(readline(1),1,5)="There" COLOR r+/n ?"- 543-" chr(9)+"There is not any share resource" ? ? ?"- 544-" $null=writeline(2,chr(9)+ ; -------> Warning KIXSTRIP: 544 line incomplete "left parenthesis". ; -------> Warning KIXSTRIP: 544 line incompleted. ?"- 545-" "There is not any share resource"+chr(13)+chr(10)+chr(13)+chr(10)) ; -------> Warning KIXSTRIP: 545 line incomplete "right parenthesis". ; -------> Warning KIXSTRIP: 545 line incompleted. ?"- 546-" $null=close(1) ?"- 547-" GOTO "nextip" ?"- 548-" ENDIF ?"- 549-" ?"- 550-" ; here is some text formatting commands ?"- 551-" DO $null=readline(1) ?"- 552-" UNTIL substr($null,1,2)="--" OR @error=-1 ?"- 553-" $null=readline(1) ?"- 554-" ?"- 555-" COLOR g+/n ?"- 556-" DO ?"- 557-" $null ? ?"- 558-" $null=writeline(2,chr(9)+$null+chr(13)+chr(10)) ?"- 559-" $null=readline(1) ?"- 560-" UNTIL substr($null,1,7)="The com" OR @error=-1 ?"- 561-" $null=writeline(2,chr(13)+chr(10)) ?"- 562-" $null=close(1) ? ?"- 563-" ?"- 564-" :nextip ?"- 565-" ?"- 566-" ; **************************************************************** ?"- 567-" ; *************** Here stops the code of inner loop ************** ?"- 568-" ; **************************************************************** ?"- 569-" ?"- 570-" $d1=$d1+1 ?"- 571-" LOOP ?"- 572-" $c1=$c1+1 ?"- 573-" LOOP ?"- 574-" $b1=$b1+1 ?"- 575-" LOOP ?"- 576-" $a1=$a1+1 ?"- 577-" LOOP ?"- 578-" ; ---- aggressive loop is stoped ?"- 579-" ?"- 580-" ?"- 581-" ?"- 582-" :endloop ?"- 583-" $null=close(2) ?"- 584-" IF exist (@curdir + "\cache.log") DEL @curdir + "\cache.log" ENDIF ?"- 585-" ?"- 586-" ?"- 587-" ?"- 588-" ; ****************************************************************** ?"- 589-" ; * * ?"- 590-" ; * Here is the Repository place for Custom Subroutines * ?"- 591-" ; * * ?"- 592-" ; ****************************************************************** ?"- 593-" ?"- 594-" ?"- 595-" GOTO "end" ?"- 596-" ?"- 597-" ; Here is my split Subroutine which brings the power ?"- 598-" ; of Perl to Kixtart Enviroment. With Split ?"- 599-" ; SubRoutine, You can split every string which is ?"- 600-" ; seperated internal with the specified delimiter, to ?"- 601-" ; sequential array entries. The array is created ?"- 602-" ; automaticaly with the appropriate length. Unfortune- ?"- 603-" ; ly in kix if you want to use an array you have to ?"- 604-" ; declare it at the start. Thats why exist the ?"- 605-" ; translation table at the end of the code. ?"- 606-" ; Now it is a piece of cace to edit and procced Ip ?"- 607-" ; addresses and CSV files. ?"- 608-" ; ?"- 609-" ; Before call this SubRoutine you must have specify ?"- 610-" ; the $string and the $delimeter variables ?"- 611-" ; ?"- 612-" ; George Bouras ?"- 613-" ; netcom@matrix.kapatel.gr ?"- 614-" ; ?"- 615-" ?"- 616-" :split ?"- 617-" $n=0 ?"- 618-" $n_subrout=1 $k_subrout=0 DO ?"- 619-" $dot=substr($string,$n_subrout,1) ?"- 620-" IF $dot=$delimeter $k_subrout=$k_subrout+1 ENDIF ?"- 621-" $n_subrout=$n_subrout+1 ?"- 622-" UNTIL $n_subrout=len($string) ?"- 623-" DIM $sector[$k_subrout+2] ?"- 624-" ?"- 625-" DO ?"- 626-" $sector[$k_subrout]="" ?"- 627-" $k_subrout=$k_subrout-1 ?"- 628-" UNTIL $k_subrout=0 $sector[0]="" ?"- 629-" ?"- 630-" $n_subrout=1 DO ?"- 631-" $dot=substr($string,$n_subrout,1) ?"- 632-" IF $dot=$delimeter $k_subrout=$k_subrout+1 GOTO "skip" ENDIF ?"- 633-" $sector[$k_subrout]=$sector[$k_subrout]+$dot ?"- 634-" :skip ?"- 635-" $n_subrout=$n_subrout+1 ?"- 636-" UNTIL $n_subrout=len($string)+1 ?"- 637-" ?"- 638-" $n_subrout=$k_subrout ?"- 639-" DO ?"- 640-" $sector[$n_subrout+1]=ltrim(rtrim($sector[$n_subrout])) ?"- 641-" $n_subrout=$n_subrout-1 ?"- 642-" UNTIL $n_subrout=-1 ?"- 643-" $nomore_sub=$k_subrout + 1 ?"- 644-" ?"- 645-" IF $nomore_sub => 1 $sector1 = $sector[1] ELSE GOTO "endsplit" ENDIF ?"- 646-" IF $nomore_sub => 2 $sector2 = $sector[2] ELSE GOTO "endsplit" ENDIF ?"- 647-" IF $nomore_sub => 3 $sector3 = $sector[3] ELSE GOTO "endsplit" ENDIF ?"- 648-" IF $nomore_sub => 4 $sector4 = $sector[4] ELSE GOTO "endsplit" ENDIF ?"- 649-" IF $nomore_sub => 5 $sector5 = $sector[5] ELSE GOTO "endsplit" ENDIF ?"- 650-" IF $nomore_sub => 6 $sector6 = $sector[6] ELSE GOTO "endsplit" ENDIF ?"- 651-" IF $nomore_sub => 7 $sector7 = $sector[7] ELSE GOTO "endsplit" ENDIF ?"- 652-" IF $nomore_sub => 8 $sector8 = $sector[8] ELSE GOTO "endsplit" ENDIF ?"- 653-" IF $nomore_sub => 9 $sector9 = $sector[9] ELSE GOTO "endsplit" ENDIF ?"- 654-" IF $nomore_sub => 10 $sector10 = $sector[10] ELSE GOTO "endsplit" ENDIF ?"- 655-" IF $nomore_sub => 11 $sector11 = $sector[11] ELSE GOTO "endsplit" ENDIF ?"- 656-" IF $nomore_sub => 12 $sector12 = $sector[12] ELSE GOTO "endsplit" ENDIF ?"- 657-" IF $nomore_sub => 13 $sector13 = $sector[13] ELSE GOTO "endsplit" ENDIF ?"- 658-" IF $nomore_sub => 14 $sector14 = $sector[14] ELSE GOTO "endsplit" ENDIF ?"- 659-" IF $nomore_sub => 15 $sector15 = $sector[15] ELSE GOTO "endsplit" ENDIF ?"- 660-" IF $nomore_sub => 16 $sector16 = $sector[16] ELSE GOTO "endsplit" ENDIF ?"- 661-" IF $nomore_sub => 17 $sector17 = $sector[17] ELSE GOTO "endsplit" ENDIF ?"- 662-" IF $nomore_sub => 18 $sector18 = $sector[18] ELSE GOTO "endsplit" ENDIF ?"- 663-" IF $nomore_sub => 19 $sector19 = $sector[19] ELSE GOTO "endsplit" ENDIF ?"- 664-" IF $nomore_sub => 20 $sector20 = $sector[20] ELSE GOTO "endsplit" ENDIF ?"- 665-" :endsplit ?"- 666-" RETURN ?"- 667-" ?"- 668-" ; Here is some information about the right syntax of IP range ?"- 669-" ?"- 670-" :badip ?"- 671-" CLS COLOR g+/n ? ?"- 672-" " The IP range you enter has invalid format" ? ?"- 673-" " The general syntax of IP range is the following : " ? ? ?"- 674-" COLOR y+/n ?"- 675-" " a.b.c.d" COLOR g+/n " where every letter can be" ? ? ?"- 676-" COLOR y+/n " a number " COLOR g+/n " between 1 and 254" COLOR y+/n ? ?"- 677-" " *" COLOR g+/n " for the whole range from 1 to 254" ? COLOR y+/n ?"- 678-" " [m-n]" COLOR g+/n " for the range from m to n" ? ? ?"- 679-" " Some valid suntaxes are : " ? ? COLOR c+/n ?"- 680-" " 192.168.0.2" ? ? ?"- 681-" " 10.*.1.[12-14]" ? ? ?"- 682-" " [10-11].*.123.[200-212]" ? ? ?"- 683-" " *.*.[1-4].[100-110]" ? ? COLOR g+/n ?"- 684-" " Press any key to continue ... " GET $null COLOR w/n CLS ?"- 685-" RETURN ?"- 686-" ?"- 687-" ?"- 688-" ; ----- A subroutine to draw a -------------------------------- ?"- 689-" ; ----- message box to the center ----------------------------- ?"- 690-" ; ----- of the scren ------------------------------------------ ?"- 691-" ?"- 692-" ?"- 693-" :dosbox ?"- 694-" CLS ?"- 695-" :dosboxnocls ?"- 696-" $n=1 ?"- 697-" DO ?"- 698-" $n=$n+1 ?"- 699-" UNTIL $inboxmsg[$n]="" ?"- 700-" ?"- 701-" $startline = 8 - ($n/2) ?"- 702-" $startcolumn = 37 - len($inboxmsg[1])/2 ?"- 703-" ?"- 704-" COLOR y+/n ?"- 705-" box ($startline-1,$startcolumn,$startline+2*$n-1, ; -------> Warning KIXSTRIP: 705 line incomplete "left parenthesis". ; -------> Warning KIXSTRIP: 705 line incompleted. ?"- 706-" $startcolumn+len($inboxmsg[1])+3,$boxstyle) ; -------> Warning KIXSTRIP: 706 line incomplete "right parenthesis". ; -------> Warning KIXSTRIP: 706 line incompleted. ?"- 707-" ?"- 708-" COLOR c+/n ?"- 709-" $n=1 ?"- 710-" DO ?"- 711-" ?"- 712-" at ($startline + 2*$n - 1 , $startcolumn+2) $inboxmsg[$n] ?"- 713-" $n=$n+1 ?"- 714-" UNTIL $inboxmsg[$n]="" ?"- 715-" ?"- 716-" at(22,1) ?"- 717-" $n=1 ?"- 718-" DO ?"- 719-" $inboxmsg[$n]="" ?"- 720-" $n=$n+1 ?"- 721-" UNTIL $n=10 ?"- 722-" RETURN ?"- 723-" ?"- 724-" ; -------- End of functions repository -------------------------------- ?"- 725-" ?"- 726-" ?"- 727-" :end ?"- 728-" COLOR w/n;($begin) ; ; tue 15-aug-2000 11:48:59 ; ;Informative KIXSTRIP: no errors found. ; ;Warning KIXSTRIP: 1 block is incompleted. ; missing "do/until", "if/else/endif", "while/loop" ; "select/case/endselect" statement. ; - do/until [22:22] ; - if/else/endif [72:37:73] ; - select/case/endselect [4:11:4] ; - while/loop [13:13] ;Warning KIXSTRIP: 8 lines are incompleted. ;Warning KIXSTRIP: some lines contains errors or possible errors. ; 4 line incomplete "left parenthesis". ; 4 line incomplete "right parenthesis". ; 1 block "if/else/endif" incompleted. starting point of block structure missing. ; 1 block incompleted. ; 8 line incompleted. ;Informative KIXSTRIP: 111 block_structures found. ;Informative KIXSTRIP: 22 labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ;Informative KIXSTRIP: 14 GOSUB ;Informative KIXSTRIP: 52 GOTO ;Informative KIXSTRIP: 3 RETURN ;Informative KIXSTRIP: 8 SHELL ;Informative KIXSTRIP: 2 USE ; ;($end) ;($begin) ; ;Warning KIXSTRIP: 487, 522, 544, 705 line incomplete "left parenthesis". ;Warning KIXSTRIP: 488, 523, 545, 706 line incomplete "right parenthesis". ;Warning KIXSTRIP: 61 block "if/else/endif" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 61 block incompleted. ;Warning KIXSTRIP: 487, 488, 522, 523, 544, 545, 705, 706 line incompleted. ; ;($end)
code:
Kixstrip 3.62 (vs 1.70e) (c) MCA - scripting@wanadoo.nl - 2000 1 .....................................E(728) Warning KIXSTRIP: 487, 522, 544, 705 line incomplete "left parenthesis". Warning KIXSTRIP: 488, 523, 545, 706 line incomplete "right parenthesis". Warning KIXSTRIP: 61 block "if/else/endif" incompleted. starting point of block structure missing. Warning KIXSTRIP: 61 block incompleted. Warning KIXSTRIP: 487, 488, 522, 523, 544, 545, 705, 706 line incompleted. Kixstrip 3.62 (vs 1.70e) 6.82 (sec) input 728 network.kix output 728 network.new block_check -ERROR- block_errors_count=1 block_structures=111 labels=22 tab=6 (default) Warning KIXSTRIP: 1 block is incompleted. missing "do/until", "if/else/endif", "while/loop" "select/case/endselect" statement. - do/until [22:22] - if/else/endif [72:37:73] - select/case/endselect [4:11:4] - while/loop [13:13] 111 block_structures found. Warning KIXSTRIP: 8 lines are incompleted. options: /Block_Check /Debug /Headers /NoCombine /Print /Show_Errors /TAB=6 /Translate /NoLicense: (not.specified)
|
|
Top
|
|
|
|
#50800 - 2000-09-06 06:22 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,Based on ICATAR's and SHAWN's scripts we have make an extension to the KIXSTRIP.EXE program, which automatically do three things:
- insert variable with actual line number.
- insert a call of subroutine.
- insert subroutine which calculates the progress and will showing it.
code:
$pcur= 1 gosub "pinfo" ; - code - ..... $pcur= 341 gosub "pinfo" ; - code -
code:
at (9,25) "Starting Windows...completed" at (20,1) " " exit info $pstop=341 IF ($pcur <= 1) cls at (9,30) "Starting Windows..." box (10,5,12,75,"single") box (14,5,16,75,"single") $pcolumn=6 ENDIF $ppercentage=(100*$pcur)/$pstop IF ($pcolumn > 74) $pcolumn=6 ENDIF $pcolumn=6+((74-6)*$ppercentage)/100 at (11,$pcolumn) CHR(166) at (13,37) $ppercentage " %" at (15,37) $pcur " .. " $pstop return
Topic: http://kixtart.org/board/Forum2/HTML/000706.html Remarks: by using the option "/progress"
- reserved label: pinfo
- reserved variables: $pcur, $pstop, $ppercentage, $pcolumn
(using them will not influence our values, but it influences your values)
- progress indicator which let you see:
- how much is your script completed. - which parts of your script were skipped. - at which line your are leaving your script.
- how long a "LOOP" will run is difficult to calculate. each work-
station hasn't the same structure. so we are using the progress-bar as an indicator which shows the current position of the script.
- how long a "XCOPY" or other (external) command will run is difficult
to calculate. an external program can ask the user for input.
code:
IF setconsole("hide") ENDIF
can influence your screen output.
site: http://home.wanadoo.nl/scripting program: kixstrip.exe 1.71 Example of running "cleanup.kix" by "kixstrip /block_check /progress":
code:
$pcur= 1 gosub "pinfo" IF setconsole("hide") $pcur= 2 gosub "pinfo" ENDIF $pcur= 3 gosub "pinfo" ; $pcur= 4 gosub "pinfo" ; NT/95 cleanup - Kixtart 3.62 $pcur= 5 gosub "pinfo" ; $pcur= 6 gosub "pinfo" ; (c) scripting@wanadoo.nl - 2000 $pcur= 7 gosub "pinfo" ; $pcur= 8 gosub "pinfo" ; vs 1.00 - program (cleanup recent list, set HKCR keys, set BOOT.INI, set TaskMgr) $pcur= 9 gosub "pinfo" ; $pcur= 10 gosub "pinfo" ; 1.00 (20000715) original version $pcur= 11 gosub "pinfo" ; $pcur= 12 gosub "pinfo" $prgrm_version="1.00" $pcur= 13 gosub "pinfo" ; $pcur= 14 gosub "pinfo" $debug_mode="no" ; - yes/no - $pcur= 15 gosub "pinfo" IF (@inwin = 1) $pcur= 16 gosub "pinfo" $nt_mode="yes" $pcur= 17 gosub "pinfo" ELSE $pcur= 18 gosub "pinfo" $nt_mode="no" $pcur= 19 gosub "pinfo" ENDIF $pcur= 20 gosub "pinfo" ; $pcur= 21 gosub "pinfo" BREAK off $pcur= 22 gosub "pinfo" FLUSHKB $pcur= 23 gosub "pinfo" $pcur= 24 gosub "pinfo" $info="" $pcur= 25 gosub "pinfo" $pcur= 26 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 27 gosub "pinfo" ; - taskmgr settings. all counters - $pcur= 28 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 29 gosub "pinfo" $pcur= 30 gosub "pinfo" $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\TaskManager" $pcur= 31 gosub "pinfo" IF (ExistKey($ikey) = 0) $pcur= 32 gosub "pinfo" $ikey_ex="preferences" $pcur= 33 gosub "pinfo" $taskmgr_prefs= "ac000000a00f00000200000001000000020000000000000020" $pcur= 34 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"000000de030000d70200000200000000000000010000000200" $pcur= 35 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"00000300000004000000050000000600000007000000080000" $pcur= 36 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"00090000000a0000000b0000000c0000000d000000ffffffff" $pcur= 37 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"6b000000320000002300000046000000460000004600000046" $pcur= 38 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"000000460000004600000046000000460000003c0000003c00" $pcur= 39 gosub "pinfo" $taskmgr_prefs=$taskmgr_prefs+"00003c000000460000004b0000000000000000000000" $pcur= 40 gosub "pinfo" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $pcur= 41 gosub "pinfo" $result_data_type=ReadType($ikey, $ikey_ex) $pcur= 42 gosub "pinfo" ELSE $pcur= 43 gosub "pinfo" $result_data_type="REG_BINARY" $pcur= 44 gosub "pinfo" ENDIF $pcur= 45 gosub "pinfo" IF (ReadValue($ikey, $ikey_ex) <> $taskmgr_prefs) $pcur= 46 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, $result_data_type) <> 0) $pcur= 47 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $taskmgr_prefs, "REG_BINARY") <> 0) $pcur= 48 gosub "pinfo" ENDIF $pcur= 49 gosub "pinfo" ENDIF $pcur= 50 gosub "pinfo" $info=$info+" taskmgr."+$ikey_ex $pcur= 51 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 52 gosub "pinfo" ? " taskmgr.["+$ikey_ex+"]="+$ivalue $pcur= 53 gosub "pinfo" ENDIF $pcur= 54 gosub "pinfo" ENDIF $pcur= 55 gosub "pinfo" ENDIF $pcur= 56 gosub "pinfo" $pcur= 57 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 58 gosub "pinfo" ; - update BOOT.INI timer - $pcur= 59 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 60 gosub "pinfo" $pcur= 61 gosub "pinfo" IF ($nt_mode = "yes") $pcur= 62 gosub "pinfo" $filename="c:\boot.ini" ; - NT boot menu - $pcur= 63 gosub "pinfo" $file_attr=getfileattr($filename) $pcur= 64 gosub "pinfo" IF setfileattr($filename, 128) $pcur= 65 gosub "pinfo" ENDIF $pcur= 66 gosub "pinfo" IF (readprofilestring($filename, "boot loader", "timeout") <> "1") $pcur= 67 gosub "pinfo" IF (writeprofilestring($filename, "boot loader", "timeout", "1") = 0) $pcur= 68 gosub "pinfo" $info=$info+" boot.timeout=1" $pcur= 69 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 70 gosub "pinfo" ? " "+$filename+" (attr: "+$file_attr+") -> [boot loader] timeout=1" $pcur= 71 gosub "pinfo" ENDIF $pcur= 72 gosub "pinfo" ENDIF $pcur= 73 gosub "pinfo" ENDIF $pcur= 74 gosub "pinfo" IF setfileattr($filename, $file_attr) $pcur= 75 gosub "pinfo" ENDIF $pcur= 76 gosub "pinfo" ENDIF $pcur= 77 gosub "pinfo" $pcur= 78 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 79 gosub "pinfo" ; - add "Quickview with Notepad" to menu, when no file association exist - $pcur= 80 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 81 gosub "pinfo" $pcur= 82 gosub "pinfo" ; - enabling 'quickview with notepad' - $pcur= 83 gosub "pinfo" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $pcur= 84 gosub "pinfo" $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $pcur= 85 gosub "pinfo" $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $pcur= 86 gosub "pinfo" $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") $pcur= 87 gosub "pinfo" ENDIF $pcur= 88 gosub "pinfo" ; $pcur= 89 gosub "pinfo" $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $pcur= 90 gosub "pinfo" $ikey_ex=ENUMVALUE($ikey, 0) $pcur= 91 gosub "pinfo" $default_notepad="Quickview with Notepad" $pcur= 92 gosub "pinfo" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $pcur= 93 gosub "pinfo" $result_data_type=ReadType($ikey, $ikey_ex) $pcur= 94 gosub "pinfo" ELSE $pcur= 95 gosub "pinfo" $result_data_type="REG_SZ" $pcur= 96 gosub "pinfo" ENDIF $pcur= 97 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) $pcur= 98 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) $pcur= 99 gosub "pinfo" ENDIF $pcur= 100 gosub "pinfo" ENDIF $pcur= 101 gosub "pinfo" ; $pcur= 102 gosub "pinfo" $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $pcur= 103 gosub "pinfo" $ikey_ex=ENUMVALUE($ikey, 0) $pcur= 104 gosub "pinfo" $default_notepad_exe="notepad.exe %1" $pcur= 105 gosub "pinfo" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $pcur= 106 gosub "pinfo" $result_data_type=ReadType($ikey, $ikey_ex) $pcur= 107 gosub "pinfo" ELSE $pcur= 108 gosub "pinfo" $result_data_type="REG_SZ" $pcur= 109 gosub "pinfo" ENDIF $pcur= 110 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) $pcur= 111 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) $pcur= 112 gosub "pinfo" ENDIF $pcur= 113 gosub "pinfo" ENDIF $pcur= 114 gosub "pinfo" $pcur= 115 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 116 gosub "pinfo" ; - change "regfile" + "vbsfile" to edit mode - $pcur= 117 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 118 gosub "pinfo" $pcur= 119 gosub "pinfo" $ikey="HKEY_CLASSES_ROOT\regfile\shell" $pcur= 120 gosub "pinfo" $ikey_ex=ENUMVALUE($ikey, 0) $pcur= 121 gosub "pinfo" $default_key="edit" $pcur= 122 gosub "pinfo" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $pcur= 123 gosub "pinfo" $result_data_type=ReadType($ikey, $ikey_ex) $pcur= 124 gosub "pinfo" ELSE $pcur= 125 gosub "pinfo" $result_data_type="REG_SZ" $pcur= 126 gosub "pinfo" ENDIF $pcur= 127 gosub "pinfo" IF (ReadValue($ikey, $ikey_ex) <> $default_key) $pcur= 128 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) $pcur= 129 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) $pcur= 130 gosub "pinfo" ENDIF $pcur= 131 gosub "pinfo" ENDIF $pcur= 132 gosub "pinfo" $info=$info+" "+$ikey+"="+$default_key $pcur= 133 gosub "pinfo" ENDIF $pcur= 134 gosub "pinfo" ; $pcur= 135 gosub "pinfo" $ikey="HKEY_CLASSES_ROOT\vbsfile\shell" $pcur= 136 gosub "pinfo" $ikey_ex=ENUMVALUE($ikey, 0) $pcur= 137 gosub "pinfo" $default_key="edit" $pcur= 138 gosub "pinfo" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $pcur= 139 gosub "pinfo" $result_data_type=ReadType($ikey, $ikey_ex) $pcur= 140 gosub "pinfo" ELSE $pcur= 141 gosub "pinfo" $result_data_type="REG_SZ" $pcur= 142 gosub "pinfo" ENDIF $pcur= 143 gosub "pinfo" IF (ReadValue($ikey, $ikey_ex) <> $default_key) $pcur= 144 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_key, $result_data_type) = 0) $pcur= 145 gosub "pinfo" IF (writevalue($ikey, $ikey_ex, $default_key, "REG_SZ") = 0) $pcur= 146 gosub "pinfo" ENDIF $pcur= 147 gosub "pinfo" ENDIF $pcur= 148 gosub "pinfo" $info=$info+" "+$ikey+"="+$default_key $pcur= 149 gosub "pinfo" ENDIF $pcur= 150 gosub "pinfo" $pcur= 151 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 152 gosub "pinfo" ; - cleanup 'recent list' - $pcur= 153 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 154 gosub "pinfo" $pcur= 155 gosub "pinfo" $max_ikeys=23 $pcur= 156 gosub "pinfo" DIM $ikeys[$max_ikeys+1] $pcur= 157 gosub "pinfo" $ikeys[01]="HKEY_CURRENT_USER\Software\Binary Research Ltd\Ghost Explorer\Recent File List" $pcur= 158 gosub "pinfo" $ikeys[02]="HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs" $pcur= 159 gosub "pinfo" $ikeys[03]="HKEY_CURRENT_USER\Software\Microsoft\Microsoft Management Console\Recent File List" $pcur= 160 gosub "pinfo" $ikeys[04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\Recent File List" $pcur= 161 gosub "pinfo" $ikeys[05]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\MS Project\Recent File List" $pcur= 162 gosub "pinfo" $ikeys[06]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\PowerPoint\Recent File List" $pcur= 163 gosub "pinfo" $ikeys[07]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Recent File List" $pcur= 164 gosub "pinfo" $ikeys[08]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\MS Project\Recent File List" $pcur= 165 gosub "pinfo" $ikeys[09]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\PowerPoint\Recent File List" $pcur= 166 gosub "pinfo" $ikeys[10]="HKEY_CURRENT_USER\Software\Microsoft\Outlook Express\Recent Stationery List" $pcur= 167 gosub "pinfo" $ikeys[11]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List" $pcur= 168 gosub "pinfo" $ikeys[12]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\WordPad\Recent File List" $pcur= 169 gosub "pinfo" $ikeys[13]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\DesktopStreamMRU" $pcur= 170 gosub "pinfo" $ikeys[14]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU" $pcur= 171 gosub "pinfo" $ikeys[15]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU" $pcur= 172 gosub "pinfo" $ikeys[16]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU" $pcur= 173 gosub "pinfo" $ikeys[17]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs" $pcur= 174 gosub "pinfo" $ikeys[18]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" $pcur= 175 gosub "pinfo" $ikeys[19]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU" $pcur= 176 gosub "pinfo" $ikeys[20]="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Preload" $pcur= 177 gosub "pinfo" $ikeys[21]="HKEY_CURRENT_USER\Software\Netscape\Netscape Navigator\URL History" $pcur= 178 gosub "pinfo" $ikeys[22]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\extract" $pcur= 179 gosub "pinfo" $ikeys[23]="HKEY_CURRENT_USER\Software\Nico Mak Computing\Winzip\filemenu" $pcur= 180 gosub "pinfo" ; $pcur= 181 gosub "pinfo" $i=1 $pcur= 182 gosub "pinfo" WHILE ($i <= $max_ikeys) $pcur= 183 gosub "pinfo" $ikey=$ikeys[$i] $pcur= 184 gosub "pinfo" $i=$i+1 $pcur= 185 gosub "pinfo" IF (ExistKey($ikey) = 0) $pcur= 186 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 187 gosub "pinfo" ? "input -> ["+$ikey+"]" $pcur= 188 gosub "pinfo" ENDIF $pcur= 189 gosub "pinfo" $index=0 $pcur= 190 gosub "pinfo" DO $pcur= 191 gosub "pinfo" $icode=ENUMVALUE($ikey, $index) $pcur= 192 gosub "pinfo" IF (len($icode) <> 0) $pcur= 193 gosub "pinfo" $ivalue=ReadValue($ikey, $icode) $pcur= 194 gosub "pinfo" $result=DelValue($ikey, $icode) $pcur= 195 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 196 gosub "pinfo" IF ($result = 0) $pcur= 197 gosub "pinfo" ? " "+$icode+"="+$ivalue $pcur= 198 gosub "pinfo" ELSE $pcur= 199 gosub "pinfo" ? " error "+$icode+"="+$ivalue+" -> "+$result $pcur= 200 gosub "pinfo" ENDIF $pcur= 201 gosub "pinfo" ENDIF $pcur= 202 gosub "pinfo" IF ($result <> 0) $pcur= 203 gosub "pinfo" $index=$index+1 $pcur= 204 gosub "pinfo" ENDIF $pcur= 205 gosub "pinfo" ENDIF $pcur= 206 gosub "pinfo" UNTIL (len($icode) = 0) $pcur= 207 gosub "pinfo" $index=$index+1 $pcur= 208 gosub "pinfo" DO $pcur= 209 gosub "pinfo" $icode=ENUMVALUE($ikey, $index) $pcur= 210 gosub "pinfo" IF (len($icode) <> 0) $pcur= 211 gosub "pinfo" $ivalue=ReadValue($ikey, $icode) $pcur= 212 gosub "pinfo" $result=DelValue($ikey, $icode) $pcur= 213 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 214 gosub "pinfo" IF ($result = 0) $pcur= 215 gosub "pinfo" ? " "+$icode+"="+$ivalue $pcur= 216 gosub "pinfo" ELSE $pcur= 217 gosub "pinfo" ? " error "+$icode+"="+$ivalue+" -> "+$result $pcur= 218 gosub "pinfo" ENDIF $pcur= 219 gosub "pinfo" ENDIF $pcur= 220 gosub "pinfo" IF ($result <> 0) $pcur= 221 gosub "pinfo" $index=$index+1 $pcur= 222 gosub "pinfo" ENDIF $pcur= 223 gosub "pinfo" ENDIF $pcur= 224 gosub "pinfo" UNTIL (len($icode) = 0) $pcur= 225 gosub "pinfo" ENDIF $pcur= 226 gosub "pinfo" LOOP $pcur= 227 gosub "pinfo" ; $pcur= 228 gosub "pinfo" $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" $pcur= 229 gosub "pinfo" IF (Exist($ikey) = 0) $pcur= 230 gosub "pinfo" $ivalue=ReadValue($ikey, "Recent") $pcur= 231 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 232 gosub "pinfo" ? "recent.user_shell_folders -> "+$ivalue+"="+ExpandEnvironmentVars($ivalue) $pcur= 233 gosub "pinfo" ENDIF $pcur= 234 gosub "pinfo" IF (len($ivalue) <> 0) $pcur= 235 gosub "pinfo" DEL ExpandEnvironmentVars($ivalue)+"\*.lnk" $pcur= 236 gosub "pinfo" ENDIF $pcur= 237 gosub "pinfo" ENDIF $pcur= 238 gosub "pinfo" ; $pcur= 239 gosub "pinfo" $ikey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" $pcur= 240 gosub "pinfo" IF (Exist($ikey) = 0) $pcur= 241 gosub "pinfo" $ivalue=ReadValue($ikey, "Recent") $pcur= 242 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 243 gosub "pinfo" ? "recent.shell_folders -> "+$ivalue+"="+ExpandEnvironmentVars($ivalue) $pcur= 244 gosub "pinfo" ENDIF $pcur= 245 gosub "pinfo" IF (len($ivalue) <> 0) $pcur= 246 gosub "pinfo" DEL ExpandEnvironmentVars($ivalue)+"\*.lnk" $pcur= 247 gosub "pinfo" ENDIF $pcur= 248 gosub "pinfo" ENDIF $pcur= 249 gosub "pinfo" ; $pcur= 250 gosub "pinfo" DEL "c:\ffastun*.*" $pcur= 251 gosub "pinfo" DEL "c:\file*.chk" $pcur= 252 gosub "pinfo" DEL "c:\temp\~*.*" $pcur= 253 gosub "pinfo" DEL "c:\temp\*.~*" $pcur= 254 gosub "pinfo" DEL "c:\temp\*.??~" $pcur= 255 gosub "pinfo" DEL "c:\temp\*.tmp" $pcur= 256 gosub "pinfo" DEL "c:\temp\mscreate.dir" $pcur= 257 gosub "pinfo" DEL "c:\temp\*.---" $pcur= 258 gosub "pinfo" IF ($nt_mode = "yes") $pcur= 259 gosub "pinfo" DEL "c:\winnt\~*.*" $pcur= 260 gosub "pinfo" DEL "c:\winnt\*.~*" $pcur= 261 gosub "pinfo" DEL "c:\winnt\*.??~" $pcur= 262 gosub "pinfo" DEL "c:\winnt\*.tmp" $pcur= 263 gosub "pinfo" DEL "c:\winnt\mscreate.dir" $pcur= 264 gosub "pinfo" DEL "c:\winnt\*.---" $pcur= 265 gosub "pinfo" DEL "c:\winnt\temp\~*.*" $pcur= 266 gosub "pinfo" DEL "c:\winnt\temp\*.~*" $pcur= 267 gosub "pinfo" DEL "c:\winnt\temp\*.??~" $pcur= 268 gosub "pinfo" DEL "c:\winnt\temp\*.tmp" $pcur= 269 gosub "pinfo" DEL "c:\winnt\temp\mscreate.dir" $pcur= 270 gosub "pinfo" DEL "c:\winnt\temp\*.---" $pcur= 271 gosub "pinfo" ELSE $pcur= 272 gosub "pinfo" DEL "c:\windows\~*.*" $pcur= 273 gosub "pinfo" DEL "c:\windows\*.~*" $pcur= 274 gosub "pinfo" DEL "c:\windows\*.??~" $pcur= 275 gosub "pinfo" DEL "c:\windows\*.tmp" $pcur= 276 gosub "pinfo" DEL "c:\windows\mscreate.dir" $pcur= 277 gosub "pinfo" DEL "c:\windows\*.---" $pcur= 278 gosub "pinfo" DEL "c:\windows\temp\~*.*" $pcur= 279 gosub "pinfo" DEL "c:\windows\temp\*.~*" $pcur= 280 gosub "pinfo" DEL "c:\windows\temp\*.??~" $pcur= 281 gosub "pinfo" DEL "c:\windows\temp\*.tmp" $pcur= 282 gosub "pinfo" DEL "c:\windows\temp\mscreate.dir" $pcur= 283 gosub "pinfo" DEL "c:\windows\temp\*.---" $pcur= 284 gosub "pinfo" ENDIF $pcur= 285 gosub "pinfo" ; $pcur= 286 gosub "pinfo" $max_ikeys=8 $pcur= 287 gosub "pinfo" DIM $ikeys[$max_ikeys+1] $pcur= 288 gosub "pinfo" DIM $sub_ikeys[$max_ikeys+1] $pcur= 289 gosub "pinfo" $ikeys [01]="HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\4.0\AdobeViewer" $pcur= 290 gosub "pinfo" $sub_ikeys[01]="AVPrecentFile" ; <nr> $pcur= 291 gosub "pinfo" $ikeys [02]="HKEY_CURRENT_USER\Software\Adobe\Adobe Acrobat\4.0\AdobeViewer" $pcur= 292 gosub "pinfo" $sub_ikeys[02]="AVPrecentFile" ; <nr> $pcur= 293 gosub "pinfo" $ikeys [03]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $pcur= 294 gosub "pinfo" $sub_ikeys[03]="MRU" ; <nr> $pcur= 295 gosub "pinfo" $ikeys [04]="HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Access\Settings" $pcur= 296 gosub "pinfo" $sub_ikeys[04]="MRUFlags" ; <nr> $pcur= 297 gosub "pinfo" $ikeys [05]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $pcur= 298 gosub "pinfo" $sub_ikeys[05]="MRU" ; <nr> $pcur= 299 gosub "pinfo" $ikeys [06]="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Access\Settings" $pcur= 300 gosub "pinfo" $sub_ikeys[06]="MRUFlags" ; <nr> $pcur= 301 gosub "pinfo" $ikeys [07]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $pcur= 302 gosub "pinfo" $sub_ikeys[07]="LastFile" ; <nr> $pcur= 303 gosub "pinfo" $ikeys [08]="HKEY_CURRENT_USER\Software\Microsoft\Photo Editor\3.0\Microsoft Photo Editor" $pcur= 304 gosub "pinfo" $sub_ikeys[08]="LastType" ; <nr> $pcur= 305 gosub "pinfo" ; $pcur= 306 gosub "pinfo" $i=1 $pcur= 307 gosub "pinfo" WHILE ($i <= $max_ikeys) $pcur= 308 gosub "pinfo" $ikey=$ikeys[$i] $pcur= 309 gosub "pinfo" $sub_ikey=$sub_ikeys[$i] $pcur= 310 gosub "pinfo" IF (ExistKey($ikey) = 0) $pcur= 311 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 312 gosub "pinfo" ? "input -> ["+$ikey+"]+["+$sub_ikey+"??]" $pcur= 313 gosub "pinfo" ENDIF $pcur= 314 gosub "pinfo" $k=0 $pcur= 315 gosub "pinfo" WHILE ($k <= 10) $pcur= 316 gosub "pinfo" $ivalue=ReadValue($ikey, $sub_ikey+$k) $pcur= 317 gosub "pinfo" $result=DelValue($ikey, $sub_ikey+$k) $pcur= 318 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 319 gosub "pinfo" IF ($result = 0) $pcur= 320 gosub "pinfo" ? " "+$sub_ikey+$k+"="+$ivalue $pcur= 321 gosub "pinfo" ELSE $pcur= 322 gosub "pinfo" ; ? " error "+$sub_ikey+$k+"="+$ivalue+" -> "+$result $pcur= 323 gosub "pinfo" ENDIF $pcur= 324 gosub "pinfo" ENDIF $pcur= 325 gosub "pinfo" $k=$k+1 $pcur= 326 gosub "pinfo" LOOP $pcur= 327 gosub "pinfo" ENDIF $pcur= 328 gosub "pinfo" $i=$i+1 $pcur= 329 gosub "pinfo" LOOP $pcur= 330 gosub "pinfo" ; $pcur= 331 gosub "pinfo" $info=$info+" cleanup.recent" $pcur= 332 gosub "pinfo" $pcur= 333 gosub "pinfo" ; -------------------------------------------------------------------------- $pcur= 334 gosub "pinfo" $pcur= 335 gosub "pinfo" :end_script $pcur= 336 gosub "pinfo" IF ($debug_mode = "yes") $pcur= 337 gosub "pinfo" ? $info $pcur= 338 gosub "pinfo" ENDIF $pcur= 339 gosub "pinfo" BREAK on $pcur= 340 gosub "pinfo" FLUSHKB $pcur= 341 gosub "pinfo" :end;($begin) ; ; wed 06-sep-2000 05:32:10 ; ;Informative KIXSTRIP: no errors found. ; ;Informative KIXSTRIP: 56 block_structures found. ;Informative KIXSTRIP: 2 labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ; ;($end) at (9,25) "Starting Windows...completed" at (20,1) " " exit info $pstop=341 IF ($pcur <= 1) cls at (9,30) "Starting Windows..." box (10,5,12,75,"single") box (14,5,16,75,"single") $pcolumn=6 ENDIF $ppercentage=(100*$pcur)/$pstop IF ($pcolumn > 74) $pcolumn=6 ENDIF $pcolumn=6+((74-6)*$ppercentage)/100 at (11,$pcolumn) CHR(166) at (13,37) $ppercentage " %" at (15,37) $pcur " .. " $pstop return
Greetings.
|
|
Top
|
|
|
|
#50802 - 2001-03-26 01:48 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,A new version of kixstrip.exe 2.01 has been created. Some minor problems has been fixed:
- a very occasional problem which range checking has been fixed.
User gets in earlier versions "runtime error 201".
- /tab doesn't work clearly with /debug option. fixed.
- version information added to summary of structure.
- examples added to help information. help information retrieve with
kixstrip ?
Output of command help ?:
code:
Kixstrip 3.63 (vs 2.01e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 ------------------------------------------------------------------------------ kixstrip [input] [output] /Block_Check or /BC /Combine /Debug /Headers /License /License=[var] /Performance /Print /Progress /Show_Errors or /SE /Translate /TAB=[num] (def: 6) default: /Combine /Headers /License (other options are negative) other: - options with prefix "/No" will be ignored. f.e. /NoDebug /NoTab - /Block_Check /Tab=2 (auto set: /NoCombine /NoLicense /Print ) /Debug (auto set: /NoLicense /Print /Show_Errors ) - /Block_Check (reformat kixtart code inc. block structure ) /Combine (combine lines to one line ) /Headers (insert summary report as footer ) /Debug (insert "line numbers" for each printed line ) /Performance (insert "indicator" for each executed line) /Print (do not remove print statements ) /Progress (insert "indicator" for each printed line ) /Show_Errors (insert error messages in output file ) /Translate (convert keywords to upper/lower-case ) examples - kixstrip test.kix test.out /Print - kixstrip test.kix test.out /Block_Check /Debug /Show_Errors - kixstrip test.kix test.out /Performance
An example of kixstrip test.kix test.out /block_check /debug /show_errors. Result of test.out:
code:
?"- 1-" IF ingroup("\\CS08\LOGONUSER") = 1 ?"- 2-" USE T: "\\cs08\template" ?"- 3-" USE g: "\\cs08\%username%" ?"- 4-" end IF ?"- 5-" IF ingroup("MSFIN") = 1 ?"- 6-" USE V: "\\cs09\finance" ?"- 7-" USE s: "\\cs02\t_bms\res4w" ?"- 8-" USE i: "\\cs08\MGT_FIN" ?"- 9-" ENDIF ?"- 10-" IF ingroup("TOCBID") = 1 ?"- 11-" USE T: "\\cs08\template" ?"- 12-" USE g: "\\cs08\%USERNAME%" ?"- 13-" USE h: "\\cs08\toc_bid" ?"- 14-" USE J: "\\cs08\tpe_bid_pub" ?"- 15-" ENDIF ?"- 16-" ? @user ; -------> Warning KIXSTRIP: 16 line contains unknown function. ?"- 17-" IF ($os = "w95" ; -------> Warning KIXSTRIP: 17 line incomplete "left parenthesis". ; -------> Warning KIXSTRIP: 17 line incompleted. ?"- 18-" ? $os ?"- 19-" ENDIF ?"- 20-" EXIT ?"- 21-" ;($begin) ; ; sun 25-mar-2001 20:54:58 (3.63 vs 2.01e) ; ;Warning KIXSTRIP: 2 blocks are incompleted. ; missing "do/until", "if/else/endif", "while/loop" ; "select/case/endselect" statement. ; - do/until [0:0] ; - if/else/endif [5:0:3] ; - select/case/endselect [0:0:0] ; - while/loop [0:0] ;Warning KIXSTRIP: 1 line is incompleted. ;Warning KIXSTRIP: some lines contains errors or possible errors. ; 1 line incomplete "left parenthesis". ; 1 line incompleted. ; 1 line contains unknown function. ;Informative KIXSTRIP: 5 block_structures found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: CALL EXIT GOSUB GOTO QUIT RETURN RUN SHELL USE ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 9 USE ; ;($end) ;($begin) ; ;Warning KIXSTRIP: 17 line incomplete "left parenthesis". ;Warning KIXSTRIP: 17 line incompleted. ;Warning KIXSTRIP: 16 "@user" line contains unknown function. ; ;($end)
The screen output of above example:
code:
Kixstrip 3.63 (vs 2.01e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 . Warning KIXSTRIP: 17 line incomplete "left parenthesis". Warning KIXSTRIP: 17 line incompleted. Warning KIXSTRIP: 16 "@user" line contains unknown function. . Kixstrip 3.63 (vs 2.01e) 0.06 (sec) . input 21 test.kix output 21 test.out block_check -ERROR- block_errors_count=2 block_structures=5 labels=0 tab=6 (default) . Warning KIXSTRIP: 2 blocks are incompleted. missing "do/until", "if/else/endif", "while/loop" "select/case/endselect" statement. - do/until [0:0] - if/else/endif [5:0:3] - select/case/endselect [0:0:0] - while/loop [0:0] 5 block_structures found. Warning KIXSTRIP: 1 line is incompleted. Warning KIXSTRIP: 1 line contains unknown function. . active options: /Block_Check /Debug /Headers /Print /Show_Errors /TAB=6 /Translate inactive options: /NoCombine /NoPerformance /NoProgress /NoLicense: (not.specified)
Greetings. BTW: related kixtart topic:
|
|
Top
|
|
|
|
#50803 - 2001-04-10 03:42 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,Two new versions of kixstrip has been created.
- kixstrip.exe 2.02 = latest update for kixtart 3.63.
calling kixstrip363.exe
- kixstrip.exe 2.12 = update for kixtart 4.00 beta1.
calling kixstrip400.exe
Programs situated at site http://home.wanadoo.nl/scripting The only change in first version 2.02 is an enhancement in collecting error information. This version isn't upwards compatible with kixtart 4.00 version. The latest version 2.12 gets a great list of changes:
- add: upgrade to kixtart 4.00 beta 1. downwards compatible.
- add: introduction of option /Show_Structure or /SS, which shows always block structure
information.
- add: enhancement of error information by block structures.
- add: redesign of output screen (specially for block structures + functions).
- add: number of counters has been increased (special counters: OLExxx which is not longer
supported at version 4.00 & then which is an illegal statement).
Different kind of examples shows you the changes:
code:
IF (1=1) ? "if true" ELSE ? "if false" ENDIFWHILE (1=1) ? "while ok" LOOP DO ? "do ok" UNTIL (1=1) SELECT CASE (1=1) ENDSELECT FUNCTION x ? "function" ENDFUNCTION FOR EACH $x IN $xx ? $xx[$x] NEXT FOR $x=1 TO 100 STEP 2 ? "for to" NEXT $result=get_kix_version() ? "show kix version "+$result exit function get_kix_version($dummy) $get_kix_version=@kix endfunction
Output of running kixstrip with option /Show_Structure:
code:
;($begin) ; ; Kixtart 4.00 ; ; (c) MCA - scripting@wanadoo.nl - 2000, 2001 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; ;($end) if (1=1) else endif while (1=1) loop do until (1=1) select case (1=1) endselect function x endfunction for each $x in $xx next for $x=1 to 100 step 2 next $result=get_kix_version() exit function get_kix_version($dummy) $get_kix_version=@kix endfunction ;($begin) ; ; tue 10-apr-2001 01:33:58 (kix 4.00 vs 2.12e) ; ;Informative KIXSTRIP: no errors found. ; ;Summary KIXSTRIP: block structures ; - do:until [1:1] ; - for|each:in|to:step|next [2|1:1|1:1|2] ; - function:endfunction [2:2] ; - if:else:endif [1:1:1] ; - select:case:endselect [1:1:1] ; - while:loop [1:1] ;Informative KIXSTRIP: 8 block_structures found. ;Informative KIXSTRIP: 2 functions found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 2 ENDFUNCTION ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 2 FUNCTION ; ;($end)
Screen output of running kixstrip with option /Show_Structure:
code:
Kixstrip 4.00 (vs 2.12e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 1 ..E(38) Kixstrip 4.00 (vs 2.12e) 0.16 (sec)
input 38 example1.kix output 21 example1.out (skip: 17 blocks: 0 labels: 0) Summary KIXSTRIP: block structures - do:until [1:1] - for|each:in|to:step|next [2|1:1|1:1|2] - function:endfunction [2:2] - if:else:endif [1:1:1] - select:case:endselect [1:1:1] - while:loop [1:1] 8 block_structures found. Warning KIXSTRIP: 2 functions found. Informative KIXSTRIP: no errors found. active options: /Combine /Headers /Show_Structure /License: MCA - scripting@wanadoo.nl - 2000, 2001 inactive options: /NoBlock_Check /NoDebug /NoPerformance /NoPrint /NoProgress /NoShow_Errors /NoTAB /NoTranslate
Screen output of running kixstrip without option /Show_Structure:
code:
Kixstrip 4.00 (vs 2.12e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 1 ..E(38) Kixstrip 4.00 (vs 2.12e) 0.17 (sec) input 38 example1.kix output 21 example1.out (skip: 17 blocks: 0 labels: 0) Informative KIXSTRIP: no errors found. active options: /Combine /Headers /License: MCA - scripting@wanadoo.nl - 2000, 2001 inactive options: /NoBlock_Check /NoDebug /NoPerformance /NoPrint /NoProgress /NoShow_Errors /NoShow_Structure /NoTAB /NoTranslate
Another example which contains block structures and other elements:
code:
do ? "do" until (1=1) ? "end.do" $xx='aa','bb' for each $x in $xx ? $x next ? "end.for.each.in" for $i=1 to 10 step 2 ? $i next ? "end.for.to.step" function XXX () ? @date endfunction ? "end.function" if (1=1) and (2=2) or (3=3) ? "true" else "false" endif ? "end.if" select case (1=1) ? "1=1" case (2=2) ? "2=2" endselect ? "end.select" while (1=1) ? "while" loop ? "end.while"; some examples " counters are: " BREAK CALL DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE " unknown function is:" @unknown_macro " missing elements: " ? "dit is een test ? 'dit is een test until (1=1) next endfunction endif endselect loop " OLExxx functions: " OleCallFunc OleCallProc OleCreateObject OleEnumObject OleGetObject OleGetProperty OleGetSubObject OlePutProperty OleReleaseObject CreateObject GetObject
Output of running kixstrip.exe with options /block_check /show_errors:
code:
DO ? "do" UNTIL (1=1) ? "end.do" $xx='aa','bb' FOR EACH $x IN $xx ? $x NEXT ? "end.for.each.in" FOR $i=1 TO 10 STEP 2 ? $i NEXT ? "end.for.to.step" FUNCTION XXX () ? @date ENDFUNCTION ? "end.function" IF (1=1) AND (2=2) OR (3=3) ? "true" ELSE "false" ENDIF ? "end.if" SELECT CASE (1=1) ? "1=1" CASE (2=2) ? "2=2" ENDSELECT ? "end.select" WHILE (1=1) ? "while" LOOP ? "end.while" ; some examples " counters are: " BREAK CALL DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION ; -------> Warning KIXSTRIP: 18 block "function/endfunction" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 18 block incompleted. GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE " unknown function is:" @unknown_macro ; -------> Warning KIXSTRIP: 23 line contains unknown function. " missing elements: " ? "dit is een test ; -------> Warning KIXSTRIP: 26 line incomplete "double quotation". ; -------> Warning KIXSTRIP: 26 line incompleted. ? 'dit is een test ; -------> Warning KIXSTRIP: 27 line incomplete "single quotation". ; -------> Warning KIXSTRIP: 27 line incompleted. UNTIL (1=1) NEXT ; -------> Warning KIXSTRIP: 29 block "for/.../next" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 29 block incompleted. ENDFUNCTION ; -------> Warning KIXSTRIP: 30 block "function/endfunction" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 30 block incompleted. ENDIF ; -------> Warning KIXSTRIP: 31 block "if/else/endif" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 31 block incompleted. ENDSELECT ; -------> Warning KIXSTRIP: 32 block "select/case/endselect" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 32 block incompleted. LOOP ; -------> Warning KIXSTRIP: 33 block "while/loop" incompleted. starting point of block structure missing. ; -------> Warning KIXSTRIP: 33 block incompleted. " OLExxx functions: " OleCallFunc OleCallProc OleCreateObject OleEnumObject OleGetObject OleGetProperty OleGetSubObject OlePutProperty OleReleaseObject CreateObject GetObject ;($begin) ; ; tue 10-apr-2001 01:46:18 (kix 4.00 vs 2.12e) ; ;Warning KIXSTRIP: 6 blocks are incompleted. missing statement(s). ; -ERROR- - do:until [1:2] ; -ERROR- - for|each:in|to:step|next [2|1:1|1:1|3] ; -ERROR- - function:endfunction [2:3] ; -ERROR- - if:else:endif [1:1:2] ; -ERROR- - select:case:endselect [1:2:2] ; -ERROR- - while:loop [1:2] ;Warning KIXSTRIP: 2 lines are incompleted. ;Warning KIXSTRIP: found illegal statement THEN. ;Warning KIXSTRIP: some lines contains errors or possible errors. ; 1 line incomplete "single quotation". ; 1 line incomplete "double quotation". ; 1 block "for/.../next" incompleted. starting point of block structure missing. ; 2 block "function/endfunction" incompleted. starting point of block structure missing. ; 1 block "if/else/endif" incompleted. starting point of block structure missing. ; 1 block "select/case/endselect" incompleted. starting point of block structure missing. ; 1 block "while/loop" incompleted. starting point of block structure missing. ; 6 block incompleted. ; 2 line incompleted. ; 1 line contains unknown function. ;Informative KIXSTRIP: 8 block_structures found. ;Informative KIXSTRIP: 2 functions found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 1 BREAK ;Informative KIXSTRIP: 1 CALL ;Informative KIXSTRIP: 1 DISPLAY ;Informative KIXSTRIP: 3 ENDFUNCTION ;Informative KIXSTRIP: 1 EXECUTE ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 2 FUNCTION ;Informative KIXSTRIP: 1 GET ;Informative KIXSTRIP: 1 GETS ;Informative KIXSTRIP: 1 GOSUB ;Informative KIXSTRIP: 1 GOTO ;Warning KIXSTRIP: 10 OLExxx (no longer supported at vs 4.00) ;Informative KIXSTRIP: 1 PLAY ;Informative KIXSTRIP: 1 QUIT ;Informative KIXSTRIP: 1 RETURN ;Informative KIXSTRIP: 1 RUN ;Informative KIXSTRIP: 1 SHELL ;Informative KIXSTRIP: 1 SLEEP ;Warning KIXSTRIP: 1 THEN (illegal statement) ;Informative KIXSTRIP: 1 USE ; ;($end) ;($begin) ; ;Warning KIXSTRIP: 27 line incomplete "single quotation". ;Warning KIXSTRIP: 26 line incomplete "double quotation". ;Warning KIXSTRIP: 29 block "for/.../next" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 18, 30 block "function/endfunction" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 31 block "if/else/endif" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 32 block "select/case/endselect" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 33 block "while/loop" incompleted. starting point of block structure missing. ;Warning KIXSTRIP: 18, 29, 30, 31, 32, 33 block incompleted. ;Warning KIXSTRIP: 26, 27 line incompleted. ;Warning KIXSTRIP: 23 "@unknown_macro" line contains unknown function. ; ;($end)
Screen output of running kixstrip.exe with options /block_check /show_errors:
code:
Kixstrip 4.00 (vs 2.12e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 1 ...E(49) Warning KIXSTRIP: 27 line incomplete "single quotation". Warning KIXSTRIP: 26 line incomplete "double quotation". Warning KIXSTRIP: 29 block "for/.../next" incompleted. starting point of block structure missing. Warning KIXSTRIP: 18, 30 block "function/endfunction" incompleted. starting point of block structure missing. Warning KIXSTRIP: 31 block "if/else/endif" incompleted. starting point of block structure missing. Warning KIXSTRIP: 32 block "select/case/endselect" incompleted. starting point of block structure missing. Warning KIXSTRIP: 33 block "while/loop" incompleted. starting point of block structure missing. Warning KIXSTRIP: 18, 29, 30, 31, 32, 33 block incompleted. Warning KIXSTRIP: 26, 27 line incompleted. Warning KIXSTRIP: 23 "@unknown_macro" line contains unknown function. Kixstrip 4.00 (vs 2.12e) 0.22 (sec) input 49 example2.kix output 49 example2.out (skip: 0 blocks: 0 labels: 0) block_check -ERROR- block_errors=6 block_structures=8 functions=2 labels=0 tab=6 (default) Warning KIXSTRIP: 6 blocks are incompleted. missing statement(s). -ERROR- - do:until [1:2] -ERROR- - for|each:in|to:step|next [2|1:1|1:1|3] -ERROR- - function:endfunction [2:3] -ERROR- - if:else:endif [1:1:2] -ERROR- - select:case:endselect [1:2:2] -ERROR- - while:loop [1:2] 8 block_structures found. Warning KIXSTRIP: 2 functions found. Warning KIXSTRIP: 2 lines are incompleted. Warning KIXSTRIP: 1 line contains unknown function. Warning KIXSTRIP: found illegal statement THEN. active options: /Block_Check /Headers /Print /Show_Errors /TAB=6 /Translate inactive options: /NoCombine /NoDebug /NoPerformance /NoProgress /NoShow_Structure /NoLicense: (not.specified)
Latest example is a function created by Shawn:
code:
break on; sort some strings... $array = Peach,Pumpkin,Orange,Grape,Lime,Apple,Rasberry,Cherry,Lemon $array = bubbleup($array) for each $element in $array ? $element next ; sort some integers... $array = 109,75,200,25,38,19,150,11,20 $array = bubbleup($array) for each $element in $array ? $element next exit ;============================================ ; Bubble sort argv(0)...argv(n) increasing... ;============================================ function bubbleup($argv) ; if ubound($argv) $i=0 while $i < ubound($argv) $m = $argv[$i] $j = $i + 1 while $j < ubound($argv)+1 if $argv[$j] < $m $m = $argv[$j] $argv[$j] = $argv[$i] $argv[$i] = $m endif $j=$j+1 loop $i=$i+1 loop endif $bubbleup = $argv ; endfunction
Output of running kixstrip.exe with options /block_check /show_errors:
code:
BREAK on ; sort some strings... $array = Peach,Pumpkin,Orange,Grape,Lime,Apple,Rasberry,Cherry,Lemon $array = bubbleup($array) FOR EACH $element IN $array ? $element NEXT ; sort some integers... $array = 109,75,200,25,38,19,150,11,20 $array = bubbleup($array) FOR EACH $element IN $array ? $element NEXT EXIT ;============================================ ; Bubble sort argv(0)...argv(n) increasing... ;============================================ FUNCTION bubbleup($argv) ; IF ubound($argv) $i=0 WHILE $i < ubound($argv) $m = $argv[$i] $j = $i + 1 WHILE $j < ubound($argv)+1 IF $argv[$j] < $m $m = $argv[$j] $argv[$j] = $argv[$i] $argv[$i] = $m ENDIF $j=$j+1 LOOP $i=$i+1 LOOP ENDIF $bubbleup = $argv ; ENDFUNCTION ;($begin) ; ; tue 10-apr-2001 01:49:15 (kix 4.00 vs 2.12e) ; ;Informative KIXSTRIP: no errors found. ; ;Informative KIXSTRIP: 7 block_structures found. ;Informative KIXSTRIP: 1 function found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 1 BREAK ;Informative KIXSTRIP: 1 ENDFUNCTION ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 1 FUNCTION ; ;($end)
Screen output of running kixstrip.exe with options /block_check /show_errors:
code:
Kixstrip 4.00 (vs 2.12e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 1 ...E(45) Kixstrip 4.00 (vs 2.12e) 0.22 (sec)
input 45 example3.kix output 45 example3.txt (skip: 0 blocks: 0 labels: 0) block_check block_structures=7 functions=1 labels=0 tab=6 (default) Informative KIXSTRIP: no errors found. active options: /Block_Check /Headers /Print /Show_Errors /TAB=6 /Translate inactive options: /NoCombine /NoDebug /NoPerformance /NoProgress /NoShow_Structure /NoLicense: (not.specified)
At least screen output of a great kixstrip.exe run:
code:
Kixstrip 4.00 (vs 2.11e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 24000 ...E(24057) Warning KIXSTRIP: 188 line incomplete "left parenthesis". Warning KIXSTRIP: 260 block "function/endfunction" incompleted. starting point of block structure missing. Warning KIXSTRIP: 261 block "select/case/endselect" incompleted. starting point of block structure missing. Warning KIXSTRIP: 260, 261 block incompleted. Warning KIXSTRIP: 188 line incompleted. Kixstrip 4.00 (vs 2.12e) 132.15 (sec) input 24057 example9.kix output 18273 example9.out (skip: 5784 blocks: 0 labels: 19) Warning KIXSTRIP: 1 block is incompleted. missing statement(s). - do:until [135:135] -ERROR- - for|each:in|to:step|next [3|2:2|2:2|3] -ERROR- - function:endfunction [3:3] - if:else:endif [4615:1341:4615] -ERROR- - select:case:endselect [26:159:26] - while:loop [37:37] 4819 block_structures found. Warning KIXSTRIP: 3 functions found. Warning KIXSTRIP: 1 line is incompleted. rerun program with option "/block_check /show_errors". active options: /Combine /Headers /Show_Structure /License: MCA - scripting@wanadoo.nl - 2000, 2001 inactive options: /NoBlock_Check /NoDebug /NoPerformance /NoPrint /NoProgress /NoShow_Errors /NoTAB /NoTranslate
Any idea, comment, remark or question is welcome. We appreciate it to do it to this board. Greetings. btw: - checking of block structure by kixstrip.exe is more intelligent as the version implementated by program kixref.exe - related topics
|
|
Top
|
|
|
|
#50804 - 2001-05-06 03:54 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,A new version has been created. A list of changes are:
- add: output of option /debug shows which linenumber was executed & what was the time of execution.
- add: handle parameters of USE command (use /del /delete /password:[pw] /persistent /user:[user]).
- add: recognize "USE /delete" and "USE /del".
- fix: compression of unused spaces was sometimes incorrect. f.e. "copy file1 file2 /h" was transformed to "copy file1file2/h".
Program: kixstrip400.exe 2.23 Site: http://home.wanadoo.nl/scripting An example of input is:
code:
:part1 copy $file1 $file2 /H copy %macro% %macro% /H copy @userid \backup\@userid /H copy file1 file2 /H :part2 use l: /del /persistent /password:yes /user:yes /delete use l: /persistent use list :part3 set "a=1" setl "b=2" setm "c=3" password "pw" color N/W color N+/W color n/w+
Output of previous version 2.17
code:
:part1 copy $file1$file2/h copy %macro%%macro%/h copy @userid\backup\@userid/h copy file1file2/h :part2 use l:/del/persistent/password:yes/user:yes/delete use l:/persistent use list :part3 set "a=1" setl "b=2" setm "c=3" password "pw" color N/W color N+/w color n/w+ ;($begin) ; ; sat 05-may-2001 01:11:15 (kix 4.00 vs 2.17e) ; ;Informative KIXSTRIP: no errors found (input=17 output=17 skip=0). ; ;Summary KIXSTRIP: block structures ; - do:until [0:0] ; - for|each:in|to:step|next [0|0:0|0:0|0] ; - function:endfunction [0:0] ; - if:else:endif [0:0:0] ; - select:case:endselect [0:0:0] ; - while:loop [0:0] ;Informative KIXSTRIP: no block_structures found. ;Informative KIXSTRIP: no functions found. ;Informative KIXSTRIP: 3 labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 3 USE ; ;($end)
Output of actual version 2.23
code:
:part1 copy $file1 $file2 /h copy %macro% %macro% /h copy @userid\backup\@userid /h copy file1 file2 /h :part2 use l: /del /persistent /password:yes /user:yes /delete use l: /persistent use list :part3 set "a=1" setl "b=2" setm "c=3" password "pw" color N/W color N+/w color n/w+ ;($begin) ; ; sat 05-may-2001 01:18:38 (kix 4.00 vs 2.23e) ; ;Informative KIXSTRIP: no errors found (input=17 output=17 skip=0). ; ;Summary KIXSTRIP: block structures ; - do:until [0:0] ; - for|each:in|to:step|next [0|0:0|0:0|0] ; - function:endfunction [0:0] ; - if:else:endif [0:0:0] ; - select:case:endselect [0:0:0] ; - while:loop [0:0] ;Informative KIXSTRIP: no block_structures found. ;Informative KIXSTRIP: no functions found. ;Informative KIXSTRIP: 3 labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 3 USE ; ;($end)
The screen output of version 2.23 is:
code:
Kixstrip 4.00 (vs 2.23e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 1 .E(17) Kixstrip 4.00 (vs 2.23e) 0.05 (sec)
input 17 example.kix output 17 example.223 (skip: 0 blocks: 0 labels: 3) Summary KIXSTRIP: block structures - do:until [0:0] - for|each:in|to:step|next [0|0:0|0:0|0] - function:endfunction [0:0] - if:else:endif [0:0:0] - select:case:endselect [0:0:0] - while:loop [0:0] no block_structures found. Informative KIXSTRIP: no functions found. Informative KIXSTRIP: no errors found. active options: /Combine /Headers /Show_Structure /License: MCA - scripting@wanadoo.nl - 2000, 2001 inactive options: /NoBlock_Check /NoDebug /NoPerformance /NoPrint /NoProgress /NoShow_Errors /NoTAB /NoTranslate
The new output of kixstrip.exe /debug is:
code:
CLS AT (1,1) " " IF RedirectOutput("") ENDIF ?"- 1-"+@time+"- " IF setconsole("hide") ?"- 2-"+@time+"- " ENDIF ?"- 3-"+@time+"- " ; ?"- 4-"+@time+"- " ; NT/95 calculates os - Kixtart 3.62, 3.63, 4.00 ?"- 5-"+@time+"- " ; ?"- 6-"+@time+"- " ; (c) scripting@wanadoo.nl - 2000, 2001 ?"- 7-"+@time+"- " ; ?"- 8-"+@time+"- " ; vs 2.02 - program (calculates OS version with service pack) ?"- 9-"+@time+"- " ; ?"- 10-"+@time+"- " ; 1.00 (20000715) original version ?"- 11-"+@time+"- " ; 2.00 (20010330) - add "windows ME" ?"- 12-"+@time+"- " ; - returns $os + $os_type values ?"- 13-"+@time+"- " ; 2.01 (20010401) - kixtart 2001 beta1 compliancy ?"- 14-"+@time+"- " ; 2.02 (20010405) - remove cutting $os value ?"- 15-"+@time+"- " ; ?"- 16-"+@time+"- " $prgm_version="2.02" ?"- 17-"+@time+"- " ?"- 18-"+@time+"- " IF (@inwin = 1) ?"- 19-"+@time+"- " $nt_mode="yes" ?"- 20-"+@time+"- " ELSE ?"- 21-"+@time+"- " $nt_mode="no" ?"- 22-"+@time+"- " ENDIF ?"- 23-"+@time+"- " ?"- 24-"+@time+"- " $os="" ?"- 25-"+@time+"- " $os_dos=@dos ?"- 26-"+@time+"- " $os_product=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType") ?"- 27-"+@time+"- " $os_service_pack="" ?"- 28-"+@time+"- " $os_subversion=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber") ?"- 29-"+@time+"- " SELECT ?"- 30-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") ; - Windows 2000 - ?"- 31-"+@time+"- " $os="W2K_Server" ?"- 32-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.0") ?"- 33-"+@time+"- " $os="W2K_Professional" ?"- 34-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_product = "LANMANNT") ; - Windows NT - ?"- 35-"+@time+"- " $os="NT4_Domain_Controller" ?"- 36-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_product = "ServerNT") ?"- 37-"+@time+"- " $os="NT4_Member_Server" ?"- 38-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_product = "WinNT") ?"- 39-"+@time+"- " $os="NT4" ?"- 40-"+@time+"- " CASE ($nt_mode <> "yes") AND (@dos = "4.90") ?"- 41-"+@time+"- " $os="ME" ?"- 42-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"c") <> 0) ; - Windows 98 - ?"- 43-"+@time+"- " $os="W98c" ?"- 44-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"b") <> 0) ?"- 45-"+@time+"- " $os="W98b" ?"- 46-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"a") <> 0) ?"- 47-"+@time+"- " $os="W98a" ?"- 48-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") ?"- 49-"+@time+"- " $os="W98" ?"- 50-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"c") <> 0) ; - Windows 95 - ?"- 51-"+@time+"- " $os="W95c" ?"- 52-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"b") <> 0) ?"- 53-"+@time+"- " $os="W95b" ?"- 54-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"a") <> 0) ?"- 55-"+@time+"- " $os="W95a" ?"- 56-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") ?"- 57-"+@time+"- " $os="W95" ?"- 58-"+@time+"- " CASE 1 ?"- 59-"+@time+"- " $os="???" ; - undetermined - ?"- 60-"+@time+"- " ENDSELECT ?"- 61-"+@time+"- " ; ?"- 62-"+@time+"- " $os_service_pack="" ?"- 63-"+@time+"- " IF ($nt_mode = "yes") ?"- 64-"+@time+"- " $os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","CSDVersion") ?"- 65-"+@time+"- " IF (len($os_service_pack) <> 0) ?"- 66-"+@time+"- " $os=substr($os,1,3)+"_"+substr($os_service_pack,len($os_service_pack),1) ?"- 67-"+@time+"- " ENDIF ?"- 68-"+@time+"- " ENDIF ?"- 69-"+@time+"- " ; ?"- 70-"+@time+"- " $os_type="" ?"- 71-"+@time+"- " $os_dos=@dos ?"- 72-"+@time+"- " SELECT ?"- 73-"+@time+"- " CASE ($nt_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 - ?"- 74-"+@time+"- " $os_type="W2K" ?"- 75-"+@time+"- " CASE ($nt_mode = "yes") ; - Windows NT - ?"- 76-"+@time+"- " $os_type="NT4" ?"- 77-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME - ?"- 78-"+@time+"- " $os_type="ME" ?"- 79-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 - ?"- 80-"+@time+"- " $os_type="W98" ?"- 81-"+@time+"- " CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 - ?"- 82-"+@time+"- " $os_type="W95" ?"- 83-"+@time+"- " CASE 1 ?"- 84-"+@time+"- " $os_type="???" ; - undetermined - ?"- 85-"+@time+"- " ENDSELECT ?"- 86-"+@time+"- " $os_type=LTRIM(RTRIM(substr($os_type+" ",1,3))) ?"- 87-"+@time+"- " ; ?"- 88-"+@time+"- " ? "os "+$os ; <--- $os_type + service pack code ?"- 89-"+@time+"- " ? "os_type "+$os_type;($begin) ; ; sat 05-may-2001 01:46:27 (kix 4.00 vs 2.23e) ; ;Informative KIXSTRIP: no errors found (input=89 output=89 skip=0). ; ;Informative KIXSTRIP: 6 block_structures found. ;Informative KIXSTRIP: no functions found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ; ;($end)
New output of kixstrip /performance is:
code:
CLS AT (1,1) " " IF RedirectOutput("") ENDIF DIM $perf_hits[101] $perf_cur= 1 gosub "perf_info" IF setconsole("hide") $perf_cur= 2 gosub "perf_info" ENDIF $perf_cur= 3 gosub "perf_info" ; $perf_cur= 4 gosub "perf_info" ; NT/95 calculates os - Kixtart 3.62, 3.63, 4.00 $perf_cur= 5 gosub "perf_info" ; $perf_cur= 6 gosub "perf_info" ; (c) scripting@wanadoo.nl - 2000, 2001 $perf_cur= 7 gosub "perf_info" ; $perf_cur= 8 gosub "perf_info" ; vs 2.02 - program (calculates OS version with service pack) $perf_cur= 9 gosub "perf_info" ; $perf_cur= 10 gosub "perf_info" ; 1.00 (20000715) original version $perf_cur= 11 gosub "perf_info" ; 2.00 (20010330) - add "windows ME" $perf_cur= 12 gosub "perf_info" ; - returns $os + $os_type values $perf_cur= 13 gosub "perf_info" ; 2.01 (20010401) - kixtart 2001 beta1 compliancy $perf_cur= 14 gosub "perf_info" ; 2.02 (20010405) - remove cutting $os value $perf_cur= 15 gosub "perf_info" ; $perf_cur= 16 gosub "perf_info" $prgm_version="2.02" $perf_cur= 17 gosub "perf_info" $perf_cur= 18 gosub "perf_info" IF (@inwin = 1) $perf_cur= 19 gosub "perf_info" $nt_mode="yes" $perf_cur= 20 gosub "perf_info" ELSE $perf_cur= 21 gosub "perf_info" $nt_mode="no" $perf_cur= 22 gosub "perf_info" ENDIF $perf_cur= 23 gosub "perf_info" $perf_cur= 24 gosub "perf_info" $os="" $perf_cur= 25 gosub "perf_info" $os_dos=@dos $perf_cur= 26 gosub "perf_info" $os_product=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType") $perf_cur= 27 gosub "perf_info" $os_service_pack="" $perf_cur= 28 gosub "perf_info" $os_subversion=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber") $perf_cur= 29 gosub "perf_info" SELECT $perf_cur= 30 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") ; - Windows 2000 - $perf_cur= 31 gosub "perf_info" $os="W2K_Server" $perf_cur= 32 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.0") $perf_cur= 33 gosub "perf_info" $os="W2K_Professional" $perf_cur= 34 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_product = "LANMANNT") ; - Windows NT - $perf_cur= 35 gosub "perf_info" $os="NT4_Domain_Controller" $perf_cur= 36 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_product = "ServerNT") $perf_cur= 37 gosub "perf_info" $os="NT4_Member_Server" $perf_cur= 38 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_product = "WinNT") $perf_cur= 39 gosub "perf_info" $os="NT4" $perf_cur= 40 gosub "perf_info" CASE ($nt_mode <> "yes") AND (@dos = "4.90") $perf_cur= 41 gosub "perf_info" $os="ME" $perf_cur= 42 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"c") <> 0) ; - Windows 98 - $perf_cur= 43 gosub "perf_info" $os="W98c" $perf_cur= 44 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"b") <> 0) $perf_cur= 45 gosub "perf_info" $os="W98b" $perf_cur= 46 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") AND (INSTR(LCASE($os_subversion),"a") <> 0) $perf_cur= 47 gosub "perf_info" $os="W98a" $perf_cur= 48 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") $perf_cur= 49 gosub "perf_info" $os="W98" $perf_cur= 50 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"c") <> 0) ; - Windows 95 - $perf_cur= 51 gosub "perf_info" $os="W95c" $perf_cur= 52 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"b") <> 0) $perf_cur= 53 gosub "perf_info" $os="W95b" $perf_cur= 54 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") AND (INSTR(LCASE($os_subversion),"a") <> 0) $perf_cur= 55 gosub "perf_info" $os="W95a" $perf_cur= 56 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") $perf_cur= 57 gosub "perf_info" $os="W95" $perf_cur= 58 gosub "perf_info" CASE 1 $perf_cur= 59 gosub "perf_info" $os="???" ; - undetermined - $perf_cur= 60 gosub "perf_info" ENDSELECT $perf_cur= 61 gosub "perf_info" ; $perf_cur= 62 gosub "perf_info" $os_service_pack="" $perf_cur= 63 gosub "perf_info" IF ($nt_mode = "yes") $perf_cur= 64 gosub "perf_info" $os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","CSDVersion") $perf_cur= 65 gosub "perf_info" IF (len($os_service_pack) <> 0) $perf_cur= 66 gosub "perf_info" $os=substr($os,1,3)+"_"+substr($os_service_pack,len($os_service_pack),1) $perf_cur= 67 gosub "perf_info" ENDIF $perf_cur= 68 gosub "perf_info" ENDIF $perf_cur= 69 gosub "perf_info" ; $perf_cur= 70 gosub "perf_info" $os_type="" $perf_cur= 71 gosub "perf_info" $os_dos=@dos $perf_cur= 72 gosub "perf_info" SELECT $perf_cur= 73 gosub "perf_info" CASE ($nt_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 - $perf_cur= 74 gosub "perf_info" $os_type="W2K" $perf_cur= 75 gosub "perf_info" CASE ($nt_mode = "yes") ; - Windows NT - $perf_cur= 76 gosub "perf_info" $os_type="NT4" $perf_cur= 77 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME - $perf_cur= 78 gosub "perf_info" $os_type="ME" $perf_cur= 79 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 - $perf_cur= 80 gosub "perf_info" $os_type="W98" $perf_cur= 81 gosub "perf_info" CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 - $perf_cur= 82 gosub "perf_info" $os_type="W95" $perf_cur= 83 gosub "perf_info" CASE 1 $perf_cur= 84 gosub "perf_info" $os_type="???" ; - undetermined - $perf_cur= 85 gosub "perf_info" ENDSELECT $perf_cur= 86 gosub "perf_info" $os_type=LTRIM(RTRIM(substr($os_type+" ",1,3))) $perf_cur= 87 gosub "perf_info" ; $perf_cur= 88 gosub "perf_info" ? "os "+$os ; <--- $os_type + service pack code $perf_cur= 89 gosub "perf_info" ? "os_type "+$os_type;($begin) ; ; sat 05-may-2001 01:43:36 (kix 4.00 vs 2.23e) ; ;Informative KIXSTRIP: no errors found (input=89 output=89 skip=0). ; ;Informative KIXSTRIP: 6 block_structures found. ;Informative KIXSTRIP: no functions found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ; ;($end) :perf_report IF (RedirectOutput("") = 0) ENDIF CLS at(2,26) "Kixtart Performance Report "+@kix box(3,5,5,75,"single") $perf_column=6 DO at(4,$perf_column) " " $perf_column=$perf_column+1 UNTIL ($perf_column >= 75) box(7,5,9,75,"single") $perf_percentage=(100*$perf_cur)/$perf_stop at(6,30) substr(" ",1,3-len("$perf_percentage")) $perf_percentage " %" at(8,26) substr(" ",1,7-len("$perf_cur")) $perf_cur " .. " $perf_stop at(8,49) "total lines: " $perf_total $perf_stop_time=@time $perf_start_stime=3600*substr($perf_start_time,1,2)+60*substr($perf_start_time,4,2)+substr($perf_start_time,7,2) $perf_stop_stime=3600*substr($perf_stop_time,1,2)+60*substr($perf_stop_time,4,2)+substr($perf_stop_time,7,2) $perf_elapse_time=$perf_stop_stime - $perf_start_stime at(4,25) $perf_start_time " .. " $perf_stop_time at(4,55) "elapse: " $perf_elapse_time " sec" IF ($perf_elapse_time = 0) $perf_elapse_time=1 ENDIF at(6,49) "lines/second: " $perf_total/$perf_elapse_time at(11,0) $perf_info=" %% hits %% hits %% hits %% hits %% hits %% hits %% hits %% hits %% hits %% hits" $perf_info $perf_count1=1 DO $perf_info="" $perf_count2=1 DO $perf_hits_pos=$perf_count1+$perf_count2-1 $perf_hits_value=$perf_hits[$perf_hits_pos] $perf_info=$perf_info+substr(" ",1,3-len("$perf_hits_pos"))+$perf_hits_pos $perf_info=$perf_info+substr(" ",1,5-len("$perf_hits_value"))+$perf_hits_value $perf_count2=$perf_count2+1 UNTIL ($perf_count2 > 10) at(11+$perf_count1/10+1,0) $perf_info $perf_count1=$perf_count1+10 UNTIL ($perf_count1 > 100) at(22,0) EXIT :perf_info ; - performance - $perf_stop=89 IF ($perf_cur <= 1) $perf_count1=0 DO $perf_hits[$perf_count1]=0 $perf_count1=$perf_count1+1 UNTIL ($perf_count1 > 100) $perf_start_time=@time $perf_total=0 ENDIF $perf_percentage=(100*$perf_cur)/$perf_stop $perf_hits[$perf_percentage]=$perf_hits[$perf_percentage]+1 $perf_total=$perf_total+1 RETURN
Additional information about some parameters:
- /debug (= duration of each line)
- shows which line was executed. - shows what the time of execution is. it is possible that the time is the same. That means the script is running fast. The time value was just added to it to see which statement make your script slow. Some kixtart functions & commands can be relative slow. Kixstrip shows the usage of those commands & functions:
code:
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
This summary is added to the output file as comment.
- /performance (= only total time)
- shows how long your script was running. - shows how many lines per second were executed. - shows how much lines the script contains and how much lines were executed. Sometime the number of lines executed can be enormous. Mostly after using DO/UNTIL & WHILE/LOOP structures. - shows in terms of percentages (f.e. your scripts is 1000 lines long, 50% means the group of lines 501 till 510) which part of your script was running most. f.e. 50% runs 34 times means: in the range 501 till 510 there were 34 lines executed. exceptional cases can be traced.
- /progress (= only total time)
- /performance with an extension. - shows during the execution the progress of your script.
Any comment or question is welcome. Greetings.
|
|
Top
|
|
|
|
#50806 - 2001-07-04 12:47 AM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
Anonymous
Anonymous
Unregistered
|
Hmmm... where's all the text???  Problems converting the database!?Grtx,
|
|
Top
|
|
|
|
#50808 - 2002-07-28 10:38 PM
Re: KIXTART-TOOL: stripping kix code/reformatting kix code
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Finally we have release our first version of our documentation of kixstrip tool. You can find it as kixstrip.pdf on our site.
It is compatible with the latest kixstrip 3.20 release. A minor fix was made in latest version.
The index of it
code:
Description Goals Important remarks Important restrictions Parameters ? /Block_Check /Combine /Debug /Headers /License /Performance /Print /Progress /Show_Errors /Show_Structure /Translate /Tab Directives ;($begin) ;($debug line) ;($debug off) ;($debug on) ;($end) List of possible errors List of possible screen output (example) List of possible summary report(s) (example) FAQ Can we solve possible warnings about incomplete lines automatically? Which elements may slowdown your script? What is the performance of kixstrip? What to do when you want to reformat a 'combined script' with too much keywords on one line? What to do by problems with kixstrip? How can you get informed about new releases? What is very different with other debug capabilities? What are the general calls? Examples for compressing your KiXtart code for reformatting your KiXtart code for debugging your KiXtart code + how to debug two or more calling scripts for performance analysis of your KiXtart code for progress analysis of your KiXtart code Published versions Release notes Future/to-do activities
any comment, input or remark is welcome. greetings.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 611 anonymous users online.
|
|
|