AppSscan 7.9 - Results Viewer (FireBird Database).h2
From
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)
Example file from http://demo.testfire.net test application scan
- find the *.scan file to analyse
- and drop it on Results viewer
- the *.scan file will be unziped and an embedded FireBird instance will be started with the ResultsDB.FBD AppScan database
- to view the tables content, just click on its name:
- you can sort out the columns by clicking on its name:
- a couple more interresting tables:
- you can also drop the *.fbd file directly
Source Code
This tool is created by the following O2 script (with the code for the first version shown below)
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

















