SEARCH
TOOLBOX
LANGUAGES
modified on 28 August 2010 at 22:20 ••• 914 views

AppSscan 7.9 - Results Viewer (FireBird Database).h2

From

Jump to: navigation, search

AppSscan 7.9 - Results Viewer (FireBird Database) is a small tool to visualize the contents of an IBM AppScan 7.9 results file

Contents

Usage instructions

  • execute script
  • drag'n'drop
    • *.scan file
    • resultsDb.FDB file
    • folder with resultsDb.FDB file

Video

Screenshots

  • first screen (after compilation and execution)

Image:8_28_2010_10_41_16_PM_tmp64DE.jpg

Example file from http://demo.testfire.net test application scan

  • find the *.scan file to analyse

Image:8_28_2010_10_45_26_PM_tmp64ED.jpg

  • and drop it on Results viewer

Image:8_28_2010_10_46_16_PM_tmp64EE.jpg

  • the *.scan file will be unziped and an embedded FireBird instance will be started with the ResultsDB.FBD AppScan database

Image:8_28_2010_10_47_35_PM_tmp64EF.jpg

  • to view the tables content, just click on its name:

Image:8_28_2010_10_48_05_PM_tmp64F0.jpg

  • you can sort out the columns by clicking on its name:

Image:8_28_2010_10_48_41_PM_tmp64F1.jpg

  • a couple more interresting tables:

Image:8_28_2010_10_49_53_PM_tmp64F2.jpg

Image:8_28_2010_10_50_02_PM_tmp64F3.jpg

Image:8_28_2010_10_50_38_PM_tmp64F4.jpg

Image:8_28_2010_10_50_47_PM_tmp64F5.jpg

Image:8_28_2010_10_50_56_PM_tmp64F6.jpg

Image:8_28_2010_10_51_05_PM_tmp64F7.jpg

Image:8_28_2010_10_51_14_PM_tmp64F8.jpg

Image:8_28_2010_10_51_22_PM_tmp64F9.jpg

Image:8_28_2010_10_51_45_PM_tmp64FA.jpg

  • you can also drop the *.fbd file directly

Image:8_28_2010_10_42_20_PM_tmp64DF.jpg

Source Code

This tool is created by the following O2 script (with the code for the first version shown below)

Image:8_28_2010_10_37_10_PM_tmp64D5.jpg

var topPanel = O2Gui.open<Panel>("IBM AppScan 7.9 Scan Results Viewer (FireBird Database)", 800,400);
FbConnection fbConnection  = null;
var tableList = topPanel.add_TableList();
var treeView = tableList.insert_Left<Panel>(200)
					    .add_TreeView();
 
Action<string> openDatabaseFile = 
	(pathToDatabaseFile) =>	{								
								"Loading FireBird database: {0}".info(pathToDatabaseFile);
								try
								{
									fbConnection = new FbConnection();
									fbConnection.ConnectionString = "Database={0};ServerType=1;User=SYSDBA;Password=masterkey".format(pathToDatabaseFile);
									fbConnection.Open();
 
 
									var listAllTables = "select rdb$relation_name " + 
														"from rdb$relations " + 
														"where rdb$view_blr is null " + 
														"and (rdb$system_flag is null or rdb$system_flag = 0);";
 
									FbCommand cmd = new FbCommand(listAllTables, fbConnection);
 
									var results = cmd.ExecuteReader();
 
									//this will get all the tables in the current database
									var currentTables = new List<string>();
									foreach(DbDataRecord result in results)
										currentTables.Add(result[0].str());
 
 
									treeView.add_Nodes(currentTables)
											.selectFirst();
								}
								catch(Exception ex)
								{
									ex.log("in openDatabaseFile");
								}
							};
 
Action<string> showTableInTableList = 
	(tableName)=>{
					if(fbConnection.notNull())
					{
						tableList.clearTable();
						var sql = "select * from {0}".format(tableName);
						var tableData = new FbCommand(sql, fbConnection)	
										          .ExecuteReader();				  	
						foreach(DataRow dataRow in tableData.GetSchemaTable().Rows) 
							tableList.add_Column(dataRow.ItemArray[0].str()); 
						foreach(DbDataRecord result in tableData) 
						{
							var rowData = new List<string>();
							for(int i=0; i < result.FieldCount; i++) 
								rowData.Add(result[i].str());
							tableList.add_Row(rowData);	
						}		
						tableList.makeColumnWidthMatchCellWidth();
					};
				 };
 
Action<string> openDroppedFile = 
	(droppedFileOrFolder)=> {										
								if (droppedFileOrFolder.fileExists())
								{
									if (droppedFileOrFolder.extension().lower() == ".fdb")
									{
										openDatabaseFile(droppedFileOrFolder);
										return;
									}
									if (droppedFileOrFolder.extension().lower() == ".scan")
									{
										"Found a *.scan file, unzipping it".info();								
										droppedFileOrFolder = droppedFileOrFolder.unzip_File();
									}		
									else
										"unsupported file type: {0}".error(droppedFileOrFolder);					
								}
								if (droppedFileOrFolder.dirExists())
								{
									var fdbFile  = droppedFileOrFolder.pathCombine("RESULTSDB.FDB");
									openDatabaseFile(fdbFile);									
								}
							};
 
treeView.afterSelect<string>(showTableInTableList);	   
 
treeView.onDrop(openDroppedFile);
tableList.getListViewControl().onDrop(openDroppedFile);  
 
//using FirebirdSql.Data.FirebirdClient 
//using System.Data
//using System.Data.Common
//O2Ref:FirebirdSql.Data.FirebirdClient.dll
 
//Note:Downloaded Embedded Firebird for Windows from http://sourceforge.net/projects/firebird/files/firebird-win32/2.0.6-Release/Firebird-2.0.6.13266-0_embed_pdb.zip/download
// files from Embedded Firebird that need to be on the O2 Execution Dir
//  fbembed.dll
//  icuin30.dll
//  icuuc30.dll
//  icudt30.dll
//  ib_util.dll
MediaWiki Appliance - Powered by TurnKey Linux