Added:
/trunk/contempt-core/src/javasec/contempt/dialogs/ObjectDialog.java
/trunk/contempt-installer/bin/ContemptInstaller.jar
/trunk/contempt-installer/installer-build.xml
Deleted:
/trunk/contempt-core/src/javasec/contempt/dialogs/MethodDialog.java
Modified:
/trunk/contempt-core/META-INF/MANIFEST.MF
/trunk/contempt-core/contempt.product
/trunk/contempt-core/plugin.xml
/trunk/contempt-core/src/javasec/contempt/Application.java
/trunk/contempt-core/src/javasec/contempt/ApplicationWorkbenchWindowAdvisor.java
/trunk/contempt-core/src/javasec/contempt/data/SeedConnection.java
/trunk/contempt-core/src/javasec/contempt/data/SeedConnector.java
/trunk/contempt-core/src/javasec/contempt/dialogs/ProvisionDialog.java
/trunk/contempt-core/src/javasec/contempt/dialogs/StartSeedDialog.java
/trunk/contempt-core/src/javasec/contempt/dialogs/StringDialog.java
/trunk/contempt-core/src/javasec/contempt/views/AssetsView.java
/trunk/contempt-core/src/javasec/contempt/views/ConnectionsView.java
/trunk/contempt-core/src/javasec/contempt/views/VisualsView.java
/trunk/contempt-core/src/javasec/contempt/visuals/ChatVisual.java
/trunk/contempt-core/src/javasec/contempt/visuals/RemoteNetworkVisual.java
/trunk/contempt-core/src/javasec/contempt/visuals/TargetsVisual.java
/trunk/contempt-feature/feature.xml
/trunk/contempt-installer/src/javasec/contempt/installer/ContemptInstaller.java
=======================================
--- /dev/null
+++ /trunk/contempt-core/src/javasec/contempt/dialogs/ObjectDialog.java Sun
Oct 25 14:21:56 2009
@@ -0,0 +1,115 @@
+package javasec.contempt.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class ObjectDialog extends Dialog
+{
+ String dialogName=null;
+ String[] argumentNames=null;
+ Class[] argumentTypes=null;
+ Object[] argumentValues=null;
+
+ Text argumentText[]=null;
+ Label argumentNameLabel[]=null;
+ Label argumentTypeLabel[]=null;
+
+ public boolean aborted=true;
+
+ public ObjectDialog(Shell parent,String dn, String[] an, Class[] at)
+ {
+ super(parent);
+ dialogName=dn;
+ argumentNames=an;
+ argumentTypes=at;
+ }
+
+ public Object[] getArguments()
+ {
+ return argumentValues;
+ }
+
+ protected void okPressed()
+ {
+ aborted=false;
+
+ argumentValues=new Object[argumentTypes.length];
+
+ System.out.println("candy");
+ for(int x=0;x<argumentTypes.length;++x)
+ {
+ try
+ {
+ System.out.println("is");
+ // TODO this code only valid for strings
+ if(argumentTypes[x].getSimpleName().equals("Integer"))
+ argumentValues[x]=new Integer(argumentText[x].getText());
+ else
argumentValues[x]=argumentTypes[x].cast(argumentText[x].getText());
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ System.out.println("good");
+
+ super.okPressed();
+ }
+
+ protected Control createDialogArea(Composite parent)
+ {
+
+ Composite composite = new Composite(parent,0);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout= new GridLayout(3,false);
+ composite.setLayout(layout);
+
+ if(argumentNames==null)
+ {
+ new Label(composite,SWT.NONE).setText("arguments not properly set");
+ return composite;
+ }
+
+ // all we have now is argument names and types
+ // the dialog will grab the argument values
+ int argumentCount=argumentNames.length;
+ if(argumentCount<1)
+ {
+ // TODO verify that this actually does something
+ new Label(composite,SWT.NONE).setText("not enough arguments");
+ return composite;
+ }
+
+ argumentText=new Text[argumentCount];
+ argumentTypeLabel=new Label[argumentCount];
+ argumentNameLabel=new Label[argumentCount];
+
+ for(int x=0;x<argumentCount;++x)
+ {
+ // TODO generalize away from string
+ argumentTypeLabel[x]=new Label(composite,SWT.None);
+ argumentNameLabel[x]=new Label(composite,SWT.None);
+ argumentText[x]=new Text(composite,SWT.LEFT|SWT.BORDER);
+
+ argumentTypeLabel[x].setText(argumentTypes[x].getSimpleName());
+ argumentNameLabel[x].setText(argumentNames[x]);
+
+ argumentText[x].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ return composite;
+ }
+
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(dialogName);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/contempt-installer/bin/ContemptInstaller.jar Sun Oct 25 14:21:56
2009
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/contempt-installer/installer-build.xml Sun Oct 25 14:21:56 2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project default="create_run_jar" name="Create Runnable Jar for Project
contempt-installer">
+ <!--this file was created by Eclipse Runnable JAR Export Wizard-->
+ <!--ANT 1.7 is required -->
+ <target name="create_run_jar">
+ <jar destfile="bin/ContemptInstaller.jar"
filesetmanifest="mergewithoutmain">
+ <manifest>
+ <attribute name="Main-Class"
value="javasec.contempt.installer.ContemptInstaller"/>
+ <attribute name="Class-Path" value="."/>
+ </manifest>
+ <fileset dir="bin"/>
+ </jar>
+ </target>
+</project>
=======================================
--- /trunk/contempt-core/src/javasec/contempt/dialogs/MethodDialog.java Sun
Oct 11 04:05:40 2009
+++ /dev/null
@@ -1,120 +0,0 @@
-package javasec.contempt.dialogs;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class MethodDialog extends Dialog
-{
- String[] argumentNames=null;
- Class[] argumentTypes=null;
- Object[] argumentValues=null;
-
- Text argumentText[]=null;
- Label argumentNameLabel[]=null;
- Label argumentTypeLabel[]=null;
-
- public boolean aborted=true;
-
- public void setArgumentNames(String[] arguments)
- {
- argumentNames=arguments;
- }
- public void setArgumentTypes(Class[] arguments)
- {
- argumentTypes=arguments;
- }
-
- public Object[] getArguments()
- {
- return argumentValues;
- }
-
- protected void okPressed()
- {
- aborted=false;
-
- argumentValues=new Object[argumentTypes.length];
-
- System.out.println("candy");
- for(int x=0;x<argumentTypes.length;++x)
- {
- try
- {
- System.out.println("is");
- // TODO this code only valid for strings
- if(argumentTypes[x].getSimpleName().equals("Integer"))
- argumentValues[x]=new Integer(argumentText[x].getText());
- else
argumentValues[x]=argumentTypes[x].cast(argumentText[x].getText());
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- System.out.println("good");
-
- super.okPressed();
- }
-
- protected Control createDialogArea(Composite parent)
- {
-
- Composite composite = new Composite(parent,0);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout= new GridLayout(3,false);
- composite.setLayout(layout);
-
- if(argumentNames==null)
- {
- new Label(composite,SWT.NONE).setText("arguments not properly set");
- return composite;
- }
-
- // all we have now is argument names and types
- // the dialog will grab the argument values
- int argumentCount=argumentNames.length;
- if(argumentCount<1)
- {
- // TODO verify that this actually does something
- new Label(composite,SWT.NONE).setText("not enough arguments");
- return composite;
- }
-
- argumentText=new Text[argumentCount];
- argumentTypeLabel=new Label[argumentCount];
- argumentNameLabel=new Label[argumentCount];
-
- for(int x=0;x<argumentCount;++x)
- {
- // TODO generalize away from string
- argumentTypeLabel[x]=new Label(composite,SWT.None);
- argumentNameLabel[x]=new Label(composite,SWT.None);
- argumentText[x]=new Text(composite,SWT.LEFT);
-
- argumentTypeLabel[x].setText(argumentTypes[x].getSimpleName());
- argumentNameLabel[x].setText(argumentNames[x]);
-
- argumentText[x].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- return composite;
- }
-
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText("invoke method");
- }
-
- public MethodDialog(Shell parent)
- {
- super(parent);
- }
-}
=======================================
--- /trunk/contempt-core/META-INF/MANIFEST.MF Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/META-INF/MANIFEST.MF Sun Oct 25 14:21:56 2009
@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Contempt
+Bundle-Name: contempt-core
Bundle-SymbolicName: javasec.contempt;singleton:=true
-Bundle-Version: 0.6.0
+Bundle-Version: 0.6.0.qualifier
Bundle-Activator: javasec.contempt.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
@@ -15,3 +15,4 @@
thirdparty/core.jar,
contempt.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: javasec
=======================================
--- /trunk/contempt-core/contempt.product Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/contempt.product Sun Oct 25 14:21:56 2009
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product name="contempt.product" uid="contempt.product"
id="javasec.contempt.product" application="javasec.contempt.application"
version="0.6.0" useFeatures="true" includeLaunchers="true">
+<product name="contempt.product" uid="contempt.product"
id="javasec.contempt.product" application="javasec.contempt.application"
version="0.6.0.qualifier" useFeatures="true" includeLaunchers="true">
<aboutInfo>
<text>
@@ -30,11 +30,9 @@
</win>
</launcher>
-
<vm>
</vm>
-
<plugins>
<plugin id="com.ibm.icu"/>
<plugin id="contempt-core" fragment=""/>
=======================================
--- /trunk/contempt-core/plugin.xml Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/plugin.xml Sun Oct 25 14:21:56 2009
@@ -14,7 +14,7 @@
<extension
point="org.eclipse.ui.perspectives">
<perspective
- name="Perspective"
+ name="default contempt perspective"
class="javasec.contempt.Perspective"
id="javasec.contempt.perspective">
</perspective>
@@ -124,29 +124,6 @@
</config>
</extension>
<extension
- point="org.eclipse.ui.intro">
- <intro
- class="org.eclipse.ui.intro.config.CustomizableIntroPart"
- id="javasec.contempt.intro"/>
- <introProductBinding
- introId="javasec.contempt.intro"
- productId="javasec.contempt.product"/>
- <intro
- class="org.eclipse.ui.intro.config.CustomizableIntroPart"
- id="javasec.contempt.application"/>
- <introProductBinding
- introId="javasec.contempt.application"
- productId="javasec.contempt.product"/>
- <intro
- class="org.eclipse.ui.intro.config.CustomizableIntroPart"
- id="javasec.contempt.contempt">
- </intro>
- <introProductBinding
- introId="javasec.contempt.contempt"
- productId="javasec.contempt.product">
- </introProductBinding>
- </extension>
- <extension
id="product"
point="org.eclipse.core.runtime.products">
<product
=======================================
--- /trunk/contempt-core/src/javasec/contempt/Application.java Sun Oct 11
04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/Application.java Sun Oct 25
14:21:56 2009
@@ -1,7 +1,5 @@
package javasec.contempt;
-import java.io.File;
-
import javasec.contempt.data.SeedConnector;
import org.eclipse.equinox.app.IApplication;
@@ -11,16 +9,11 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.WorkbenchAdvisor;
-
/**
* This class controls all aspects of the application's execution
*/
public class Application implements IApplication
{
-
- /* (non-Javadoc)
- * @see
org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
- */
public Object start(IApplicationContext context) throws Exception
{
Display display = PlatformUI.createDisplay();
@@ -39,13 +32,9 @@
finally
{
display.dispose();
- }
-
+ }
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.app.IApplication#stop()
- */
public void stop()
{
final IWorkbench workbench = PlatformUI.getWorkbench();
=======================================
---
/trunk/contempt-core/src/javasec/contempt/ApplicationWorkbenchWindowAdvisor.java
Sun Oct 11 04:05:40 2009
+++
/trunk/contempt-core/src/javasec/contempt/ApplicationWorkbenchWindowAdvisor.java
Sun Oct 25 14:21:56 2009
@@ -50,7 +50,7 @@
{
final Shell shell = getWindowConfigurer().getWindow().getShell();
Display display=shell.getDisplay();
- Image image =
AbstractUIPlugin.imageDescriptorFromPlugin("contempt-core","icons/contempt-tray-green.gif").createImage();
+ Image image =
AbstractUIPlugin.imageDescriptorFromPlugin("javasec.contempt","icons/contempt-tray-green.gif").createImage();
Tray tray = display.getSystemTray();
if(tray != null)
{
=======================================
--- /trunk/contempt-core/src/javasec/contempt/data/SeedConnection.java Sun
Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/data/SeedConnection.java Sun
Oct 25 14:21:56 2009
@@ -19,6 +19,7 @@
*/
+
import java.io.File;
import java.io.InputStream;
@@ -100,8 +101,8 @@
public Display display=Display.getCurrent();
// variable to be set when the connection is loaded
- public String serverName;
- public String hostname;
+ public String name;
+ public String location;
public Registry rmiRegistry=null;
public ManagerSeedInterface managerSeed=null;
@@ -115,10 +116,10 @@
public SeedServerNode widget;
- public SeedConnection(String name, String host)
- {
- serverName=name;
- hostname=host;
+ public SeedConnection(String newName, String newLocation)
+ {
+ name=newName;
+ location=newLocation;
connected=false;
try
@@ -148,12 +149,17 @@
// get the notifications from the seed server
notifications=managerSeed.getNotifications(notificationID);
-
+ //System.out.println(name+" ding!");
+
// distribute the notifcations to the UI
for(SeedNotification n:notifications)
notifier.notifyClient(n.key,n.data);
}
- else Thread.sleep(1000);
+ else
+ {
+ Thread.sleep(1000);
+ //System.out.println(name+" dong!");
+ }
}
catch(Exception e)
{
@@ -195,13 +201,13 @@
try
{
- rmiRegistry=LocateRegistry.getRegistry(hostname,41414,csf);
+ rmiRegistry=LocateRegistry.getRegistry(location,41414,csf);
managerSeed=(ManagerSeedInterface)rmiRegistry.lookup("ManagerSeed");
dataSeed=(DataSeedInterface)rmiRegistry.lookup("DataSeed");
}
catch(Exception e)
{
- if(hostname.equals("127.0.0.1")) // could not connect to localhost
+ if(location.equals("127.0.0.1")) // could not connect to localhost
{
// give the user a chance to launch a seed on localhost
try
@@ -211,7 +217,7 @@
if(dialog.aborted)return false;
// these seem not to be set properly
- rmiRegistry=LocateRegistry.getRegistry(hostname,41414,csf);
+ rmiRegistry=LocateRegistry.getRegistry(location,41414,csf);
managerSeed=(ManagerSeedInterface)rmiRegistry.lookup("ManagerSeed");
dataSeed=(DataSeedInterface)rmiRegistry.lookup("DataSeed");
}
@@ -232,7 +238,7 @@
MessageDialog.openError(
SeedConnector.window.getShell(),
"connection error",
- "could not connect to "+hostname+"\n"+e);
+ "could not connect to "+location+"\n"+e);
e.printStackTrace();
connected=false;
return false;
=======================================
--- /trunk/contempt-core/src/javasec/contempt/data/SeedConnector.java Sun
Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/data/SeedConnector.java Sun
Oct 25 14:21:56 2009
@@ -10,7 +10,7 @@
* SeedConnection[] getConnections() // pull a list of connections from
the database
* String[] getConnected() // get a list of names of connected servers
*
- * newConnection(hostname)
+ * newConnection(name, location)
*
*
*/
@@ -119,8 +119,7 @@
// start up the database driver
Class.forName("org.sqlite.JDBC");
- contemptDB=DriverManager.getConnection(
-
"jdbc:sqlite:"+SeedConnector.contemptPath+File.separator+"contempt.db");
+
SeedConnector.contemptDB=DriverManager.getConnection("jdbc:sqlite:"+SeedConnector.contemptPath+File.separator+"contempt.db");
}
// query the database for connections, and populate the connection list
@@ -156,9 +155,9 @@
return null;
}
- public static SeedConnection newConnection(String hostname)
- {
- System.out.println("new connection "+hostname);
+ public static SeedConnection newConnection(String name, String location)
+ {
+ System.out.println("new connection "+name+" "+location);
String trustStorePath=System.getProperty("javax.net.ssl.trustStore");
KeyStore trustStore=null;
@@ -192,7 +191,7 @@
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
final SSLSocketFactory ssf=sc.getSocketFactory();
- SSLSocket insecureSocket=(SSLSocket)ssf.createSocket(hostname,41414);
+ SSLSocket insecureSocket=(SSLSocket)ssf.createSocket(location,41414);
HandshakeCompletedListener hsl=new HandshakeCompletedListener()
{
@@ -249,18 +248,17 @@
}
};
- /*
- Registry
rmiRegistry=LocateRegistry.getRegistry(hostname,41414,insecureCSF);
- ManagerSeedInterface
managerSeed=(ManagerSeedInterface)rmiRegistry.lookup("ManagerSeed");
- String serverName=managerSeed.getName();
- */
- String serverName="remoteTest";
+ //Registry
rmiRegistry=LocateRegistry.getRegistry(hostname,41414,insecureCSF);
+ //ManagerSeedInterface
managerSeed=(ManagerSeedInterface)rmiRegistry.lookup("ManagerSeed");
+ //String serverName=hostname; //managerSeed.getName();
+
+ //String serverName="remoteTest";
// pop up the accept/deny dialog
boolean acceptKey=MessageDialog.openQuestion(
SeedConnector.window.getShell(),
"verify fingerprint",
- "The SHA1 fingerprint of "+serverName+" at "+hostname+" is\n"+
+ "The SHA1 fingerprint of "+name+" is\n"+
fingerprintString+"\naccept this fingerprint as trusted?");
// add the cert to the truststore
@@ -268,20 +266,18 @@
{
trustStore=KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(new
FileInputStream(trustStorePath),SeedConnector.globalPass.toCharArray());
- trustStore.setCertificateEntry(serverName,cert);
+ trustStore.setCertificateEntry(name,cert);
trustStore.store(new
FileOutputStream(trustStorePath),SeedConnector.globalPass.toCharArray());
}
- Class.forName("org.sqlite.JDBC");
- SeedConnector.contemptDB =
DriverManager.getConnection("jdbc:sqlite:contempt.db");
Connection conn=SeedConnector.contemptDB;
PreparedStatement ps = conn.prepareStatement("insert into connections
values (?, ?);");
-
- ps.setString(1,serverName);
- ps.setString(2,hostname);
+
+ ps.setString(1,name);
+ ps.setString(2,location);
ps.execute();
- SeedConnection connection=new SeedConnection(serverName,hostname);
+ SeedConnection connection=new SeedConnection(name,location);
//connections.put(serverName,connection);
return connection;
}
@@ -296,4 +292,43 @@
return null;
}
}
-}
+
+ public static void removeConnection(SeedConnection seedConnection)
+ {
+ Connection conn=SeedConnector.contemptDB;
+
+ try
+ {
+ PreparedStatement ps = conn.prepareStatement("delete from connections
where name=?;");
+
+ ps.setString(1,seedConnection.name);
+ ps.execute();
+
+ SeedConnector.connections.remove(seedConnection);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static void renameConnection(SeedConnection seedConnection, String
newName)
+ {
+ Connection conn=SeedConnector.contemptDB;
+
+ try
+ {
+ PreparedStatement ps = conn.prepareStatement("update connections SET
name=? WHERE location=?;");
+
+ ps.setString(1,newName);
+ ps.setString(2,seedConnection.location);
+ ps.execute();
+
+ seedConnection.name=newName;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
=======================================
--- /trunk/contempt-core/src/javasec/contempt/dialogs/ProvisionDialog.java
Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/dialogs/ProvisionDialog.java
Sun Oct 25 14:21:56 2009
@@ -18,8 +18,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -29,6 +29,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.osgi.framework.Bundle;
import sun.security.x509.CertAndKeyGen;
import sun.security.x509.X500Name;
@@ -122,8 +123,8 @@
// generate a blank friend store
KeyStore
friendsKeyStore=KeyStore.getInstance(KeyStore.getDefaultType());
- keyStore.load(null,SeedConnector.globalPass.toCharArray());
- keyStore.store(new
FileOutputStream(homedirPath+File.separator+"contempt-friends.key"),SeedConnector.globalPass.toCharArray());
+ friendsKeyStore.load(null,SeedConnector.globalPass.toCharArray());
+ friendsKeyStore.store(new
FileOutputStream(homedirPath+File.separator+"contempt-friends.key"),SeedConnector.globalPass.toCharArray());
// create the local database
Class.forName("org.sqlite.JDBC");
@@ -148,11 +149,14 @@
// Place the default seeds in their proper location
try
{
+ // get a handle on the seed plugin to fetch default seeds
+ Bundle seedBundle=Platform.getBundle("javasec.seed");
+
// place SeedServer.jar
File serverFile=new
File(SeedConnector.contemptPath+File.separator+"SeedServer.jar");
if(!serverFile.exists())
{
- InputStream
inputStream=FileLocator.openStream(Activator.getDefault().getBundle(),new
Path("bin/SeedServer.jar"),false);
+ InputStream inputStream=FileLocator.openStream(seedBundle,new
Path("seeds/SeedServer.jar"),false);
int len;
byte[] buf=new byte[1024];
@@ -173,12 +177,12 @@
contemptSeedsDir.mkdir();
File teamSeedFile=new
File(SeedConnector.contemptPath+File.separator+"seeds"+File.separator+"TeamSeed.jar");
-
inputStream=FileLocator.openStream(Activator.getDefault().getBundle(),new
Path("bin/TeamSeed.jar"),false);
+ inputStream=FileLocator.openStream(seedBundle,new
Path("seeds/TeamSeed.jar"),false);
fos=new FileOutputStream(teamSeedFile);
while(-1!=(len=inputStream.read(buf)))fos.write(buf,0,len);
File nmapSeedFile=new
File(SeedConnector.contemptPath+File.separator+"seeds"+File.separator+"NmapSeed.jar");
-
inputStream=FileLocator.openStream(Activator.getDefault().getBundle(),new
Path("bin/NmapSeed.jar"),false);
+ inputStream=FileLocator.openStream(seedBundle,new
Path("seeds/NmapSeed.jar"),false);
fos=new FileOutputStream(nmapSeedFile);
while(-1!=(len=inputStream.read(buf)))fos.write(buf,0,len);
}
@@ -195,12 +199,12 @@
seedsDir.mkdir();
File teamSeedFile=new
File(seedsDir.getPath()+File.separator+"TeamSeed.jar");
-
inputStream=FileLocator.openStream(Activator.getDefault().getBundle(),new
Path("bin/TeamSeed.jar"),false);
+ inputStream=FileLocator.openStream(seedBundle,new
Path("seeds/TeamSeed.jar"),false);
fos=new FileOutputStream(teamSeedFile);
while(-1!=(len=inputStream.read(buf)))fos.write(buf,0,len);
File nmapSeedFile=new
File(seedsDir.getPath()+File.separator+"NmapSeed.jar");
-
inputStream=FileLocator.openStream(Activator.getDefault().getBundle(),new
Path("bin/NmapSeed.jar"),false);
+ inputStream=FileLocator.openStream(seedBundle,new
Path("seeds/NmapSeed.jar"),false);
fos=new FileOutputStream(nmapSeedFile);
while(-1!=(len=inputStream.read(buf)))fos.write(buf,0,len);
}
@@ -224,7 +228,6 @@
introLabel.setText("Welcome to contempt.\n" +
"Private keys will be generated for you\nand the server you will be
running locally.\n" +
"The keystores are protected by the\npassphrase below.");
- //introLabel.setText("hi");
introLabel.pack();
Composite composite = new Composite(parent,0);
=======================================
--- /trunk/contempt-core/src/javasec/contempt/dialogs/StartSeedDialog.java
Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/dialogs/StartSeedDialog.java
Sun Oct 25 14:21:56 2009
@@ -63,7 +63,7 @@
runAsRoot=rootCheckbox.getSelection();
runLocalhost=localhostCheckbox.getSelection();
- File seedServerFile=new File("SeedServer.jar");
+ File seedServerFile=new
File(SeedConnector.contemptPath+File.separator+"SeedServer.jar");
if(!seedServerFile.exists())
{
@@ -81,13 +81,13 @@
try
{
String[] cmd=null;
- if(!runAsRoot&&runLocalhost)cmd=new String[]
{"java","-jar",seedServerFile.getPath(),SeedConnector.globalPass,"127.0.0.1"};
- if(!runAsRoot&&!runLocalhost)cmd=new String[]
{"java","-jar",seedServerFile.getPath(),SeedConnector.globalPass};
- if(runAsRoot&&runLocalhost)cmd=new String[]
{"gksu","--preserve-env","java
-jar "+seedServerFile.getPath()+" "+SeedConnector.globalPass+" 127.0.0.1"};
- if(runAsRoot&&!runLocalhost)cmd=new String[]
{"gksu","--preserve-env","java
-jar "+seedServerFile.getPath()+" "+SeedConnector.globalPass};
+ if(!runAsRoot&&runLocalhost)cmd=new String[]
{"java","-jar",seedServerFile.getPath(),"-p",SeedConnector.globalPass,"-b","127.0.0.1"};
+ if(!runAsRoot&&!runLocalhost)cmd=new String[]
{"java","-jar",seedServerFile.getPath(),"-p",SeedConnector.globalPass};
+ if(runAsRoot&&runLocalhost)cmd=new String[] {"gksu","java
-jar "+seedServerFile.getPath()+" -p "+SeedConnector.globalPass+" -b
127.0.0.1 -h "+System.getProperty("user.home")+File.separator+".seed"};
+ if(runAsRoot&&!runLocalhost)cmd=new String[] {"gksu","java
-jar "+seedServerFile.getPath()+" -p "+SeedConnector.globalPass+"
-h "+System.getProperty("user.home")+File.separator+".seed"};
seedProcess=Runtime.getRuntime().exec(cmd);
- Thread.sleep(1500);
+ Thread.sleep(2600);
}
catch(Exception e)
{
@@ -130,7 +130,7 @@
rootCheckbox=new Button(composite3,SWT.CHECK);
rootCheckbox.setText("run as root");
- rootCheckbox.setEnabled(false);
+ //rootCheckbox.setEnabled(false);
localhostCheckbox=new Button(composite3,SWT.CHECK);
localhostCheckbox.setText("localhost only");
=======================================
--- /trunk/contempt-core/src/javasec/contempt/dialogs/StringDialog.java Sun
Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/dialogs/StringDialog.java Sun
Oct 25 14:21:56 2009
@@ -12,30 +12,36 @@
public class StringDialog extends Dialog
{
- String stringValue=null;
- String prompt="";
String windowName="";
- Text stringText=null;
+
+ String[] stringValues=null;
+ String[] promptArray;
+ Text[] stringText;
public boolean aborted=true;
- public StringDialog(Shell parent,String wName,String p)
+ public StringDialog(Shell parent,String wName,String[] pArray)
{
super(parent);
- prompt=p;
+ promptArray=pArray;
windowName=wName;
}
- public String getString()
- {
- return stringValue;
+ public String[] getValues()
+ {
+ return stringValues;
}
protected void okPressed()
{
aborted=false;
-
- stringValue=stringText.getText();
+ stringValues=new String[promptArray.length];
+
+ for(int x=0;x<promptArray.length;++x)
+ {
+ stringValues[x]=stringText[x].getText();
+ }
+
super.okPressed();
}
@@ -46,13 +52,17 @@
composite.setLayout(new GridLayout(2,false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label stringLabel=new Label(composite,SWT.None);
- stringLabel.setText(prompt);
- stringLabel.pack();
-
- stringText=new Text(composite,SWT.LEFT);
- stringText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+ stringText=new Text[promptArray.length];
+ for(int x=0;x<promptArray.length;++x)
+ {
+ Label stringLabel=new Label(composite,SWT.None);
+ stringLabel.setText(promptArray[x]);
+ stringLabel.pack();
+
+ stringText[x]=new Text(composite,SWT.LEFT|SWT.BORDER);
+ stringText[x].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
return composite;
}
=======================================
--- /trunk/contempt-core/src/javasec/contempt/views/AssetsView.java Sun Oct
11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/views/AssetsView.java Sun Oct
25 14:21:56 2009
@@ -1,14 +1,11 @@
package javasec.contempt.views;
-import java.rmi.AccessException;
-import java.rmi.NotBoundException;
import java.rmi.RemoteException;
-import java.util.Vector;
import javasec.contempt.data.SeedConnection;
import javasec.contempt.data.SeedConnector;
-import javasec.contempt.views.ConnectionsView.SeedServerNode;
import javasec.contempt.visuals.VisualInput;
+
import javasec.seed.DataSeedInterface;
import org.eclipse.swt.widgets.Combo;
@@ -21,7 +18,6 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.*;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.SWT;
@@ -31,18 +27,10 @@
{
private TableViewer viewer;
private Action doubleClickAction;
- private SeedConnection
selectedConnection=SeedConnector.getConnections()[0];
-
- /*
- * The content provider class is responsible for
- * providing objects to the view. It can wrap
- * existing objects in adapters or simply return
- * objects as-is. These objects may be sensitive
- * to the current input of the view, or ignore
- * it and always show the same content
- * (like Task List, for example).
- */
-
+ private SeedConnection selectedConnection=null;
+ public DataSeedInterface dataSeed=null;
+ public String[] tables=null;
+
class ViewContentProvider implements IStructuredContentProvider
{
public void inputChanged(Viewer v, Object oldInput, Object newInput)
@@ -52,19 +40,8 @@
{
}
public Object[] getElements(Object parent)
- {
- DataSeedInterface dataSeed=selectedConnection.dataSeed;
- String[] tables=null;
-
- try
- {
- tables=dataSeed.getTables();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
-
+ {
+ if(tables==null)return new String[]{"not connected"};
return tables;
}
}
@@ -110,28 +87,52 @@
Combo seedSelector = new Combo(composite, SWT.DROP_DOWN|SWT.READ_ONLY);
for(SeedConnection connection:SeedConnector.connections)
{
- seedSelector.add(connection.serverName);
+ seedSelector.add(connection.name);
}
seedSelector.select(0);
seedSelector.setText("seed server");
seedSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
seedSelector.addSelectionListener(new SelectionListener()
{
- public void widgetSelected(SelectionEvent e)
+ public void widgetSelected(SelectionEvent event)
{
String serverName=null;
- Object source=e.getSource();
+ Object source=event.getSource();
if(source instanceof Combo)
serverName=((Combo)source).getText();
else return;
System.out.println("server name is "+serverName);
for(SeedConnection connection:SeedConnector.connections)
{
- if(connection.serverName.equals(serverName))
+ if(connection.name.equals(serverName))
{
System.out.println("setting server to "+serverName);
selectedConnection=connection;
- break;
+
+ if(!selectedConnection.connected)
+ {
+ tables=null;
+ viewer.refresh();
+ return;
+ }
+
+ dataSeed=selectedConnection.dataSeed;
+
+ try
+ {
+ tables=dataSeed.getTables();
+ }
+ catch(RemoteException e)
+ {
+ tables=null;
+ viewer.refresh();
+
+ e.printStackTrace();
+ return;
+ }
+
+ viewer.refresh();
+ return;
}
}
}
@@ -154,6 +155,23 @@
hookContextMenu();
hookDoubleClickAction();
contributeToActionBars();
+
+ // select the default connection
+ selectedConnection=SeedConnector.getConnections()[0];
+ dataSeed=selectedConnection.dataSeed;
+
+ if(!selectedConnection.connected)return;
+ try
+ {
+ tables=dataSeed.getTables();
+ }
+ catch(RemoteException e)
+ {
+ tables=null;
+ return;
+ }
+
+ viewer.refresh();
}
private void hookContextMenu()
@@ -198,8 +216,6 @@
{
ISelection selection=viewer.getSelection();
Object object=((IStructuredSelection)selection).getFirstElement();
-
- System.out.println("ninja");
}
};
*/
@@ -223,6 +239,9 @@
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection)selection).getFirstElement();
+ // don't open up an editor if the "not connected" object is selected
+ if(obj.toString().equals("not connected"))return;
+
IWorkbenchPage page=
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
VisualInput input=new VisualInput(obj.toString(),selectedConnection);
=======================================
--- /trunk/contempt-core/src/javasec/contempt/views/ConnectionsView.java
Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/views/ConnectionsView.java
Sun Oct 25 14:21:56 2009
@@ -1,7 +1,9 @@
package javasec.contempt.views;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.InputStream;
import java.io.FileInputStream;
import java.lang.Class;
@@ -11,13 +13,15 @@
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashMap;
import javasec.contempt.data.SeedConnection;
import javasec.contempt.data.SeedConnector;
import javasec.contempt.dialogs.KeyImportDialog;
import javasec.contempt.dialogs.KeyWindow;
-import javasec.contempt.dialogs.MethodDialog;
+import javasec.contempt.dialogs.ObjectDialog;
import javasec.contempt.dialogs.StringDialog;
+import javasec.seed.ManagerSeedInterface;
import javasec.seed.SeedInterface;
import javasec.seed.SeedMethod;
@@ -34,14 +38,18 @@
import org.eclipse.ui.*;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.SWT;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IAdaptable;
-
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
public class ConnectionsView extends ViewPart
{
private TreeViewer viewer;
private Action doubleClickAction;
+ public static TreeParent invisibleRoot; // the root of the tree
// basic tree code to be used with MethodNode
class TreeObject implements IAdaptable
@@ -103,15 +111,15 @@
}
public TreeObject [] getChildren()
{
- return (TreeObject [])children.toArray(new TreeObject[children.size()]);
+ return children.toArray(new TreeObject[children.size()]);
}
public boolean hasChildren()
{
return children.size()>0;
}
}
-
- class MethodNode extends TreeObject
+
+class MethodNode extends TreeObject
{
SeedMethod method=null;
String methodName=null;
@@ -150,15 +158,13 @@
public void execute()
{
Object result=null;
- MethodDialog methodDialog=new MethodDialog(null);
if(argumentNames.length>0)
{
- methodDialog.setArgumentTypes(method.getParameterTypes());
- methodDialog.setArgumentNames(argumentNames);
- methodDialog.open();
- if(methodDialog.aborted)return;
- arguments=methodDialog.getArguments();
+ ObjectDialog objectDialog=new ObjectDialog(null,"invoke
method",argumentNames,method.getParameterTypes());
+ objectDialog.open();
+ if(objectDialog.aborted)return;
+ arguments=objectDialog.getArguments();
}
try
@@ -189,6 +195,55 @@
}
}
}
+
+ class PropertyNode extends TreeObject
+ {
+ String name=null;
+ Object value=null;
+ SeedInterface seed=null;
+
+ public PropertyNode(String n, Object v)
+ {
+ super(n);
+
+ name=n;
+ if(v==null)v="null";
+ value=v.toString();;
+ this.setName(name+": "+value);
+ }
+
+ public boolean setProperty(Object v)
+ {
+ value=v;
+
+ // seed cannot be set in the contructor because the PropertyNode
+ // does not yet have a parent when it is first instantiated
+ if(seed==null)
+ {
+ SeedNode seedNode=null;
+ TreeParent tp=this.getParent();
+ if(tp instanceof SeedNode)seedNode=(SeedNode)tp;
+ seed=seedNode.seed;
+ }
+
+ try
+ {
+ seed.setProperty(name,value);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return false;
+ }
+
+ // change the name in the UI and refresh the viewer
+ this.setName(name+": "+value);
+ viewer.refresh();
+
+ return true;
+ }
+ }
+
public class SeedServerNode extends TreeParent
{
@@ -197,13 +252,12 @@
public SeedServerNode(SeedConnection connection)
{
- super(connection.serverName+" ("+connection.hostname+")");
+ super(connection.name+" ("+connection.location+")");
seedConnection=connection;
seedConnection.widget=this; // allow the connection to refrence back
// connect to the local server by default
- if(seedConnection.hostname.equals("127.0.0.1"))seedConnection.connect();
- else System.out.println("OH EMM GEE");
+ if(seedConnection.location.equals("127.0.0.1"))seedConnection.connect();
if(seedConnection.connected && seedConnection.rmiRegistry!=null)
{
@@ -299,10 +353,27 @@
if(seedConnection==null)return;
active=true;
- // list out the methods for this seed
+ // list the properties for this seed
try
{
seed=(SeedInterface)seedConnection.rmiRegistry.lookup(name);
+ HashMap<String,Object> properties=seed.getProperties();
+
+ for(String key:properties.keySet())
+ {
+ PropertyNode propertyNode=new PropertyNode(key,properties.get(key));
+ this.addChild(propertyNode);
+ }
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ return;
+ }
+
+ // list the methods for this seed
+ try
+ {
methods=seed.getMethods();
}
catch(Exception e)
@@ -313,8 +384,8 @@
for(int x=0;x<methods.length;++x)
{
- MethodNode methodLeaf=new MethodNode(methods[x]);
- addChild(methodLeaf);
+ MethodNode methodNode=new MethodNode(methods[x]);
+ this.addChild(methodNode);
}
}
}
@@ -364,10 +435,12 @@
return ((TreeParent)parent).hasChildren();
return false;
}
-
+
private void initialize() // recursively build the hierarchy
{
invisibleRoot = new TreeParent("");
+ ConnectionsView.invisibleRoot=invisibleRoot;
+
if(SeedConnector.getConnections()!=null)
{
System.out.println("found some connections in the db");
@@ -376,7 +449,7 @@
{
for(SeedConnection seedConnection:SeedConnector.getConnections())
{
- System.out.println("adding "+seedConnection.serverName);
+ System.out.println("adding "+seedConnection.name);
invisibleRoot.addChild(new SeedServerNode(seedConnection));
}
}
@@ -662,12 +735,58 @@
{
// prompt for the location of the server
- StringDialog dialog=new StringDialog(null,"enter
hostnane","hostname: ");
+ StringDialog dialog=new StringDialog(null,"new connection",new
String[]{"name ","location "});
dialog.open();
if(dialog.aborted)return;
- String hostname=dialog.getString();
-
- SeedConnector.newConnection(hostname);
+ String name=dialog.getValues()[0];
+ String location=dialog.getValues()[1];
+
+ SeedConnection newConnection=null;
+ newConnection=SeedConnector.newConnection(name,location);
+ invisibleRoot=new SeedServerNode(newConnection);
+ viewer.refresh();
+ }
+ };
+
+ final Action removeConnectionAction=new Action("remove connection")
+ {
+ public void run()
+ {
+ ISelection selection=viewer.getSelection();
+ Object object=((IStructuredSelection)selection).getFirstElement();
+
+ if(object instanceof SeedServerNode)
+ {
+ SeedServerNode server=(SeedServerNode)object;
+
+ if(server.connected)server.disconnect();
+ SeedConnector.removeConnection(server.seedConnection);
+ server.getParent().removeChild(server);
+ viewer.refresh();
+ }
+ }
+ };
+
+ final Action renameConnectionAction=new Action("rename connection")
+ {
+ public void run()
+ {
+ ISelection selection=viewer.getSelection();
+ Object object=((IStructuredSelection)selection).getFirstElement();
+
+ if(object instanceof SeedServerNode)
+ {
+ SeedServerNode server=(SeedServerNode)object;
+
+ StringDialog dialog=new StringDialog(null,"rename connection",new
String[]{"new name: "});
+ dialog.open();
+ if(dialog.aborted)return;
+ String newName=dialog.getValues()[0];
+
+ SeedConnector.renameConnection(server.seedConnection,newName);
+ server.setName(newName+" ("+server.seedConnection.location+")");
+ viewer.refresh();
+ }
}
};
@@ -776,23 +895,53 @@
menuMgr.add(connectAction);
menuMgr.add(disconnectAction);
+ final SeedServerNode seedServerNode=(SeedServerNode)object;
MenuManager loadSeedMenu=new MenuManager("load seed");
File seedDir=new
File(SeedConnector.contemptPath+File.separator+"seeds");
- for(String seedName:seedDir.list())
- {
+ final Bundle seedBundle=Platform.getBundle("javasec.seed");
+
+ Enumeration<String> paths=seedBundle.getEntryPaths("/seeds");
+ while(paths.hasMoreElements())
+ {
+ final String path=paths.nextElement();
+ final String seedName=path.split("/")[1].split("\\.")[0];
+ if(seedName.equals("SeedServer"))continue;
loadSeedMenu.add(new Action(seedName)
{
- public void run()
- {
- }
- });
- }
+ public void run() // read seed out of seed-core plugin, and load
over the network
+ {
+ int len;
+ byte[] buf=new byte[1024];
+ InputStream inStream=null;
+ ByteArrayOutputStream outStream=new ByteArrayOutputStream();
+
+ try
+ {
+ // get a handle on the seed file
+ inStream=FileLocator.openStream(seedBundle,new Path(path),false);
+
+ // read the file into a byte buffer
+ while(-1!=(len=inStream.read(buf)))outStream.write(buf,0,len);
+
+ // write the byte buffer to the network
+
seedServerNode.seedConnection.managerSeed.loadSeed(seedName,outStream.toByteArray());
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
loadSeedMenu.add(new Separator());
loadSeedMenu.add(loadSeedAction); // external load action
menuMgr.add(loadSeedMenu);
menuMgr.add(new Separator());
+ menuMgr.add(renameConnectionAction);
+ menuMgr.add(removeConnectionAction);
menuMgr.add(shutdownAction);
}
else if(object instanceof SeedNode)
@@ -850,6 +999,22 @@
{
((MethodNode) selected).execute();
}
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else if(selected instanceof PropertyNode)
+ {
+ try
+ {
+ PropertyNode propertyNode=(PropertyNode)selected;
+ ObjectDialog propertyDialog=new ObjectDialog(null,"set property",new
String[]{propertyNode.name},new Class[]{propertyNode.value.getClass()});
+ propertyDialog.open();
+ if(propertyDialog.aborted)return;
+ Object value=propertyDialog.getArguments()[0];
+ propertyNode.setProperty(value);
+ }
catch(Exception e)
{
e.printStackTrace();
@@ -857,7 +1022,7 @@
}
else
{
- //showMessage("I don't know WHAT you were clicking on..");
+ //showMessage("I don't know what you were clicking on..");
}
}
};
=======================================
--- /trunk/contempt-core/src/javasec/contempt/views/VisualsView.java Sun
Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/views/VisualsView.java Sun
Oct 25 14:21:56 2009
@@ -93,7 +93,7 @@
Combo seedSelector = new Combo(composite, SWT.DROP_DOWN|SWT.READ_ONLY);
for(SeedConnection connection:SeedConnector.connections)
{
- seedSelector.add(connection.serverName);
+ seedSelector.add(connection.name);
}
seedSelector.select(0);
seedSelector.setText("seed server");
@@ -110,7 +110,7 @@
System.out.println("server name is "+serverName);
for(SeedConnection connection:SeedConnector.connections)
{
- if(connection.serverName.equals(serverName))
+ if(connection.name.equals(serverName))
{
System.out.println("setting server to "+serverName);
selectedConnection=connection;
=======================================
--- /trunk/contempt-core/src/javasec/contempt/visuals/ChatVisual.java Sun
Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/visuals/ChatVisual.java Sun
Oct 25 14:21:56 2009
@@ -74,7 +74,7 @@
setInput(input);
seedConnection=((VisualInput)input).seedConnection;
- setPartName(seedConnection.serverName+" chat");
+ setPartName(seedConnection.name+" chat");
}
public boolean isDirty()
@@ -147,12 +147,12 @@
public void widgetSelected(SelectionEvent e)
{
- StringDialog dialog=new StringDialog(null,"set nick","nick");
+ StringDialog dialog=new StringDialog(null,"set nick",new
String[]{"nick"});
dialog.open();
if(dialog.aborted)return; // if user clicks cancel, quit
- nick=dialog.getString();
- nickButton.setText(dialog.getString());
+ nick=dialog.getValues()[0];
+ nickButton.setText(nick);
nickButton.pack(); // properly resize the button
chatEntry.layout(); // make sure entryText is resized properly
}
=======================================
---
/trunk/contempt-core/src/javasec/contempt/visuals/RemoteNetworkVisual.java
Sun Oct 11 04:05:40 2009
+++
/trunk/contempt-core/src/javasec/contempt/visuals/RemoteNetworkVisual.java
Sun Oct 25 14:21:56 2009
@@ -10,6 +10,8 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuDetectEvent;
+import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
@@ -130,7 +132,7 @@
// add the notifiers
seedConnection.notifier.subscribe("data.newRow.HOST",this,"addHost");
-
//seedConnection.notifier.subscribe("data.newRow.SERVICE",this,"addService");
+
seedConnection.notifier.subscribe("data.newRow.SERVICE",this,"addService");
}
public void addHost(Object o) // called when a new target is added to the
db
=======================================
--- /trunk/contempt-core/src/javasec/contempt/visuals/TargetsVisual.java
Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-core/src/javasec/contempt/visuals/TargetsVisual.java
Sun Oct 25 14:21:56 2009
@@ -57,7 +57,7 @@
System.out.println("get the database name!");
tableName=input.getName();
seedConnection=((VisualInput)input).seedConnection;
- setPartName(seedConnection.serverName+" targets");
+ setPartName(seedConnection.name+" targets");
}
public boolean isDirty()
=======================================
--- /trunk/contempt-feature/feature.xml Sun Oct 11 04:05:40 2009
+++ /trunk/contempt-feature/feature.xml Sun Oct 25 14:21:56 2009
@@ -67,6 +67,7 @@
id="javasec.contempt"
download-size="0"
install-size="0"
- version="0.0.0"/>
+ version="0.0.0"
+ unpack="false"/>
</feature>
=======================================
---
/trunk/contempt-installer/src/javasec/contempt/installer/ContemptInstaller.java
Sun Oct 11 04:05:40 2009
+++
/trunk/contempt-installer/src/javasec/contempt/installer/ContemptInstaller.java
Sun Oct 25 14:21:56 2009
@@ -13,11 +13,13 @@
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
+
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -134,6 +136,11 @@
bottomPanel.add(cancelButton);
add(bottomPanel, BorderLayout.SOUTH);
+
+ textArea.setText("operating system : "+osName+"\n");
+ textArea.append("architecture : "+osArch+"\n");
+ textArea.append("install path : "+installPath+"\n\n");
+ textArea.append("contempt is ready to install\n\n");
}
public boolean install()
@@ -228,8 +235,19 @@
textArea.append("failed to extract the archive");
e.printStackTrace();
}
+
+ try
+ {
+ if(!smallOS.equals("win"))
+ Runtime.getRuntime().exec("chmod
+x "+installPath+File.separator+"contempt");
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
// set up shortcuts
+ /*
textArea.append("setting up requested shortcuts\n");
try
{
@@ -250,9 +268,11 @@
// TODO Auto-generated catch block
e.printStackTrace();
}
+ */
textArea.append("\nContempt has been installed successfully\n");
- textArea.append("a shortcut has been added to your desktop");
+ textArea.append("\nsorry, but no shortcuts were added, this installer is
still new\n");
+ textArea.append("you should be able to find the contempt binary in
~/.contempt\n");
return true;
}