Skip to content

Commit

Permalink
lots of bugfixes, see release notes for further info
Browse files Browse the repository at this point in the history
  • Loading branch information
ESIC-DA committed Mar 26, 2020
1 parent 1660c96 commit 4c5c5e2
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 51 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<property name="build.numThreads" value="1" />
<property name="src.dir" value="./src"/>
<property name="lib.dir" value="./deps/org.graphstream/lib"/>
<property name="build.version" value="AHA-GUI v0.7.0b16"/>
<property name="build.version" value="AHA-GUI v0.7.0b32"/>
<property name="CP" value="."/>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm" />
Expand Down
6 changes: 3 additions & 3 deletions src/esic/AHAController.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public void run()
{
if ( node==null || (occuredFromMouseOver && !m_gui.m_infoPnlUpdateOnMouseover.isSelected()) ) { return; } //if element is null, or triggered from mosueover and we're presently supposed to ignore that, return
m_currentlyDisplayedNode.set(node);
Object[][] infoData=node.getSidebarAttributes("aha.SidebarGeneralInfo"), intPorts=node.getSidebarAttributes("aha.SidebarInternalPorts"), extPorts=node.getSidebarAttributes("aha.SidebarExternalPorts"), connectionData={{"None",""}}, scoreReasons=null;

Object[][] infoData=node.getSidebarAttributes("aha.SidebarGeneralInfo"), intPorts=node.getSidebarAttributes("aha.SidebarInternalPorts"), extPorts=node.getSidebarAttributes("aha.SidebarExternalPorts");
Object[][] connectionData={{"None",""}}, scoreReasons=null, signData=node.getSidebarAttributes("aha.SidebarSigningInfo"), stampData=node.getSidebarAttributes("aha.SidebarTStampInfo");
try
{ //update the fourth "Connected Process Name" table. This is updated in the controller because the user can toggle IP/FQDN view at runtime, thus the names of some nodes will change
if (node.graphNode.getDegree()>0)
Expand Down Expand Up @@ -238,7 +238,7 @@ public void run()

} catch (Exception e) { e.printStackTrace(); }

final Object[][][] data={infoData,intPorts,extPorts,connectionData,scoreReasons}; // create final pointer to pass to swing.infokelater. as long as this order of these object arrays is correct, everything will work :)
final Object[][][] data={infoData,intPorts,extPorts,connectionData,scoreReasons, signData, stampData}; // create final pointer to pass to swing.infokelater. as long as this order of these object arrays is correct, everything will work :)
javax.swing.SwingUtilities.invokeLater(new Runnable() //perform task on gui thread
{
public void run()
Expand Down
14 changes: 7 additions & 7 deletions src/esic/AHAGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class AHAGUI extends JFrame
private JPanel m_topLeftOverlay=new JPanel();
private JScrollPane m_inspectorPanel=null;
private final int m_menuShortcutKey;
protected final String[][] m_infoPnlColumnHeaders={{"Info"},{"Open Internal Port", "Proto"},{"Open External Port", "Proto"},{"Connected Process", "PID"}, {"Score Metric", "Value"}}; //right now things would break if the number of these ever got changed at runtime, so made static.
private final String[][] m_infoPnlColumnTooltips={{"Info"},{"Port that is able to be connected to from other processes internally.", "Protocol in use."},{"Port that is able to be connected to from other external hosts/processes.", "Protocol in use."},{"Names of processes connected to this one", "Process Identifier"}, {"The scoring metric checked against.", "Result of the checked metric."}};
protected final String[][] m_infoPnlColumnHeaders={{"Info"},{"Open Internal Port", "Proto"},{"Open External Port", "Proto"},{"Connected Process", "PID"}, {"Score Metric", "Value"}, {"Signature", "Value"}, {"SecureTimestamp", "Value"}}; //right now things would break if the number of these ever got changed at runtime, so made static.
private final String[][] m_infoPnlColumnTooltips={{"Info"},{"Port that is able to be connected to from other processes internally.", "Protocol in use."},{"Port that is able to be connected to from other external hosts/processes.", "Protocol in use."},{"Names of processes connected to this one", "Process Identifier"}, {"The scoring metric checked against.", "Result of the checked metric."}, {"Name of certificate field", "Information extracted from signing certificate"}, {"Name of timestamp field", "Information extracted from timestamping certificate"}};
protected final JTable[] m_infoPnlTables= new JTable[m_infoPnlColumnHeaders.length]; //if you need more tables just add another column header set above
private final JLabel[] m_overlayLabels= new JLabel[4];
private final java.util.concurrent.atomic.AtomicReference<Thread> m_graphRefreshThread=new java.util.concurrent.atomic.AtomicReference<>(null);
Expand Down Expand Up @@ -51,7 +51,7 @@ public AHAGUI(AHAModel model, AHAController controller, boolean useMultiLineGrap
setPreferredSize(s_preferredTotalSize);
setMinimumSize(new java.awt.Dimension(800,600));
String title="AHA-GUI";
try { title=AHAGUI.class.getPackage().getImplementationVersion().split(" B")[0]; } catch (Exception e) {}
try { title=(AHAGUI.class.getPackage().getImplementationVersion().split(" B")[0])+" "+model.m_inputFileName; } catch (Exception e) {}
setTitle(title); //This should result in something like "AHA-GUI v0.5.6b1" being displayed

java.awt.Font boldFont=m_btmPnlSearchStatus.getFont().deriveFont(java.awt.Font.BOLD);
Expand Down Expand Up @@ -166,8 +166,8 @@ public void focusLost(java.awt.event.FocusEvent e)
ToolTipManager.sharedInstance().setInitialDelay(500);

setLayout(new java.awt.BorderLayout(1,0));
String[][][] initialData={{{"None"}},{{"None"}},{{"None"}},{{"None"}},{{"None"}},}; //digging this new 3d array literal initializer: this is a String[5][1][1] where element[i][0][0]="None".
m_inspectorPanel=AHAGUIHelpers.createTablesInScrollPane(m_infoPnlColumnHeaders, m_infoPnlColumnTooltips, initialData, m_infoPnlTables, new int[]{160,40});
String[][][] initialData={{{"None"}},{{"None"}},{{"None"}},{{"None"}},{{"None"}},{{"None"}},{{"None"}},}; //digging this new 3d array literal initializer: this is a String[5][1][1] where element[i][0][0]="None".
m_inspectorPanel=AHAGUIHelpers.createTablesInScrollPane(m_infoPnlColumnHeaders, m_infoPnlColumnTooltips, initialData, m_infoPnlTables, new int[][]{{160}, {160,40}, {160,40}, {160,40}, {160,40}, {70,90}, {70,90}});

m_topLeftOverlay.setBounds(0, 0, m_topLeftOverlay.getPreferredSize().width, m_topLeftOverlay.getPreferredSize().height);
initGraphView(model);
Expand Down Expand Up @@ -356,7 +356,7 @@ protected void showDataView(AHAModel model, AHAGUI parent) //shows the window th
{ // Find data for, create table, etc for the "Graph Data" view
AHAModel.TableDataHolder t=model.generateReport();
String[][] columTooltips= {{"Global data from the scan which took place.", "The result for this metric."},{"The name of the process.","Process ID of the process.", "User under which the process is running.", "The number of connections this process has.", "The number of ports this process has opened that external hosts/processes could connect to.", "Whether or not this process is codesigned. Code signing is recomended and allows executalbes to be authenticated as genuine.", "Address Space Layout Randomization is a recomended security feature which helps to reduce succeptability to malicious attacks.", "Data Execution Prevention is a recomended security feature which ensures that areas of memory which are writable (and could have code stored to by an attacker) are not executable.", "Control Flow Guard is a recomended security feature which helps prevent attackers from subverting normal code execution, reducing ease of attack.", "HiVA is an improved ASLR with additional etropy to further complicate any possible attacks.", "This is the score granted to the process by the 'Normal' scoring methodology which uses the MetricsTable.cfg to determine the score.","This is a beta scoring method.","This is a beta scoring method."}};
tabBar.add("Vulnerability Metrics", AHAGUIHelpers.createTablesInScrollPane(t.columnNames, columTooltips, t.tableData, new JTable[t.tableData.length], new int[]{180,40,200,86,80,50,44,44,44,44,44,44,60}) );
tabBar.add("Vulnerability Metrics", AHAGUIHelpers.createTablesInScrollPane(t.columnNames, columTooltips, t.tableData, new JTable[t.tableData.length], new int[][]{{240,800},{180,40,200,86,80,50,44,44,44,44,44,44,60},}) );
}
{ // Find data for, create table, etc for the "Listening Processes" tab
JTable[] fwTables=new JTable[2];
Expand Down Expand Up @@ -408,7 +408,7 @@ protected void showDataView(AHAModel model, AHAGUI parent) //shows the window th
dataset=model.m_extListeningProcessMap;
}
String[][] columTooltips= {{"Processes which have open ports that can only be connected to by processes on this host.", "Process ID of the process.", "The protocol of this listening port, such as TCP or UDP.", "The port number.", "The number of connections to this open port."},{"Processes which have open ports that can be connected to by remote hosts/processes.", "Process ID of the process.", "The protocol of this listening port, such as TCP or UDP.", "The port number.", "The number of connections to this open port."}};
tabBar.add("Listening Processes", AHAGUIHelpers.createTablesInScrollPane(columnHeaders,columTooltips, tableData, fwTables, new int[]{200,50,50,50}));
tabBar.add("Listening Processes", AHAGUIHelpers.createTablesInScrollPane(columnHeaders,columTooltips, tableData, fwTables, new int[][]{{200,50,50,50},}));
}
}
};
Expand Down
10 changes: 8 additions & 2 deletions src/esic/AHAGUIHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static String styleToolTipText(String s) //format all tool tip texts by m
return "<html><p style='font-style:bold;color:black;background:white;'>"+s+"</p></html>";
}

public static javax.swing.JScrollPane createTablesInScrollPane(String[][] columnHeaders, String[][] columnTooltips, Object[][][] initialData, javax.swing.JTable[] tableRefs, int[] columnWidths)
public static javax.swing.JScrollPane createTablesInScrollPane(String[][] columnHeaders, String[][] columnTooltips, Object[][][] initialData, javax.swing.JTable[] tableRefs, int[][] columnWidths)
{
javax.swing.JPanel scrollContent=new javax.swing.JPanel();
scrollContent.setLayout(new javax.swing.BoxLayout(scrollContent, javax.swing.BoxLayout.Y_AXIS));
Expand Down Expand Up @@ -293,7 +293,13 @@ public Class<?> getColumnClass(int column) //makes it so row sorters work proper
tableRefs[i].setAlignmentY(javax.swing.JTable.TOP_ALIGNMENT);
tableRefs[i].getTableHeader().setAlignmentY(javax.swing.JTable.TOP_ALIGNMENT);
tableRefs[i].setAutoCreateRowSorter(true);
for (int j=0;j<tableRefs[i].getColumnModel().getColumnCount() && j<columnWidths.length; j++) { tableRefs[i].getColumnModel().getColumn(j).setPreferredWidth(columnWidths[j]); }
int j=0;
try
{
int columWidthsToUse=i;
if (i>=columnWidths.length) { columWidthsToUse=columnWidths.length-1; System.err.println("Warning: Column widths not specified, using most recent column width specified");}
for (j=0;j<tableRefs[i].getColumnModel().getColumnCount() && j<columnWidths.length; j++) { tableRefs[i].getColumnModel().getColumn(j).setPreferredWidth(columnWidths[columWidthsToUse][j]); }
} catch (Exception e) { System.err.printf("Failed to set column widths. i=%d j=%d\n", i,j); e.printStackTrace(); }
scrollContent.add(tableRefs[i].getTableHeader());
scrollContent.add(tableRefs[i]);
}
Expand Down
Loading

0 comments on commit 4c5c5e2

Please sign in to comment.