Java tutorial
/** Exploit Pack - Security Framework for Exploit Developers Copyright 2011 Juan Sacco http://exploitpack.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ **/ package com.exploitpack.main; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.Socket; import java.net.URL; import java.net.UnknownHostException; import java.text.Format; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.custom.CBanner; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.wb.swt.SWTResourceManager; import com.exploitpack.agent.Connect; import com.exploitpack.project.ProjectWindow; public class MainWindow { protected Shell shlExploitPack; private Object ExploitModule; private String ipAddrStr; private String HostName; private Text txtModulesExplorer; private final FormToolkit formToolkit = new FormToolkit( Display.getDefault()); private String AgentPort; public int TotalModulesLength; private String ExploitCodeName; private String ExploitType; @SuppressWarnings("unused") private String Service; @SuppressWarnings("unused") private String ExploitPlatform; private Text ResponseData; private Text ShellcodeConsole; private Text ShellcodeInput; private Text QuickInformation; private Text ApplicationLog; private Text TargetName; private Text TargetArgs; private Text TargetLhost; private static List<Integer> ports = new ArrayList<Integer>(); @SuppressWarnings("unused") private static String host; private Text TargetLPort; private Text DebugLog; private String LogTime; private String OSType; private Text WebURL; private Text PostData; private TreeItem LastTreeItemSelected = null; public String CurrentAppVersion; private Button btnLaunch; private Tree TreeExploits; private TabFolder tabFolder; private Combo SearchCombo; private ToolBar toolBar; private CBanner banner; private static List<Integer> OpenPortsList = new ArrayList<Integer>(); @SuppressWarnings("unused") private static String ScannerHost; private Text URLBrowser; private Text TargetPath; public int port2; public int port; XMLTreenode NewXMLNode = new XMLTreenode(); String ExploitSelection = ""; private String pythonFullPath; private Text urlToCheck; public static void main(String[] args) { try { MainWindow window = new MainWindow(); window.open(); } catch (Exception e) { e.printStackTrace(); } } public void open() { Display display = Display.getDefault(); createContents(); Rectangle bounds = display.getBounds(); Rectangle rect = shlExploitPack.getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; shlExploitPack.setLocation(x, y); shlExploitPack.open(); shlExploitPack.layout(); while (!shlExploitPack.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } @SuppressWarnings("unused") public void createContents() { // Set App Version CurrentAppVersion = "2.1"; // Obtain local time Format formatter; Date date = new Date(); formatter = new SimpleDateFormat("hh:mm:ss"); LogTime = formatter.format(date); // Try to install python // Obtain Python Path try { // Read file FileReader fstream = new FileReader("data/config/exploitpack.config"); BufferedReader in = new BufferedReader(fstream); pythonFullPath = in.readLine() + "\n"; System.out.print(pythonFullPath); // Close the output stream in.close(); } catch (Exception e1) { // Catch exception if any RequirementInstaller.main(null); System.err.println("Error: " + e1.getMessage()); } // Try to obtain local IP and Hostname try { InetAddress addr = InetAddress.getLocalHost(); // Get IP Address byte[] ipAddr = addr.getAddress(); // Convert to dot representation ipAddrStr = ""; for (int i = 0; i < ipAddr.length; i++) { if (i > 0) { ipAddrStr += "."; } ipAddrStr += ipAddr[i] & 0xFF; // Get hostname HostName = addr.getHostName(); } } catch (UnknownHostException e) { } // Start to load the Window shlExploitPack = new Shell(); // Start Systray SysTray.main(null); Composite composite = new Composite(shlExploitPack, SWT.NONE); FormData fd_composite = new FormData(); fd_composite.left = new FormAttachment(0); fd_composite.top = new FormAttachment(0, 666); fd_composite.bottom = new FormAttachment(0, 689); fd_composite.right = new FormAttachment(0, 1370); composite.setLayoutData(fd_composite); composite.setLayout(new FormLayout()); formToolkit.adapt(composite); formToolkit.paintBordersFor(composite); Label lblNewLabel_3 = new Label(composite, SWT.NONE); FormData fd_lblNewLabel_3 = new FormData(); fd_lblNewLabel_3.top = new FormAttachment(0, 5); fd_lblNewLabel_3.left = new FormAttachment(0, 10); lblNewLabel_3.setLayoutData(fd_lblNewLabel_3); formToolkit.adapt(lblNewLabel_3, true, true); lblNewLabel_3.setText("Welcome to Exploit Pack - Security Framework"); final ProgressBar moduleProgressBar = new ProgressBar(composite, SWT.NONE); FormData fd_moduleProgressBar = new FormData(); fd_moduleProgressBar.left = new FormAttachment(100, -180); fd_moduleProgressBar.right = new FormAttachment(100, -10); fd_moduleProgressBar.bottom = new FormAttachment(0, 18); fd_moduleProgressBar.top = new FormAttachment(0, 5); moduleProgressBar.setLayoutData(fd_moduleProgressBar); formToolkit.adapt(moduleProgressBar, true, true); Label lblNewLabel_4 = new Label(composite, SWT.NONE); FormData fd_lblNewLabel_4 = new FormData(); fd_lblNewLabel_4.top = new FormAttachment(0, 5); fd_lblNewLabel_4.right = new FormAttachment(moduleProgressBar, -6); fd_lblNewLabel_4.left = new FormAttachment(moduleProgressBar, -101, SWT.LEFT); lblNewLabel_4.setLayoutData(fd_lblNewLabel_4); formToolkit.adapt(lblNewLabel_4, true, true); lblNewLabel_4.setText("Module Progress"); final ToolBar toolBar_1 = new ToolBar(shlExploitPack, SWT.FLAT | SWT.RIGHT); ToolItem tltmVisitWebsiteJs = new ToolItem(toolBar_1, SWT.DROP_DOWN); FormData fd_toolBar_1 = new FormData(); fd_toolBar_1.bottom = new FormAttachment(0, 33); fd_toolBar_1.left = new FormAttachment(100, -120); fd_toolBar_1.right = new FormAttachment(100); fd_toolBar_1.top = new FormAttachment(0, 3); toolBar_1.setLayoutData(fd_toolBar_1); formToolkit.adapt(toolBar_1); formToolkit.paintBordersFor(toolBar_1); tltmVisitWebsiteJs.setText("Visit Website"); tltmVisitWebsiteJs.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/www.png")); ToolItem toolItem_8 = new ToolItem(toolBar_1, SWT.SEPARATOR); toolBar = new ToolBar(shlExploitPack, SWT.FLAT | SWT.WRAP | SWT.RIGHT); FormData fd_toolBar = new FormData(); fd_toolBar.left = new FormAttachment(toolBar_1, -1250, SWT.LEFT); fd_toolBar.right = new FormAttachment(toolBar_1, 1); fd_toolBar.top = new FormAttachment(0, 3); toolBar.setLayoutData(fd_toolBar); toolBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); formToolkit.adapt(toolBar); formToolkit.paintBordersFor(toolBar); ToolItem toolItem_5 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmNewProject = new ToolItem(toolBar, SWT.NONE); tltmNewProject.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ProjectWindow.main(null); } }); tltmNewProject.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316133906_package.png")); tltmNewProject.setText("New Project"); ToolItem tltmOpenProject = new ToolItem(toolBar, SWT.NONE); tltmOpenProject.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { OpenFile(); } }); tltmOpenProject .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316133571_package_go.png")); tltmOpenProject.setText("Open Project"); ToolItem toolItem_6 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmNewItem = new ToolItem(toolBar, SWT.NONE); tltmNewItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134049_table_save.png")); tltmNewItem.setText("Save Project"); ToolItem toolItem = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmNewItem_1 = new ToolItem(toolBar, SWT.NONE); tltmNewItem_1.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134425_cut_red.png")); tltmNewItem_1.setText("Cut"); ToolItem tltmNewItem_2 = new ToolItem(toolBar, SWT.NONE); tltmNewItem_2 .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134439_page_copy.png")); tltmNewItem_2.setText("Copy"); ToolItem tltmNewItem_3 = new ToolItem(toolBar, SWT.NONE); tltmNewItem_3.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/1316134460_page_white_paste.png")); tltmNewItem_3.setText("Paste"); ToolItem toolItem_1 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem LocalInterface = new ToolItem(toolBar, SWT.DROP_DOWN); LocalInterface.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/1316134303_application_form_delete.png")); LocalInterface.setText("Interface: " + HostName); ToolItem toolItem_2 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmNewItem_4 = new ToolItem(toolBar, SWT.NONE); tltmNewItem_4.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { } }); tltmNewItem_4 .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134599_chart_bar.png")); tltmNewItem_4.setText("View Report"); ToolItem toolItem_3 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmModuleEditor = new ToolItem(toolBar, SWT.NONE); tltmModuleEditor.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { com.exploitpack.editor.MainEditor.main(null); } }); tltmModuleEditor.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/editor.png")); tltmModuleEditor.setText("Module Editor"); ToolItem toolItem_4 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmNewItem_5 = new ToolItem(toolBar, SWT.NONE); tltmNewItem_5.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Updater.main(null); } }); tltmNewItem_5.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/checkupdate.png")); tltmNewItem_5.setText("Update Manager"); formToolkit.adapt(toolBar); formToolkit.paintBordersFor(toolBar); ToolItem toolItem_9 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmRun = new ToolItem(toolBar, SWT.NONE); tltmRun.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { btnLaunch.setSelection(true); //btnLaunch. } }); tltmRun.setText("Run"); tltmRun.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/run.png")); ToolItem toolItem_7 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmStop = new ToolItem(toolBar, SWT.NONE); tltmStop.setText("Stop"); tltmStop.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/stop.png")); ToolItem toolItem_10 = new ToolItem(toolBar, SWT.SEPARATOR); ToolItem tltmDebug = new ToolItem(toolBar, SWT.NONE); tltmDebug.setText("Debug"); tltmDebug.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/bug.png")); shlExploitPack.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316133906_package.png")); shlExploitPack.setSize(1397, 747); shlExploitPack.setText("Exploit Pack - Security Framework"); shlExploitPack.setLayout(new FormLayout()); Menu menu = new Menu(shlExploitPack, SWT.BAR); shlExploitPack.setMenuBar(menu); MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE); mntmFile.setText("File"); Menu menu_1 = new Menu(mntmFile); mntmFile.setMenu(menu_1); MenuItem mntmNewProject = new MenuItem(menu_1, SWT.NONE); mntmNewProject.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316133906_package.png")); mntmNewProject.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ProjectWindow.main(null); } }); mntmNewProject.setAccelerator(SWT.MOD1 + 'N'); mntmNewProject.setText("New Project \tCtrl+N"); MenuItem mntmLoadProject = new MenuItem(menu_1, SWT.NONE); mntmLoadProject.setText("Open Project.. \tCtrl+O"); new MenuItem(menu_1, SWT.SEPARATOR); MenuItem mntmSaveProject = new MenuItem(menu_1, SWT.NONE); mntmSaveProject .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134049_table_save.png")); mntmSaveProject.setText("Save Project \tCtrl+S"); MenuItem mntmCloseProject = new MenuItem(menu_1, SWT.NONE); mntmCloseProject.setText("Close Project \tCtrl+W"); new MenuItem(menu_1, SWT.SEPARATOR); MenuItem mntmExit = new MenuItem(menu_1, SWT.NONE); mntmExit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { shlExploitPack.dispose(); } }); mntmExit.setText("Exit"); mntmExit.setAccelerator(SWT.MOD1 + 'Q'); MenuItem mntmEdit = new MenuItem(menu, SWT.CASCADE); mntmEdit.setText("Edit"); Menu menu_2 = new Menu(mntmEdit); mntmEdit.setMenu(menu_2); MenuItem mntmNewItem = new MenuItem(menu_2, SWT.NONE); mntmNewItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/arrow_undo.png")); mntmNewItem.setText("Undo"); MenuItem mntmNewItem_1 = new MenuItem(menu_2, SWT.NONE); mntmNewItem_1.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/arrow_redo.png")); mntmNewItem_1.setText("Redo"); new MenuItem(menu_2, SWT.SEPARATOR); MenuItem mntmCut = new MenuItem(menu_2, SWT.NONE); mntmCut.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134425_cut_red.png")); mntmCut.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ShellcodeConsole.cut(); } }); mntmCut.setText("Cut \tCtrl+X"); mntmCut.setAccelerator(SWT.MOD1 + 'X'); MenuItem mntmCopy = new MenuItem(menu_2, SWT.NONE); mntmCopy.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/1316134439_page_copy.png")); mntmCopy.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ShellcodeConsole.copy(); } }); mntmCopy.setText("Copy \tCtrl+C"); mntmCopy.setAccelerator(SWT.MOD1 + 'C'); MenuItem mntmPaste = new MenuItem(menu_2, SWT.NONE); mntmPaste.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/1316134460_page_white_paste.png")); mntmPaste.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ShellcodeConsole.paste(); } }); mntmPaste.setText("Paste \tCtrl+P"); mntmPaste.setAccelerator(SWT.MOD1 + 'P'); MenuItem mntmModules = new MenuItem(menu, SWT.CASCADE); mntmModules.setText("Modules"); Menu menu_3 = new Menu(mntmModules); mntmModules.setMenu(menu_3); MenuItem mntmShowModules = new MenuItem(menu_3, SWT.NONE); mntmShowModules.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/cog.png")); mntmShowModules.setText("Show Modules"); MenuItem mntmTools = new MenuItem(menu, SWT.CASCADE); mntmTools.setText("Tools"); Menu menu_4 = new Menu(mntmTools); mntmTools.setMenu(menu_4); MenuItem mntmConsole = new MenuItem(menu_4, SWT.NONE); mntmConsole.setText("Console \tCtrl+C"); MenuItem mntmRefreshModules = new MenuItem(menu_4, SWT.NONE); mntmRefreshModules.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/refresh.png")); mntmRefreshModules.setText("Refresh Modules \tF5"); new MenuItem(menu_4, SWT.SEPARATOR); MenuItem mntmModuleEditor = new MenuItem(menu_4, SWT.NONE); mntmModuleEditor.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/editor.png")); mntmModuleEditor.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { com.exploitpack.editor.MainEditor.main(null); } }); mntmModuleEditor.setText("Module Editor \tCtrl+M"); new MenuItem(menu_4, SWT.SEPARATOR); MenuItem mntmEditPreferences = new MenuItem(menu_4, SWT.NONE); mntmEditPreferences.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Preferences.main(null); } }); mntmEditPreferences.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/preferences.png")); mntmEditPreferences.setText("Edit Preferences"); mntmPaste.setAccelerator(SWT.MOD1 + 'C'); MenuItem mntmRun = new MenuItem(menu, SWT.CASCADE); mntmRun.setText("Run"); Menu menu_7 = new Menu(mntmRun); mntmRun.setMenu(menu_7); MenuItem mntmRun_1 = new MenuItem(menu_7, SWT.NONE); mntmRun_1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { } }); mntmRun_1.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/run.png")); mntmRun_1.setText("Run \tCtrl+F11"); MenuItem mntmStop = new MenuItem(menu_7, SWT.NONE); mntmStop.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/stop.png")); mntmStop.setText("Stop"); new MenuItem(menu_7, SWT.SEPARATOR); MenuItem mntmDebug = new MenuItem(menu_7, SWT.NONE); mntmDebug.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/bug.png")); mntmDebug.setText("Debug \tF11"); MenuItem mntmUpdate = new MenuItem(menu, SWT.CASCADE); mntmUpdate.setText("Update"); Menu menu_5 = new Menu(mntmUpdate); mntmUpdate.setMenu(menu_5); MenuItem mntmCheckUpdates = new MenuItem(menu_5, SWT.NONE); mntmCheckUpdates.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/checkupdate.png")); mntmCheckUpdates.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { CheckUpdate.main(null); } }); mntmCheckUpdates.setText("Check Updates \tCtrl+U"); mntmPaste.setAccelerator(SWT.MOD1 + 'U'); MenuItem mntmHelp = new MenuItem(menu, SWT.CASCADE); mntmHelp.setText("Help"); Menu menu_6 = new Menu(mntmHelp); mntmHelp.setMenu(menu_6); MenuItem mntmViewHelp = new MenuItem(menu_6, SWT.NONE); mntmViewHelp.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/help.png")); mntmViewHelp.setText("View Help \tCtrl+H"); mntmPaste.setAccelerator(SWT.MOD1 + 'H'); MenuItem mntmReportABug = new MenuItem(menu_6, SWT.NONE); mntmReportABug.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/reportbug.png")); mntmReportABug.setText("Report a Bug"); new MenuItem(menu_6, SWT.SEPARATOR); MenuItem mntmCheckForUpdates = new MenuItem(menu_6, SWT.NONE); mntmCheckForUpdates.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/updatemanager.png")); mntmCheckForUpdates.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { com.exploitpack.main.Updater.main(null); } }); mntmCheckForUpdates.setText("Update Manager"); MenuItem mntmLicense = new MenuItem(menu_6, SWT.NONE); mntmLicense.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { License.main(null); } }); mntmLicense.setText("License"); MenuItem menuItem = new MenuItem(menu_6, SWT.SEPARATOR); MenuItem mntmAbout = new MenuItem(menu_6, SWT.NONE); mntmAbout.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/about.png")); mntmAbout.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { About OpenForm = new About(); OpenForm.open(); } }); mntmAbout.setText("About - Exploit Pack"); tabFolder = new TabFolder(shlExploitPack, SWT.NONE); FormData fd_tabFolder = new FormData(); fd_tabFolder.right = new FormAttachment(toolBar_1, 0, SWT.RIGHT); fd_tabFolder.left = new FormAttachment(0, 283); fd_tabFolder.bottom = new FormAttachment(0, 502); fd_tabFolder.top = new FormAttachment(0, 39); tabFolder.setLayoutData(fd_tabFolder); TabItem tbtmModules = new TabItem(tabFolder, SWT.NONE); tbtmModules.setText("Modules"); Composite composite1 = new Composite(tabFolder, SWT.NONE); tbtmModules.setControl(composite1); composite1.setLayout(new FormLayout()); Group grpTargetInformation = new Group(composite1, SWT.NONE); FormData fd_grpTargetInformation = new FormData(); fd_grpTargetInformation.right = new FormAttachment(0, 387); fd_grpTargetInformation.bottom = new FormAttachment(0, 140); fd_grpTargetInformation.left = new FormAttachment(0, 10); fd_grpTargetInformation.top = new FormAttachment(0, 10); grpTargetInformation.setLayoutData(fd_grpTargetInformation); grpTargetInformation.setText("Target Properties"); Group grpShellcodeConsole = new Group(composite1, SWT.NONE); grpShellcodeConsole.setLayout(new FormLayout()); FormData fd_grpShellcodeConsole = new FormData(); fd_grpShellcodeConsole.left = new FormAttachment(0, 10); fd_grpShellcodeConsole.top = new FormAttachment(0, 145); fd_grpShellcodeConsole.bottom = new FormAttachment(100, -10); grpShellcodeConsole.setLayoutData(fd_grpShellcodeConsole); grpShellcodeConsole.setText("Shellcode Console"); Group grpExecutedModules = new Group(composite1, SWT.NONE); grpExecutedModules.setLayout(new FormLayout()); FormData fd_grpExecutedModules = new FormData(); fd_grpExecutedModules.left = new FormAttachment(grpTargetInformation, 6); fd_grpExecutedModules.bottom = new FormAttachment(0, 140); final Text TargetHost = new Text(grpTargetInformation, SWT.BORDER); TargetHost.setBounds(58, 46, 134, 19); formToolkit.adapt(TargetHost, true, true); final Text TargetPort = new Text(grpTargetInformation, SWT.BORDER); TargetPort.setBounds(58, 71, 134, 19); formToolkit.adapt(TargetPort, true, true); Label lblTarget = new Label(grpTargetInformation, SWT.NONE); lblTarget.setBounds(10, 46, 36, 16); formToolkit.adapt(lblTarget, true, true); lblTarget.setText("Target:"); Label lblPort = new Label(grpTargetInformation, SWT.NONE); lblPort.setBounds(10, 71, 32, 13); formToolkit.adapt(lblPort, true, true); lblPort.setText("Port:"); Label lblProject = formToolkit.createLabel(grpTargetInformation, "Project:", SWT.NONE); lblProject.setBounds(10, 21, 42, 19); Label lblArgs = formToolkit.createLabel(grpTargetInformation, "Special:", SWT.NONE); lblArgs.setBounds(198, 74, 55, 16); TargetName = new Text(grpTargetInformation, SWT.BORDER); TargetName.setText("Exploit Pack"); TargetName.setBounds(58, 21, 134, 19); formToolkit.adapt(TargetName, true, true); TargetArgs = new Text(grpTargetInformation, SWT.BORDER); TargetArgs.setBounds(266, 71, 101, 19); formToolkit.adapt(TargetArgs, true, true); TargetLhost = new Text(grpTargetInformation, SWT.BORDER); TargetLhost.setBounds(266, 21, 101, 19); TargetLhost.setText(ipAddrStr); formToolkit.adapt(TargetLhost, true, true); TargetLPort = new Text(grpTargetInformation, SWT.BORDER); TargetLPort.setBounds(266, 46, 101, 19); formToolkit.adapt(TargetLPort, true, true); Label lblNewLabel_2 = formToolkit.createLabel(grpTargetInformation, "Shellcode:", SWT.NONE); lblNewLabel_2.setBounds(198, 101, 55, 13); Label lblLocalHost = formToolkit.createLabel(grpTargetInformation, "Local Host:", SWT.NONE); lblLocalHost.setBounds(198, 21, 62, 15); Label lblLocalPort = formToolkit.createLabel(grpTargetInformation, "Local Port:", SWT.NONE); lblLocalPort.setBounds(200, 46, 55, 15); final Combo ShellcodeCombo = new Combo(grpTargetInformation, SWT.NONE); ShellcodeCombo.setItems(new String[] { "Remote Shell", "Execute Code", "Command", "Local Shell" }); ShellcodeCombo.setBounds(266, 96, 101, 19); formToolkit.adapt(ShellcodeCombo); formToolkit.paintBordersFor(ShellcodeCombo); ShellcodeCombo.setText("Select"); Label lblNewLabel_6 = new Label(grpTargetInformation, SWT.NONE); lblNewLabel_6.setBounds(10, 101, 36, 15); formToolkit.adapt(lblNewLabel_6, true, true); lblNewLabel_6.setText("Path:"); TargetPath = new Text(grpTargetInformation, SWT.BORDER); TargetPath.setBounds(58, 96, 134, 19); formToolkit.adapt(TargetPath, true, true); fd_grpExecutedModules.top = new FormAttachment(0, 10); grpExecutedModules.setLayoutData(fd_grpExecutedModules); grpExecutedModules.setText("Executed Modules"); Group grpModulesLog = new Group(composite1, SWT.NONE); fd_grpExecutedModules.right = new FormAttachment(100, -249); grpModulesLog.setLayout(new FormLayout()); FormData fd_grpModulesLog = new FormData(); fd_grpModulesLog.left = new FormAttachment(100, -243); fd_grpModulesLog.bottom = new FormAttachment(2, 130); fd_grpModulesLog.right = new FormAttachment(100, -10); fd_grpModulesLog.top = new FormAttachment(2); grpModulesLog.setLayoutData(fd_grpModulesLog); grpModulesLog.setText("Modules Log"); Group grpAvailableTargets = new Group(composite1, SWT.NONE); fd_grpShellcodeConsole.right = new FormAttachment(grpAvailableTargets, -6); ShellcodeConsole = new Text(grpShellcodeConsole, SWT.BORDER | SWT.MULTI); ShellcodeConsole.setToolTipText("Shellcode Console - Built in"); FormData fd_ShellcodeConsole = new FormData(); fd_ShellcodeConsole.top = new FormAttachment(0, 11); fd_ShellcodeConsole.right = new FormAttachment(100, -7); fd_ShellcodeConsole.left = new FormAttachment(0, 7); ShellcodeConsole.setLayoutData(fd_ShellcodeConsole); ShellcodeConsole.setForeground(SWTResourceManager.getColor(SWT.COLOR_GREEN)); ShellcodeConsole.setBackground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); ShellcodeConsole.setEditable(false); ShellcodeConsole.setText("=> Welcome to the Shellcode console Built-In Exploit Pack " + CurrentAppVersion + "\r\n=> The programs or scripts included with Exploit Pack are free software;\r\n=> the exact distribution terms for each one are described in the individual files\r\n=> \r\n=> Exploit Pack comes with ABSOLUTELY NO WARRANTY, for this free software\r\n=> to the extend permitted by applicable law\r\n=> Type ? for help\n"); ShellcodeConsole.append("=> \n"); ShellcodeInput = new Text(grpShellcodeConsole, SWT.BORDER); FormData fd_ShellcodeInput = new FormData(); fd_ShellcodeInput.left = new FormAttachment(ShellcodeConsole, 0, SWT.LEFT); fd_ShellcodeInput.top = new FormAttachment(100, -30); fd_ShellcodeInput.bottom = new FormAttachment(100, -12); ShellcodeInput.setLayoutData(fd_ShellcodeInput); // Handle the Shell code console input ShellcodeInput.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { int code = e.keyCode; String Switch = ShellcodeInput.getText(); if (code == 13) { // Connect if ((Switch.equals("connect") || (Switch.equals("c")) || (Switch.equals("y")))) { ShellcodeConsole.setText("=> Connecting to the target: " + TargetHost.getText() + "\n"); ShellcodeConsole.append(" Please wait while I open a console for you\n"); Connect.main(null, TargetHost.getText(), AgentPort); // Clean input ShellcodeInput.setText(""); } // Help if ((Switch.equals("help") || (Switch.equals("h") || (Switch.equals("?"))))) { ShellcodeConsole.setText("=> Base commands :\n"); ShellcodeConsole.append("=> Help menu: ? or help\n"); ShellcodeConsole.append("=> List sessions: ls or sessions\n"); ShellcodeConsole.append("=> Connect to: c or connect\n"); ShellcodeConsole.append("=> Disconnect from: d or disconnect\n"); ShellcodeConsole.append("=> Version: v or version\n"); // Clean input ShellcodeInput.setText(""); } // Session list if ((Switch.equals("session") || (Switch.equals("s") || (Switch.equals("ls"))))) { ShellcodeConsole.setText("=> Active sessions: \n"); // Clean input ShellcodeInput.setText(""); } // Version if ((Switch.equals("version") || (Switch.equals("v")))) { ShellcodeConsole.setText("=> Exploit Pack - Security Framework\n"); ShellcodeConsole.append("=> Author: Juan Sacco\n"); ShellcodeConsole.append("=> Version " + CurrentAppVersion + "\n"); // Clean input ShellcodeInput.setText(""); } // Disconnect if ((Switch.equals("disconnect") || (Switch.equals("d")) || (Switch.equals("n")))) { ShellcodeConsole.setText("=> Closing connection from " + TargetHost.getText() + "\n"); ShellcodeConsole.append("=> Done.\n"); // Clean input ShellcodeInput.setText(""); } // Clean input ShellcodeInput.setText(""); } } }); ShellcodeInput.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { String CheckInput = ShellcodeInput.getText(); System.out.print(CheckInput); ShellcodeInput.setText(""); } }); ShellcodeInput.setText("Type your command here.."); ShellcodeInput.setForeground(SWTResourceManager.getColor(255, 0, 255)); formToolkit.adapt(ShellcodeInput, true, true); Button btnNewButton = new Button(grpShellcodeConsole, SWT.NONE); fd_ShellcodeConsole.bottom = new FormAttachment(btnNewButton, -6); fd_ShellcodeInput.right = new FormAttachment(btnNewButton, -6); FormData fd_btnNewButton = new FormData(); fd_btnNewButton.bottom = new FormAttachment(100, -10); fd_btnNewButton.right = new FormAttachment(100, -10); btnNewButton.setLayoutData(fd_btnNewButton); formToolkit.adapt(btnNewButton, true, true); btnNewButton.setText("Send"); FormData fd_grpAvailableTargets = new FormData(); fd_grpAvailableTargets.top = new FormAttachment(100, -290); fd_grpAvailableTargets.bottom = new FormAttachment(100, -10); fd_grpAvailableTargets.right = new FormAttachment(100, -249); final Tree ExecutedModules = new Tree(grpExecutedModules, SWT.SINGLE | SWT.BORDER); ExecutedModules.setLinesVisible(true); ExecutedModules.setToolTipText("Executed Modules - Time and state"); FormData fd_tree111 = new FormData(); fd_tree111.top = new FormAttachment(0, 5); fd_tree111.left = new FormAttachment(0, 7); fd_tree111.bottom = new FormAttachment(100, -5); fd_tree111.right = new FormAttachment(100, -7); ExecutedModules.setLayoutData(fd_tree111); final TreeItem ExecuteModulesNode = new TreeItem(ExecutedModules, SWT.NONE, 0); ExecuteModulesNode.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/application.png")); ExecuteModulesNode.setText("Modules State View"); final Tree ModulesLog = new Tree(grpModulesLog, SWT.SINGLE | SWT.BORDER); ModulesLog.setLinesVisible(true); ModulesLog.setToolTipText("Log activities"); FormData fd_ModulesLog = new FormData(); fd_ModulesLog.bottom = new FormAttachment(100, -7); fd_ModulesLog.right = new FormAttachment(100, -10); fd_ModulesLog.top = new FormAttachment(0, 5); fd_ModulesLog.left = new FormAttachment(0, 10); ModulesLog.setLayoutData(fd_ModulesLog); final TreeItem ModulesLogNode = new TreeItem(ModulesLog, SWT.NONE, 0); ModulesLogNode.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/binary.png")); ModulesLogNode.setText("Modules Load Status: Ok"); grpAvailableTargets.setLayout(new FormLayout()); grpAvailableTargets.setLayoutData(fd_grpAvailableTargets); grpAvailableTargets.setText("Available Targets"); Group grpNetworkScanner = new Group(composite1, SWT.NONE); grpNetworkScanner.setText("Network Scanner"); FormData fd_grpNetworkScanner = new FormData(); fd_grpNetworkScanner.top = new FormAttachment(100, -290); fd_grpNetworkScanner.left = new FormAttachment(100, -243); fd_grpNetworkScanner.bottom = new FormAttachment(100, -10); Composite composite_61 = new Composite(grpAvailableTargets, SWT.NONE); FormData fd_composite_6 = new FormData(); fd_composite_6.right = new FormAttachment(100, -7); fd_composite_6.left = new FormAttachment(0, 8); fd_composite_6.bottom = new FormAttachment(100, -7); fd_composite_6.top = new FormAttachment(0, 11); composite_61.setLayoutData(fd_composite_6); formToolkit.adapt(composite_61); formToolkit.paintBordersFor(composite_61); Label lblRightClick = new Label(composite_61, SWT.NONE); lblRightClick.setText("Right click for menu"); lblRightClick.setBounds(62, 219, 107, 15); formToolkit.adapt(lblRightClick, true, true); final Tree TreeAvailableTargets = new Tree(composite_61, SWT.SINGLE | SWT.BORDER); TreeAvailableTargets.setSortDirection(SWT.UP); TreeAvailableTargets.setBounds(0, 0, 179, 244); TreeAvailableTargets.setToolTipText("Right Click for Menu"); TreeAvailableTargets.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { } @Override public void mouseDown(MouseEvent e) { TreeAvailableTargets.addListener(SWT.MenuDetect, new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { // We need a Shell as the parent of our menu final Shell shlSysTray = new Shell(event.display); // Style must be pop up Menu m = new Menu(shlSysTray, SWT.POP_UP); // Creates a new menu item that terminates the // program // when selected MenuItem restore = new MenuItem(m, SWT.NONE); restore.setText("Check connection"); restore.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { } }); MenuItem help = new MenuItem(m, SWT.NONE); help.setText("Connect"); help.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { Connect.main(null, TargetHost.getText(), AgentPort); } }); MenuItem about = new MenuItem(m, SWT.NONE); about.setText("Disconnect"); about.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { About.main(null); } }); // We need to make the menu visible m.setVisible(true); }; }); } }); final TreeItem AvailableTargets = new TreeItem(TreeAvailableTargets, SWT.NONE, 0); AvailableTargets.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/computer.png")); AvailableTargets.setText("Localhost ( 127.0.0.1 )"); fd_grpNetworkScanner.right = new FormAttachment(100, -10); grpNetworkScanner.setLayoutData(fd_grpNetworkScanner); formToolkit.adapt(grpNetworkScanner); formToolkit.paintBordersFor(grpNetworkScanner); TreeViewer treeViewer = new TreeViewer(grpNetworkScanner, SWT.BORDER); Tree TreePortScanner = treeViewer.getTree(); TreePortScanner.setToolTipText("Network mapper"); TreePortScanner.setBounds(10, 25, 213, 245); formToolkit.paintBordersFor(TreePortScanner); final TreeItem OpenPorts = new TreeItem(TreePortScanner, SWT.NONE); OpenPorts.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/port.png")); OpenPorts.setText("Open Ports ( 127.0.0.1 )"); TabItem tbtmHttpFuzzer = new TabItem(tabFolder, SWT.NONE); tbtmHttpFuzzer.setText("HTTP Fuzzer"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmHttpFuzzer.setControl(composite_1); composite_1.setLayout(new FormLayout()); Label lblMethod = formToolkit.createLabel(composite_1, "Method:", SWT.NONE); FormData fd_lblMethod = new FormData(); fd_lblMethod.bottom = new FormAttachment(0, 25); fd_lblMethod.right = new FormAttachment(0, 65); fd_lblMethod.top = new FormAttachment(0, 10); fd_lblMethod.left = new FormAttachment(0, 10); lblMethod.setLayoutData(fd_lblMethod); Label lblProtocol = formToolkit.createLabel(composite_1, "Protocol:", SWT.NONE); FormData fd_lblProtocol = new FormData(); fd_lblProtocol.top = new FormAttachment(lblMethod, 0, SWT.TOP); fd_lblProtocol.right = new FormAttachment(0, 189); lblProtocol.setLayoutData(fd_lblProtocol); Combo combo_1 = new Combo(composite_1, SWT.NONE); combo_1.setItems(new String[] { "HTTP/1.1", "HTTP/1.0" }); FormData fd_combo_1 = new FormData(); fd_combo_1.left = new FormAttachment(lblProtocol, 6); fd_combo_1.top = new FormAttachment(0, 10); combo_1.setLayoutData(fd_combo_1); formToolkit.adapt(combo_1); formToolkit.paintBordersFor(combo_1); Label lblNewLabel = formToolkit.createLabel(composite_1, "Web URL:", SWT.NONE); fd_combo_1.right = new FormAttachment(lblNewLabel, -6); combo_1.setText("HTTP/1.1"); FormData fd_lblNewLabel = new FormData(); fd_lblNewLabel.bottom = new FormAttachment(0, 31); fd_lblNewLabel.right = new FormAttachment(0, 337); fd_lblNewLabel.top = new FormAttachment(0, 16); fd_lblNewLabel.left = new FormAttachment(0, 282); lblNewLabel.setLayoutData(fd_lblNewLabel); Label lblPostData = formToolkit.createLabel(composite_1, "Post Data:", SWT.NONE); FormData fd_lblPostData = new FormData(); fd_lblPostData.bottom = new FormAttachment(0, 63); fd_lblPostData.right = new FormAttachment(0, 337); fd_lblPostData.top = new FormAttachment(0, 48); fd_lblPostData.left = new FormAttachment(0, 282); lblPostData.setLayoutData(fd_lblPostData); Button btnCheckButton = new Button(composite_1, SWT.CHECK); FormData fd_btnCheckButton = new FormData(); fd_btnCheckButton.right = new FormAttachment(lblPostData, -27); fd_btnCheckButton.bottom = new FormAttachment(lblPostData, 0, SWT.BOTTOM); btnCheckButton.setLayoutData(fd_btnCheckButton); formToolkit.adapt(btnCheckButton, true, true); btnCheckButton.setText("Enable Post Data"); ResponseData = new Text(composite_1, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); FormData fd_ResponseData = new FormData(); fd_ResponseData.top = new FormAttachment(lblPostData, 6); fd_ResponseData.left = new FormAttachment(0, 10); fd_ResponseData.bottom = new FormAttachment(100, -10); fd_ResponseData.right = new FormAttachment(100, -10); ResponseData.setLayoutData(fd_ResponseData); formToolkit.adapt(ResponseData, true, true); Label lblNewLabel_1 = formToolkit.createLabel(composite_1, "Response Data:", SWT.NONE); fd_btnCheckButton.left = new FormAttachment(0, 117); FormData fd_lblNewLabel_1 = new FormData(); fd_lblNewLabel_1.left = new FormAttachment(0, 10); fd_lblNewLabel_1.right = new FormAttachment(lblPostData, -171); fd_lblNewLabel_1.bottom = new FormAttachment(0, 63); fd_lblNewLabel_1.top = new FormAttachment(0, 48); lblNewLabel_1.setLayoutData(fd_lblNewLabel_1); Combo ComboMethod = new Combo(composite_1, SWT.NONE); ComboMethod.setItems(new String[] { "GET", "POST" }); fd_lblProtocol.left = new FormAttachment(ComboMethod, 6); FormData fd_ComboMethod = new FormData(); fd_ComboMethod.right = new FormAttachment(0, 128); fd_ComboMethod.top = new FormAttachment(0, 10); fd_ComboMethod.left = new FormAttachment(0, 66); ComboMethod.setLayoutData(fd_ComboMethod); formToolkit.adapt(ComboMethod); formToolkit.paintBordersFor(ComboMethod); ComboMethod.setText("GET"); WebURL = new Text(composite_1, SWT.BORDER); WebURL.setText("http://www.exploitpack.com/"); FormData fd_WebURL = new FormData(); fd_WebURL.top = new FormAttachment(0, 12); fd_WebURL.left = new FormAttachment(lblNewLabel, 6); WebURL.setLayoutData(fd_WebURL); formToolkit.adapt(WebURL, true, true); Button GoWebFuzz = new Button(composite_1, SWT.NONE); GoWebFuzz.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { // Create a URL to check app version URL url = new URL(WebURL.getText()); // Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); ResponseData.setText(""); while ((in.readLine() != null)) { if (in.readLine() != null) { ResponseData.append(in.readLine() + "\n"); } if (in.readLine() == "null") { return; } } } catch (Exception e2) { System.out.println(e2); } } }); fd_WebURL.right = new FormAttachment(GoWebFuzz, -6); FormData fd_GoWebFuzz = new FormData(); fd_GoWebFuzz.left = new FormAttachment(ResponseData, -79); fd_GoWebFuzz.right = new FormAttachment(ResponseData, 0, SWT.RIGHT); fd_GoWebFuzz.top = new FormAttachment(0, 10); GoWebFuzz.setLayoutData(fd_GoWebFuzz); formToolkit.adapt(GoWebFuzz, true, true); GoWebFuzz.setText("Go"); PostData = new Text(composite_1, SWT.BORDER); FormData fd_PostData = new FormData(); fd_PostData.right = new FormAttachment(ResponseData, 0, SWT.RIGHT); fd_PostData.bottom = new FormAttachment(ResponseData, -6); fd_PostData.left = new FormAttachment(lblPostData, 6); PostData.setLayoutData(fd_PostData); formToolkit.adapt(PostData, true, true); TabItem tbtmBrowser = new TabItem(tabFolder, SWT.NONE); tbtmBrowser.setText("Web Browser"); Composite composite_6 = new Composite(tabFolder, SWT.NONE); tbtmBrowser.setControl(composite_6); formToolkit.paintBordersFor(composite_6); Label lblNewLabel_5 = new Label(composite_6, SWT.NONE); lblNewLabel_5.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/updatebrowser.png")); lblNewLabel_5.setBounds(954, 15, 16, 15); formToolkit.adapt(lblNewLabel_5, true, true); final Browser EBrowser = new Browser(composite_6, SWT.BORDER); EBrowser.setUrl("http://exploitpack.com"); EBrowser.setBounds(0, 37, 1069, 398); formToolkit.adapt(EBrowser); formToolkit.paintBordersFor(EBrowser); Button btnBrowser = new Button(composite_6, SWT.NONE); btnBrowser.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { EBrowser.setUrl(URLBrowser.getText()); } }); btnBrowser.setBounds(981, 10, 78, 25); formToolkit.adapt(btnBrowser, true, true); btnBrowser.setText("Go"); URLBrowser = new Text(composite_6, SWT.BORDER); URLBrowser.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { int code = e.keyCode; if (code == 13) { EBrowser.setUrl(URLBrowser.getText()); } } }); tltmVisitWebsiteJs.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { EBrowser.setUrl("http://exploitpack.com"); } }); URLBrowser.setText("http://www.exploitpack.com"); URLBrowser.setBounds(10, 12, 965, 21); formToolkit.adapt(URLBrowser, true, true); TabItem tbtmCheckWebsite = new TabItem(tabFolder, SWT.NONE); tbtmCheckWebsite.setText("Check Website"); Composite composite_7 = new Composite(tabFolder, SWT.NONE); tbtmCheckWebsite.setControl(composite_7); formToolkit.paintBordersFor(composite_7); Label label = new Label(composite_7, SWT.NONE); label.setText("Check this website for me:"); label.setBounds(10, 15, 139, 15); formToolkit.adapt(label, true, true); Label label_1 = new Label(composite_7, SWT.NONE); label_1.setText("Website status:"); label_1.setBounds(10, 44, 79, 15); formToolkit.adapt(label_1, true, true); final Browser checksiteBrowser = new Browser(composite_7, SWT.NONE); checksiteBrowser.setBounds(10, 65, 1049, 360); checksiteBrowser.setUrl("http://exploitpack.com"); formToolkit.adapt(checksiteBrowser); formToolkit.paintBordersFor(checksiteBrowser); urlToCheck = new Text(composite_7, SWT.BORDER); urlToCheck.setBounds(155, 12, 823, 21); urlToCheck.setText("http://exploitpack.com"); formToolkit.adapt(urlToCheck, true, true); final Label imgUP = new Label(composite_7, SWT.NONE); imgUP.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/webup.gif")); imgUP.setBounds(95, 36, 24, 23); formToolkit.adapt(imgUP, true, true); final Label siteStatusText = new Label(composite_7, SWT.NONE); siteStatusText.setText("It's just you"); siteStatusText.setBounds(125, 44, 409, 15); siteStatusText.setText("It's just you " + urlToCheck.getText() + " looks up from here"); formToolkit.adapt(siteStatusText, true, true); Label imgDOWN = new Label(composite_7, SWT.NONE); imgDOWN.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/webdown.gif")); imgDOWN.setBounds(95, 36, 24, 23); formToolkit.adapt(imgDOWN, true, true); Button button = new Button(composite_7, SWT.NONE); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Show website checksiteBrowser.setUrl(urlToCheck.getText()); try { // Create a URL to check availability URL url = new URL("http://www.isup.me/" + urlToCheck.getText()); // Read all the text returned by the server BufferedReader in = new BufferedReader( new InputStreamReader(url.openStream())); String upornot; while ((upornot = in.readLine()) != null) { if (upornot.contains("It's not just you! ")) { imgUP.setVisible(false); siteStatusText .setText("It's not just you " + urlToCheck.getText() + " looks down from here"); checksiteBrowser.setUrl("http://www.exploitpack.com/dostest.html"); System.out.println("DOWN"); break; } else { imgUP.setVisible(true); siteStatusText.setText("It's just you " + urlToCheck.getText() + " looks up from here"); System.out.println("UP"); } System.out.println(upornot); } in.close(); } catch (MalformedURLException e1) { } catch (IOException e1) { } } }); button.setText("Check"); button.setBounds(984, 10, 75, 25); formToolkit.adapt(button, true, true); Label lblUsingIsupmeAs = new Label(composite_7, SWT.NONE); lblUsingIsupmeAs.setBounds(902, 44, 157, 15); formToolkit.adapt(lblUsingIsupmeAs, true, true); lblUsingIsupmeAs.setText("as engine to check availability"); Label lblUsing = new Label(composite_7, SWT.NONE); lblUsing.setBounds(817, 44, 30, 15); formToolkit.adapt(lblUsing, true, true); lblUsing.setText("Using"); Label lblIsupme = new Label(composite_7, SWT.NONE); lblIsupme.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblIsupme.setBounds(853, 44, 43, 15); formToolkit.adapt(lblIsupme, true, true); lblIsupme.setText("isup.me"); TabItem tbtmNewItem_1 = new TabItem(tabFolder, SWT.NONE); tbtmNewItem_1.setText("Changelog"); Composite composite_2 = new Composite(tabFolder, SWT.NONE); tbtmNewItem_1.setControl(composite_2); composite_2.setLayout(new FormLayout()); Browser News = new Browser(composite_2, SWT.NONE); FormData fd_News = new FormData(); fd_News.bottom = new FormAttachment(100); fd_News.right = new FormAttachment(100); fd_News.top = new FormAttachment(0); fd_News.left = new FormAttachment(0); News.setLayoutData(fd_News); News.setUrl("http://exploitpack.com/changelog/"); banner = new CBanner(shlExploitPack, SWT.NONE); FormData fd_banner = new FormData(); fd_banner.top = new FormAttachment(0, 3); fd_banner.left = new FormAttachment(0, 662); banner.setLayoutData(fd_banner); TabFolder InfoLogFolder = new TabFolder(shlExploitPack, SWT.NONE); FormData fd_InfoLogFolder = new FormData(); fd_InfoLogFolder.bottom = new FormAttachment(0, 662); fd_InfoLogFolder.right = new FormAttachment(0, 1360); fd_InfoLogFolder.top = new FormAttachment(0, 508); fd_InfoLogFolder.left = new FormAttachment(0, 283); InfoLogFolder.setLayoutData(fd_InfoLogFolder); TabItem tbtmNewItem_2 = new TabItem(InfoLogFolder, SWT.NONE); tbtmNewItem_2.setText("Quick Information"); Composite composite_3 = new Composite(InfoLogFolder, SWT.NONE); tbtmNewItem_2.setControl(composite_3); formToolkit.paintBordersFor(composite_3); composite_3.setLayout(new FormLayout()); // Load of Quick Information QuickInformation = new Text(composite_3, SWT.BORDER | SWT.MULTI); QuickInformation.setLayoutData(new FormData()); QuickInformation.setText("[" + LogTime + "]" + " Application started\n"); QuickInformation.append("[" + LogTime + "]" + " Internals check: Ok\n"); QuickInformation.append("[" + LogTime + "]" + " Running...\n"); FormData fd_QuickInformation = new FormData(); fd_QuickInformation.left = new FormAttachment(0); fd_QuickInformation.right = new FormAttachment(100); fd_QuickInformation.bottom = new FormAttachment(100); fd_QuickInformation.top = new FormAttachment(0); QuickInformation.setLayoutData(fd_QuickInformation); formToolkit.adapt(QuickInformation, true, true); TabItem tbtmNewItem_3 = new TabItem(InfoLogFolder, SWT.NONE); tbtmNewItem_3.setText("Application Log"); Composite composite_4 = new Composite(InfoLogFolder, SWT.NONE); tbtmNewItem_3.setControl(composite_4); formToolkit.paintBordersFor(composite_4); composite_4.setLayout(new FormLayout()); ApplicationLog = new Text(composite_4, SWT.BORDER | SWT.MULTI); FormData fd_ApplicationLog = new FormData(); fd_ApplicationLog.top = new FormAttachment(0); fd_ApplicationLog.bottom = new FormAttachment(100); fd_ApplicationLog.right = new FormAttachment(100); fd_ApplicationLog.left = new FormAttachment(0); ApplicationLog.setLayoutData(fd_ApplicationLog); formToolkit.adapt(ApplicationLog, true, true); TabItem tbtmNewItem_4 = new TabItem(InfoLogFolder, SWT.NONE); tbtmNewItem_4.setText("Debug Log"); Composite composite_5 = new Composite(InfoLogFolder, SWT.NONE); tbtmNewItem_4.setControl(composite_5); formToolkit.paintBordersFor(composite_5); composite_5.setLayout(new FormLayout()); DebugLog = new Text(composite_5, SWT.BORDER | SWT.MULTI); FormData fd_DebugLog = new FormData(); fd_DebugLog.bottom = new FormAttachment(100); fd_DebugLog.right = new FormAttachment(100); fd_DebugLog.top = new FormAttachment(0); fd_DebugLog.left = new FormAttachment(0); DebugLog.setLayoutData(fd_DebugLog); // Load of Application Log ApplicationLog.setText("[" + LogTime + "]" + " Log started\n"); ApplicationLog.append("[" + LogTime + "]" + " Internals check: OK\n"); ApplicationLog.append("[" + LogTime + "]" + " Running...\n"); // Load of Debug Log DebugLog.setText("[" + LogTime + "]" + " Debug Log started\n"); DebugLog.append("[" + LogTime + "]" + " Internals check: OK\n"); DebugLog.append("[" + LogTime + "]" + " Running...\n"); formToolkit.adapt(DebugLog, true, true); btnLaunch = new Button(shlExploitPack, SWT.NONE); FormData fd_btnLaunch = new FormData(); fd_btnLaunch.right = new FormAttachment(0, 277); fd_btnLaunch.left = new FormAttachment(0, 10); btnLaunch.setLayoutData(fd_btnLaunch); TreeExploits = new Tree(shlExploitPack, SWT.SINGLE | SWT.BORDER); fd_btnLaunch.bottom = new FormAttachment(TreeExploits, 31, SWT.BOTTOM); fd_btnLaunch.top = new FormAttachment(TreeExploits, 6); FormData fd_TreeExploits = new FormData(); fd_TreeExploits.bottom = new FormAttachment(0, 631); fd_TreeExploits.top = new FormAttachment(0, 95); fd_TreeExploits.right = new FormAttachment(0, 277); fd_TreeExploits.left = new FormAttachment(0, 10); TreeExploits.setLayoutData(fd_TreeExploits); TreeExploits.setToolTipText("Modules Explorer - Exploits and Tools"); // SELECCION DEL ARBOL TreeExploits.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { try { ExploitSelection = ""; TreeItem[] selection = TreeExploits.getSelection(); for (int i = 0; i < selection.length; i++) ExploitSelection += selection[i]; ExploitSelection = ExploitSelection.replaceAll("TreeItem", ""); ExploitSelection = ExploitSelection.toString().replaceAll("\\{", ""); ExploitSelection = ExploitSelection.toString().replaceAll("\\}", ""); ExploitSelection = ExploitSelection.toString().substring(1, ExploitSelection.length()); // Check if the selected item is part of these categories if (ExploitSelection.equals("Exploits") || ExploitSelection.equals("Windows") || ExploitSelection.equals("BSD") || ExploitSelection.equals("Unix") || ExploitSelection.equals("Linux") || ExploitSelection.equals("Tools") || ExploitSelection.equals("Search") || ExploitSelection.equals("History")) { return; } else { if (LastTreeItemSelected != null) { LastTreeItemSelected.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } TreeItem ItemSelected = TreeExploits.getSelection()[0]; ItemSelected.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_yellowS.gif")); LastTreeItemSelected = ItemSelected; // QuickInformation ExploitSelection = ExploitSelection.concat(".xml"); try { // Clean QuickInformation QuickInformation.setText(""); // Start de la clase main de XMLTreenode NewXMLNode.main(null, ExploitSelection); QuickInformation.append("Exploit Name: " + NewXMLNode.ExploitName + " "); QuickInformation.append("Author: " + NewXMLNode.Author + "\n"); QuickInformation.append("Type: " + NewXMLNode.ExploitType + "\n"); QuickInformation.append("CVE: " + NewXMLNode.Vulnerability + "\n"); QuickInformation.append("Disclosure Date: " + NewXMLNode.Date); QuickInformation.append(NewXMLNode.Information); // Set variables from XML ExploitModule = NewXMLNode.ExploitName; ExploitCodeName = NewXMLNode.CodeName; ExploitType = NewXMLNode.ExploitType; ExploitPlatform = NewXMLNode.Platform; Service = NewXMLNode.Service; AgentPort = NewXMLNode.ShellPort; TargetPort.setText(NewXMLNode.RemotePort); TargetLPort.setText(NewXMLNode.LocalPort); // Set shellcodes for comboshell // but first initialize combo :D ShellcodeCombo.removeAll(); ShellcodeCombo.setText("Select"); // Load available shellcodes if (NewXMLNode.ShellcodeAvailable.contains("R")) { ShellcodeCombo.add("Remote Shell"); } if (NewXMLNode.ShellcodeAvailable.contains("E")) { ShellcodeCombo.add("Execute Code"); } if (NewXMLNode.ShellcodeAvailable.contains("C")) { ShellcodeCombo.add("Command"); } if (NewXMLNode.ShellcodeAvailable.contains("L")) { ShellcodeCombo.add("Local Shell"); } } catch (Exception e2) { System.out.print("Sorry error parsing XML" + e2); } } } catch (Exception e2) { System.out.println(e2); } } }); btnLaunch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Reproduce the wav file when the module is launched try { // Instance a new sound clip Clip sound = AudioSystem.getClip(); // Open Wav file sound.open(AudioSystem.getAudioInputStream(new File("data/newagent.wav"))); // Start reproduction sound.start(); // Wait until it finished while (sound.isRunning()) Thread.sleep(2000); // Close stream sound.close(); } catch (Exception e2) { System.out.println(e); } if (ExploitSelection.equals("Exploits") || ExploitSelection.equals("Windows") || ExploitSelection.equals("BSD") || ExploitSelection.equals("Unix") || ExploitSelection.equals("Linux") || ExploitSelection.equals("Tools") || ExploitSelection.equals("Search") || ExploitSelection.equals("History")) { MessageBox messageBox = new MessageBox(shlExploitPack, SWT.ICON_ERROR | SWT.OK); messageBox.setMessage("Sorry, you have to choose a module to launch"); messageBox.setText("No Module Selected"); messageBox.open(); return; } // Check if shellcodecombobox has a shellcode selected if (!ExploitType.toString().equals("tool")) { if (ShellcodeCombo.getText().equals("Select")) { MessageBox messageBox = new MessageBox(shlExploitPack, SWT.ICON_ERROR | SWT.OK); messageBox.setMessage("Sorry, you have to choose a shellcode from available list"); messageBox.setText("No shellcode Selected"); messageBox.open(); return; } } // Obtain Python Path try { // Read file FileReader fstream = new FileReader("data/config/exploitpack.config"); BufferedReader in = new BufferedReader(fstream); pythonFullPath = in.readLine() + "\n"; System.out.print(pythonFullPath); // Close the output stream in.close(); } catch (Exception e1) { // Catch exception if any Preferences.main(null); System.err.println("Error: " + e1.getMessage()); } // Port Scanner ToDo: Add threads and signature detection // Try to make nmap work here, ensure Nmap license is compatible // with GPL v3 if (ExploitCodeName.equals("Remote-Scanner")) { // PortScanner junk code // TODO Make the scanner, this is just a test for (port = 1023; port <= 65000; port++) try { Socket socket = new Socket(); socket.bind(null); socket.connect(new InetSocketAddress(TargetHost.getText(), port), 140); socket.close(); System.out.println("PortAAA: " + port); // // Add Available Targets TreeItem NewTarget = new TreeItem(OpenPorts, SWT.NONE, 0); NewTarget.setText("Port: " + port); NewTarget .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/port.png")); OpenPorts.setExpanded(true); ports.add(port); } catch (IOException ex) { System.out.println(ex); } int portList = ports.size(); System.out.println("Total Ports: " + portList); // End PortScanner junk code return; } // Lauch the desire exploit Runtime RunModule = Runtime.getRuntime(); // Instance OSValidator OSValidator CheckOS = new OSValidator(); CheckOS.main(null); OSType = OSValidator.OSType; // Local VAR for ModuleType String RunModuleByType = null; // Local VAR Shellcode selected String ShellcodeSelected = null; // Shellcode remote shell if (ShellcodeCombo.getText().equals("Remote Shell")) { ShellcodeSelected = "R"; DebugLog.append("Shellcode selected" + ShellcodeCombo.getText()); } // Shellcode execute code if (ShellcodeCombo.getText().equals("Execute Code")) { ShellcodeSelected = "E"; DebugLog.append("Shellcode selected" + ShellcodeCombo.getText()); } // Shellcode command if (ShellcodeCombo.getText().equals("Command")) { ShellcodeSelected = "C"; DebugLog.append("Shellcode selected" + ShellcodeCombo.getText()); } // Shellcode local if (ShellcodeCombo.getText().equals("Local Shell")) { ShellcodeSelected = "L"; DebugLog.append("Shellcode selected" + ShellcodeCombo.getText()); } // Shellcode local if (ShellcodeCombo.getText().equals("Select") || ShellcodeCombo.getText().equals("")) { ShellcodeSelected = "N"; DebugLog.append("Shellcode selected" + ShellcodeCombo.getText()); } if (OSType.equals("Win")) { // Execute exploit WINDOWS DebugLog.append("I'm running in a windows system"); try { // Set exec options for remote if (ExploitType.equals("remote")) { RunModuleByType = "cmd.exe /T:0A /K start " + pythonFullPath + " \"exploits/code/" + ExploitCodeName + "\"" + " " + TargetHost.getText() + " " + TargetPort.getText() + " " + ShellcodeSelected; } // Set exec options for clientside if (ExploitType.equals("clientside")) { RunModuleByType = "cmd.exe /T:0A /K start python " + pythonFullPath + " \"exploits/code/" + ExploitCodeName + "\"" + " " + TargetLhost.getText() + " " + TargetLPort.getText() + " " + ShellcodeSelected; // Add location information to ShellcodeConsole ShellcodeConsole.append("=> New client-side exploit file created\n"); ShellcodeConsole.append("=> File located at: code/output/\n"); } // Set exec options for local if (ExploitType.equals("local")) { RunModuleByType = "cmd.exe /T:0A /K start " + pythonFullPath + " \"exploits/code/" + ExploitCodeName + "\"" + " " + TargetHost.getText() + " " + TargetPort.getText() + " " + ShellcodeSelected; } // Set exec options for remote if (ExploitType.equals("tool")) { RunModuleByType = "cmd.exe /T:0A /K start " + pythonFullPath + " \"exploits/code/" + ExploitCodeName + "\"" + " " + TargetHost.getText() + " " + TargetPort.getText(); } // Print output for exec string value DebugLog.append(RunModuleByType); // Finally exec module RunModule.exec(RunModuleByType); } catch (IOException e1) { System.out.println(e1); } } else if (OSType.equals("Unix")) { // Execute exploit LINUX try { // Set exec options for remote if (ExploitType.equals("remote")) { RunModuleByType = "python " + "\"exploits/code/" + ExploitCodeName + "\"" + " " + TargetHost.getText() + " " + TargetPort.getText() + " " + ShellcodeSelected; } // Set exec options for clientside if (ExploitType.equals("clientside")) { RunModuleByType = "python " + "\"exploits/code/" + ExploitCodeName + "\"" + " " + TargetLhost.getText() + " " + TargetLPort.getText() + " " + ShellcodeSelected; // Add location information to ShellcodeConsole ShellcodeConsole.append("=> New client-side exploit file created\n"); ShellcodeConsole.append("=> File located at: code/output/\n"); } // Set exec options for local if (ExploitType.equals("local")) { RunModuleByType = "python " + "\"exploits/code/" + ExploitCodeName + "\"" + " " + TargetHost.getText() + " " + TargetPort.getText() + " " + ShellcodeSelected; } // Print output for exec string value DebugLog.append(RunModuleByType); // Finally exec module RunModule.exec(RunModuleByType); System.out.println(RunModuleByType); } catch (IOException e1) { e1.printStackTrace(); } } else { DebugLog.append("This OS is not supported"); return; } // Add to shellcodeconsole if (!TargetHost.getText().equals("")) { if (ShellcodeCombo.getText().equals("Remote Shell")) { ShellcodeConsole.append("=> Connect to? " + "[" + TargetHost.getText() + "]\n"); ShellcodeConsole.append("=> [y/n]\n"); // Add Available Targets TreeItem NewTarget = new TreeItem(AvailableTargets, SWT.NONE, 0); NewTarget.setText(TargetHost.getText()); NewTarget.setImage(SWTResourceManager.getImage( MainWindow.class, "/resources/terminal.png")); AvailableTargets.setExpanded(true); } } // Add Log to modules log TreeItem ModulesModLog0 = new TreeItem(ModulesLog, SWT.NONE, 1); ModulesModLog0.setText(ExploitModule.toString()); ModulesModLog0.setImage(SWTResourceManager.getImage( MainWindow.class, "/resources/binary.png")); // Expand modules log ModulesLogNode.setExpanded(true); // Add Log to executed modules TreeItem ExecuteModLog0 = new TreeItem(ExecuteModulesNode, SWT.NONE, 0); ExecuteModLog0.setText("[" + LogTime + "]" + " " + "Beggining execution of: " + ExploitModule); ExecuteModLog0 .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/application.png")); TreeItem ExecuteModLog1 = new TreeItem(ExecuteModulesNode, SWT.NONE, 1); ExecuteModLog1.setText("[" + LogTime + "]" + " " + "Exploiting trough host: " + ipAddrStr); ExecuteModLog1.setImage(SWTResourceManager.getImage( MainWindow.class, "/resources/application.png")); TreeItem ExecuteModLog2 = new TreeItem(ExecuteModulesNode, SWT.NONE, 2); ExecuteModLog2.setText("[" + LogTime + "]" + " " + "Module launched: " + ExploitModule); ExecuteModLog2 .setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/application.png")); // Expand executed modules ExecuteModulesNode.setExpanded(true); } }); btnLaunch.setText("Launch"); TreeItem NodeExploits = new TreeItem(TreeExploits, SWT.NONE, 0); NodeExploits.setText("Exploits"); NodeExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); final TreeItem WindowsExploits = new TreeItem(NodeExploits, SWT.NONE, 0); WindowsExploits.setText("Windows"); WindowsExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); final TreeItem LinuxExploits = new TreeItem(NodeExploits, SWT.NONE, 1); LinuxExploits.setText("Linux"); LinuxExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); final TreeItem UnixExploits = new TreeItem(NodeExploits, 0, 2); UnixExploits.setText("Unix"); UnixExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); final TreeItem BSDExploits = new TreeItem(NodeExploits, 0, 3); BSDExploits.setText("BSD"); BSDExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); NodeExploits.setExpanded(true); TreeItem ToolList = new TreeItem(TreeExploits, SWT.NONE, 1); ToolList.setText("Tools"); ToolList.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/folder.png")); // TODO un-fix this values TreeItem PortScanner = new TreeItem(ToolList, SWT.NONE, 0); PortScanner.setText("Remote-Scanner"); PortScanner.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); TreeItem DenialOfService = new TreeItem(ToolList, SWT.NONE, 1); DenialOfService.setText("Denial-Of-Service"); DenialOfService.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); final TreeItem SearchExploits = new TreeItem(TreeExploits, SWT.NONE, 2); SearchExploits.setText("Search"); SearchExploits.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/modulesearch.png")); SearchExploits.setExpanded(true); final TreeItem SearchHistory = new TreeItem(TreeExploits, SWT.NONE, 3); SearchHistory.setText("History"); SearchHistory.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/history.png")); SearchHistory.setExpanded(true); // GENERO EL ARBOL String path = "exploits/"; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); QuickInformation.append("[" + LogTime + "] " + "Modules Successfully Loaded: Ok" + "\n"); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { files = listOfFiles[i].getName(); if (files.endsWith(".xml") || files.endsWith(".XML")) { // Instancio XMLTreenode XMLTreenode NewXMLNode = new XMLTreenode(); // Start de la clase main de XMLTreenode NewXMLNode.main(null, files); // Create tree item // Create Windows Exploits if (NewXMLNode.Platform.equals("windows")) { TreeItem ItemName = new TreeItem(WindowsExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } if (NewXMLNode.Platform.equals("linux")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(LinuxExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } // Create Unix Exploits if (NewXMLNode.Platform.equals("unix")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(UnixExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } // Create BSD Exploits if (NewXMLNode.Platform.equals("bsd")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(UnixExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage( SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } // Obtain total modules TotalModulesLength = i; // QuickInformation.append("[" + LogTime + "] "+ // NewXMLNode.ExploitName + " "); } } } QuickInformation.append("[" + LogTime + "] " + "Total Modules: " + TotalModulesLength); // REFRESH MODULES TREE mntmRefreshModules.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // GENERO EL ARBOL String path = "exploits/"; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { files = listOfFiles[i].getName(); if (files.endsWith(".xml") || files.endsWith(".XML")) { // Instancio XMLTreenode XMLTreenode NewXMLNode = new XMLTreenode(); // Start de la clase main de XMLTreenode NewXMLNode.main(null, files); // Create tree item // Create Windows Exploits if (NewXMLNode.Platform.equals("windows")) { TreeItem ItemName = new TreeItem(WindowsExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } if (NewXMLNode.Platform.equals("linux")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(LinuxExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } // Create Unix Exploits if (NewXMLNode.Platform.equals("unix")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(UnixExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } // Create BSD Exploits if (NewXMLNode.Platform.equals("bsd")) { // Create Linux Exploits TreeItem ItemName = new TreeItem(BSDExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); } } } } for (int PortNumber : OpenPortsList) { // Add Available Targets TreeItem NewTarget = new TreeItem(OpenPorts, SWT.NONE, 0); NewTarget.setText("Port: " + PortNumber); NewTarget.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/port.png")); OpenPorts.setExpanded(true); } } }); Composite SearchComposite = new Composite(shlExploitPack, SWT.NONE); FormData fd_SearchComposite = new FormData(); fd_SearchComposite.bottom = new FormAttachment(0, 89); fd_SearchComposite.top = new FormAttachment(0, 66); fd_SearchComposite.left = new FormAttachment(0, 10); SearchComposite.setLayoutData(fd_SearchComposite); formToolkit.adapt(SearchComposite); formToolkit.paintBordersFor(SearchComposite); final Label SearchImage = new Label(SearchComposite, SWT.NONE); SearchImage.setBounds(10, 6, 13, 13); SearchImage.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/search.gif")); formToolkit.adapt(SearchImage, true, true); // MODULE SEARCH SearchCombo = new Combo(SearchComposite, SWT.NONE); SearchCombo.setBounds(0, 1, 267, 21); SearchCombo.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { String SearchInput = SearchCombo.getText().toLowerCase(); // GENERO EL ARBOL String path = "exploits/"; String files; File folder = new File(path); File[] listOfFiles = folder.listFiles(); // Remove ALL SearchExploits.removeAll(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { files = listOfFiles[i].getName(); if (files.endsWith(".xml") || files.endsWith(".XML")) { // Instancio XMLTreenode XMLTreenode NewXMLNode = new XMLTreenode(); // Start de la clase main de XMLTreenode NewXMLNode.main(null, files); // Do nothing if search input contains word null if (SearchInput.toString().contains("null")) { SearchCombo.setText(" Sorry, try again"); SearchImage.setVisible(true); return; } // Condition for search if (NewXMLNode.ExploitName.equals(SearchInput) || NewXMLNode.Service.equals(SearchInput) || NewXMLNode.ExploitType.equals(SearchInput)) { // Create tree item TreeItem ItemName = new TreeItem(SearchExploits, SWT.NONE); ItemName.setText(NewXMLNode.ExploitName); ItemName.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); SearchExploits.setExpanded(true); // Create tree item TreeItem ItemName1 = new TreeItem(SearchHistory, SWT.NONE); ItemName1.setText(NewXMLNode.ExploitName); ItemName1.setImage(SWTResourceManager.getImage(MainWindow.class, "/resources/square_redS.gif")); SearchHistory.setExpanded(true); SearchCombo.setText(" Search Modules"); SearchImage.setVisible(true); } } } } } }); SearchCombo.setItems(new String[] { "Show All Services: Type", "Show by Port Number: 123 ", "Show by Type: Remote", "Show by Type: Local", "Show by Type: Client-Side" }); formToolkit.adapt(SearchCombo); formToolkit.paintBordersFor(SearchCombo); SearchCombo.setText(" Search Modules"); SearchCombo.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { SearchCombo.setText(""); SearchImage.setVisible(false); } }); txtModulesExplorer = new Text(shlExploitPack, SWT.BORDER); FormData fd_txtModulesExplorer = new FormData(); fd_txtModulesExplorer.right = new FormAttachment(0, 277); fd_txtModulesExplorer.top = new FormAttachment(0, 39); fd_txtModulesExplorer.left = new FormAttachment(0, 10); txtModulesExplorer.setLayoutData(fd_txtModulesExplorer); txtModulesExplorer.setBackground(SWTResourceManager.getColor(245, 245, 245)); txtModulesExplorer.setText("Modules Explorer"); } // Open Module public String OpenFile() { FileDialog fileDialog = new FileDialog(shlExploitPack, SWT.OPEN); fileDialog.setText("Open"); String codedir = "exploits/code"; fileDialog.setFilterPath(codedir); String[] filterExt = { "*.ep", "*.*" }; fileDialog.setFilterExtensions(filterExt); String selected = fileDialog.open(); if (selected == null) return null; // code here to open the file and display FileReader file = null; try { file = new FileReader(selected); } catch (FileNotFoundException e1) { MessageBox messageBox = new MessageBox(shlExploitPack, SWT.ICON_ERROR | SWT.OK); messageBox.setMessage("Could not open file."); messageBox.setText("Error"); messageBox.open(); return null; } BufferedReader fileInput = new BufferedReader(file); String text = null; StringBuffer sb = new StringBuffer(); try { do { if (text != null) sb.append(text + "\n"); } while ((text = fileInput.readLine()) != null); return sb.toString(); } catch (IOException e1) { MessageBox messageBox = new MessageBox(shlExploitPack, SWT.ICON_ERROR | SWT.OK); messageBox.setMessage("Could not write to file."); messageBox.setText("Error"); messageBox.open(); return null; } } }