Make creds visible to RPC and GUI.
git-svn-id: file:///home/svn/framework3/trunk@11602 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
be0169cef1
commit
067c612d9e
Binary file not shown.
|
@ -15,7 +15,7 @@
|
|||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tabbedPane" alignment="1" pref="543" max="32767" attributes="0"/>
|
||||
<Component id="tabbedPane" alignment="1" pref="530" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
|
@ -389,6 +389,33 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="credsPane">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="credsPane" noResource="true"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Creds">
|
||||
<Property name="tabTitle" type="java.lang.String" resourceKey="credsPane.TabConstraints.tabTitle"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="credsTable">
|
||||
<Properties>
|
||||
<Property name="name" type="java.lang.String" value="credsTable" noResource="true"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="credsTable.setModel(new javax.swing.table.DefaultTableModel(
 new Object [][] {

 },
 new String [] {
 "Host", "Time", "Port", "Proto", "Sname", "Type", "User", "Pass", "Active"
 }
 ) {
 public Class getColumnClass(int columnIndex) {
 return java.lang.String.class;
 }
 public boolean isCellEditable(int i,int j) {
 return false;
 }
 });"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
@ -836,7 +863,7 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="statusMessageLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="712" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="696" max="32767" attributes="0"/>
|
||||
<Component id="progressBar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="statusAnimationLabel" min="-2" max="-2" attributes="0"/>
|
||||
|
|
|
@ -544,6 +544,8 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
});
|
||||
lootsPane = new javax.swing.JScrollPane();
|
||||
lootsTable = new javax.swing.JTable();
|
||||
credsPane = new javax.swing.JScrollPane();
|
||||
credsTable = new javax.swing.JTable();
|
||||
menuBar = new javax.swing.JMenuBar();
|
||||
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
|
||||
connectRpcMenuItem = new javax.swing.JMenuItem();
|
||||
|
@ -745,6 +747,28 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
|
||||
tabbedPane.addTab(resourceMap.getString("lootsPane.TabConstraints.tabTitle"), lootsPane); // NOI18N
|
||||
|
||||
credsPane.setName("credsPane"); // NOI18N
|
||||
|
||||
credsTable.setName("credsTable"); // NOI18N
|
||||
credsTable.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
|
||||
},
|
||||
new String [] {
|
||||
"Host", "Time", "Port", "Proto", "Sname", "Type", "User", "Pass", "Active"
|
||||
}
|
||||
) {
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
return java.lang.String.class;
|
||||
}
|
||||
public boolean isCellEditable(int i,int j) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
credsPane.setViewportView(credsTable);
|
||||
|
||||
tabbedPane.addTab(resourceMap.getString("credsPane.TabConstraints.tabTitle"), credsPane); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
|
||||
mainPanel.setLayout(mainPanelLayout);
|
||||
mainPanelLayout.setHorizontalGroup(
|
||||
|
@ -753,7 +777,7 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
);
|
||||
mainPanelLayout.setVerticalGroup(
|
||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)
|
||||
.addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
menuBar.setName("menuBar"); // NOI18N
|
||||
|
@ -1136,7 +1160,7 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
.addGroup(statusPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(statusMessageLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 712, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 696, Short.MAX_VALUE)
|
||||
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(statusAnimationLabel)
|
||||
|
@ -1249,6 +1273,7 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
reAddQuery(servicesTable, 4, "services", new String[]{"host","created_at","updated_at","port","proto","state","name","info"});
|
||||
reAddQuery(vulnsTable,5,"vulns",new String[]{"port","proto","time","host","name","refs"});
|
||||
reAddQuery(notesTable,7,"notes",new String[]{"time", "host", "service", "type", "data"});
|
||||
reAddQuery(credsTable,9,"creds",new String[]{"host", "time", "port", "proto", "sname", "type", "user", "pass", "active"});
|
||||
}
|
||||
|
||||
private void refreshItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshItemActionPerformed
|
||||
|
@ -1730,6 +1755,8 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
private javax.swing.JMenuItem connectItem;
|
||||
private javax.swing.JMenuItem connectRpcMenuItem;
|
||||
private javax.swing.JMenu consoleMenu;
|
||||
private javax.swing.JScrollPane credsPane;
|
||||
private javax.swing.JTable credsTable;
|
||||
private javax.swing.JMenuItem currWorkspaceItem;
|
||||
private javax.swing.JMenu databaseMenu;
|
||||
private javax.swing.JMenuItem dbCredcollectItem;
|
||||
|
|
|
@ -92,3 +92,4 @@ currWorkspaceItem.text=Select Workspace
|
|||
addWorkspaceItem.text=Add Workspace
|
||||
delWorkspaceItem.text=Delete Workspace
|
||||
refreshConsolesItem.text=Refresh Existing
|
||||
credsPane.TabConstraints.tabTitle=Creds
|
||||
|
|
|
@ -948,7 +948,7 @@ public
|
|||
opts[:service] = @framework.db.find_or_create_service(opts)
|
||||
end
|
||||
|
||||
ret = @framework.db.report_loot(opts)
|
||||
res = @framework.db.report_loot(opts)
|
||||
return { :result => 'success' } if(res)
|
||||
end
|
||||
|
||||
|
@ -974,6 +974,39 @@ public
|
|||
end
|
||||
ret
|
||||
end
|
||||
|
||||
# requires host, port, user, pass, ptype, and active
|
||||
def report_cred(token,xopts)
|
||||
authenticate(token)
|
||||
raise ::XMLRPC::FaultException.new(404, "database not loaded") if(not db)
|
||||
opts = fixOpts(xopts)
|
||||
res = framework.db.find_or_create_cred(opts)
|
||||
return { :result => 'success' } if(res)
|
||||
{ :result => 'failed' }
|
||||
end
|
||||
#right now workspace is the only option supported
|
||||
def creds(token,xopts)
|
||||
authenticate(token)
|
||||
raise ::XMLRPC::FaultException.new(404, "database not loaded") if(not db)
|
||||
opts = fixOpts(xopts)
|
||||
wspace = workspace(opts[:workspace])
|
||||
ret = {}
|
||||
ret[:creds] = []
|
||||
@framework.db.creds(wspace).each do |c|
|
||||
cred = {}
|
||||
cred[:host] = cred.service.host.address || cred.service.host.address6 if(cred.service.host)
|
||||
cred[:time] = cred.updated_at
|
||||
cred[:port] = cred.service.port
|
||||
cred[:proto] = cred.service.proto
|
||||
cred[:sname] = cred.service.name
|
||||
cred[:type] = cred.ptype
|
||||
cred[:user] = cred.user
|
||||
cred[:pass] = cred.pass
|
||||
cred[:active] = cred.active
|
||||
ret[:creds] << cred
|
||||
end
|
||||
ret
|
||||
end
|
||||
def import_data(token,xopts)
|
||||
authenticate(token)
|
||||
raise ::XMLRPC::FaultException.new(404, "database not loaded") if(not db)
|
||||
|
|
Loading…
Reference in New Issue