├── javac-services.0.log.lck ├── .gitignore ├── src ├── org │ └── json │ │ ├── Source.txt │ │ ├── JSONString.java │ │ ├── JSONException.java │ │ ├── JSONPointerException.java │ │ ├── HTTPTokener.java │ │ ├── Property.java │ │ ├── JSONStringer.java │ │ ├── CookieList.java │ │ ├── README │ │ ├── HTTP.java │ │ ├── Cookie.java │ │ ├── JSONPointer.java │ │ ├── CDL.java │ │ ├── JSONWriter.java │ │ ├── XMLTokener.java │ │ ├── JSONTokener.java │ │ ├── XML.java │ │ └── JSONML.java ├── META-INF │ └── MANIFEST.MF └── pse_gui │ ├── ConnectEvent.java │ ├── JSON.java │ ├── UserRequestResponseHandler.java │ ├── ModuleRequestResponseHandler.java │ ├── LoginView.css │ ├── ServerResponse.java │ ├── ItemType.java │ ├── SSHInformations.java │ ├── MainView.css │ ├── MapTreeItem.java │ ├── PSEConstants.java │ ├── Field.java │ ├── Communication.java │ ├── TextUtils.java │ ├── PowershellEmpireInformations.java │ ├── UIMain.java │ ├── UserRequest.java │ ├── SharedCentralisedClass.java │ ├── LoginView.fxml │ ├── StagerRequestResponseHandler.java │ ├── ResponseHandler.java │ ├── Model.java │ ├── UIObjectCreator.java │ ├── SyntaxAnalyzer.java │ ├── RequestHandler.java │ ├── MainView.fxml │ ├── LoginView.java │ └── PowershellEmpireConnection.java ├── lib ├── jfxswt.jar ├── jsch-0.1.53.jar ├── controlsfx-8.40.10.jar └── controlsfx-8.40.12.jar ├── Builds └── EmpireGUI.jar ├── ScreenShots ├── LoginScreen.PNG ├── AfterTaskedAllAgents.PNG ├── RickAsciiModuleLoaded.PNG ├── GeneratingLauncherStager.PNG ├── LauncherStagerGenerated.PNG └── BadListenerNameErrorMessage.PNG ├── .project ├── .settings └── org.eclipse.jdt.core.prefs └── README.md /javac-services.0.log.lck: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | bin/ 3 | -------------------------------------------------------------------------------- /src/org/json/Source.txt: -------------------------------------------------------------------------------- 1 | https://github.com/stleary/JSON-java/blob/master/CDL.java -------------------------------------------------------------------------------- /lib/jfxswt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/lib/jfxswt.jar -------------------------------------------------------------------------------- /src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: pse_gui.UIMain 3 | 4 | -------------------------------------------------------------------------------- /Builds/EmpireGUI.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/Builds/EmpireGUI.jar -------------------------------------------------------------------------------- /lib/jsch-0.1.53.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/lib/jsch-0.1.53.jar -------------------------------------------------------------------------------- /lib/controlsfx-8.40.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/lib/controlsfx-8.40.10.jar -------------------------------------------------------------------------------- /lib/controlsfx-8.40.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/lib/controlsfx-8.40.12.jar -------------------------------------------------------------------------------- /ScreenShots/LoginScreen.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/LoginScreen.PNG -------------------------------------------------------------------------------- /ScreenShots/AfterTaskedAllAgents.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/AfterTaskedAllAgents.PNG -------------------------------------------------------------------------------- /ScreenShots/RickAsciiModuleLoaded.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/RickAsciiModuleLoaded.PNG -------------------------------------------------------------------------------- /ScreenShots/GeneratingLauncherStager.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/GeneratingLauncherStager.PNG -------------------------------------------------------------------------------- /ScreenShots/LauncherStagerGenerated.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/LauncherStagerGenerated.PNG -------------------------------------------------------------------------------- /ScreenShots/BadListenerNameErrorMessage.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tristandostaler/EmpireGUI/HEAD/ScreenShots/BadListenerNameErrorMessage.PNG -------------------------------------------------------------------------------- /src/pse_gui/ConnectEvent.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import javafx.event.Event; 3 | 4 | @SuppressWarnings({ "restriction", "serial" }) 5 | public class ConnectEvent extends Event { 6 | 7 | public ConnectEvent() { 8 | super(LoginView.CONNECT); 9 | // TODO Auto-generated constructor stub 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /src/pse_gui/JSON.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class JSON { 4 | private String jsonData; 5 | 6 | public JSON(String jsonData){ 7 | this.jsonData = jsonData; 8 | } 9 | 10 | public String getJSONFormatedData(){ 11 | return this.jsonData; 12 | } 13 | 14 | @Override 15 | public String toString(){ 16 | return this.jsonData; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/pse_gui/UserRequestResponseHandler.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class UserRequestResponseHandler extends ResponseHandler{ 4 | 5 | public UserRequestResponseHandler() { 6 | super(false); 7 | } 8 | @Override 9 | public void baseHandleResponse(ServerResponse serverResponse) { 10 | String s = serverResponse.getValue().toString(); 11 | System.out.println(s); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | EmpireGUI 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/pse_gui/ModuleRequestResponseHandler.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | public class ModuleRequestResponseHandler extends ResponseHandler{ 3 | 4 | public ModuleRequestResponseHandler() { 5 | super(false); 6 | } 7 | @Override 8 | public void baseHandleResponse(ServerResponse serverResponse) { 9 | String s = serverResponse.getValue().toString(); 10 | System.out.println(s); 11 | SharedCentralisedClass.getInstance().writeTextToLogArea(s); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/pse_gui/LoginView.css: -------------------------------------------------------------------------------- 1 | /*@import url("pse_gui.material-fx.css");*/ 2 | 3 | .bottomPane { 4 | -fx-padding: 20 10 10 10; 5 | -fx-spacing: 10; 6 | -fx-alignment: top-right; 7 | } 8 | 9 | .button { 10 | -fx-min-width: 70; 11 | } 12 | 13 | .checkBoxContainer { 14 | -fx-padding: 20 0 0 10; 15 | } 16 | 17 | .label{ 18 | -fx-padding: 10 0 0 0; 19 | } 20 | 21 | .mainContainer { 22 | -fx-padding: 10; 23 | -fx-spacing: 5; 24 | } 25 | 26 | .vbox{ 27 | -fx-padding: 0 10 0 10; 28 | } -------------------------------------------------------------------------------- /src/pse_gui/ServerResponse.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import java.util.Map; 3 | 4 | public class ServerResponse { 5 | 6 | /** 7 | * Possible values for the Object: 8 | * - String 9 | * - Int 10 | * - Float 11 | * - Boolean 12 | * - A Field object (As defined in the project) 13 | * - List (Where the object can be any of these object types) 14 | * - Map (Where the object can be any of these object types) 15 | */ 16 | private Map value; 17 | 18 | public ServerResponse(Map value){ 19 | this.value = value; 20 | } 21 | 22 | public Map getValue(){ 23 | return value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/pse_gui/ItemType.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public enum ItemType { 4 | MODULE, 5 | AGENT, 6 | STAGER, 7 | LISTENER, 8 | CREATE_LISTENER, 9 | REPORTING, 10 | LOGS; 11 | 12 | 13 | public String getStringValue() { 14 | switch (this) { 15 | case MODULE: 16 | return PSEConstants.MODULE_LIST_ENDPOINT; 17 | case AGENT: 18 | return PSEConstants.AGENT_LIST_ENDPOINT; 19 | case STAGER: 20 | return PSEConstants.STAGER_LIST_ENDPOINT; 21 | case LISTENER: 22 | return PSEConstants.LISTENER_LIST_ENDPOINT; 23 | default: 24 | throw new RuntimeException("Unknown value in ItemType."); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /src/org/json/JSONString.java: -------------------------------------------------------------------------------- 1 | package org.json; 2 | /** 3 | * The JSONString interface allows a toJSONString() 4 | * method so that a class can change the behavior of 5 | * JSONObject.toString(), JSONArray.toString(), 6 | * and JSONWriter.value(Object). The 7 | * toJSONString method will be used instead of the default behavior 8 | * of using the Object's toString() method and quoting the result. 9 | */ 10 | public interface JSONString { 11 | /** 12 | * The toJSONString method allows a class to produce its own JSON 13 | * serialization. 14 | * 15 | * @return A strictly syntactically correct JSON text. 16 | */ 17 | public String toJSONString(); 18 | } 19 | -------------------------------------------------------------------------------- /src/pse_gui/SSHInformations.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class SSHInformations { 4 | 5 | private String userName; 6 | private String password; 7 | private String host; 8 | private int port; 9 | 10 | public SSHInformations(){ 11 | 12 | } 13 | 14 | public String getUserName() { 15 | return userName; 16 | } 17 | public void setUserName(String userName) { 18 | this.userName = userName; 19 | } 20 | public String getPassword() { 21 | return password; 22 | } 23 | public void setPassword(String password) { 24 | this.password = password; 25 | } 26 | public String getHost() { 27 | return host; 28 | } 29 | public void setHost(String host) { 30 | this.host = host; 31 | } 32 | public int getPort() { 33 | return port; 34 | } 35 | public void setPort(int port) { 36 | this.port = port; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/pse_gui/MainView.css: -------------------------------------------------------------------------------- 1 | /*@import url("pse_gui.material-fx.css");*/ 2 | 3 | .boldLabel { 4 | -fx-font-weight: bold; 5 | } 6 | 7 | .bottomPane { 8 | -fx-padding: 5px; 9 | -fx-spacing: 10px; 10 | -fx-alignment: center; 11 | } 12 | 13 | .breadCrumbContainer { 14 | -fx-border-width: 0px 0px 1px 0px; 15 | -fx-border-color: #DADADA; 16 | -fx-padding: 10px; 17 | -fx-background-color: #FAFAFA; 18 | } 19 | 20 | .button-raised { 21 | -fx-min-width: 100px; 22 | /*-fx-background-color: #2196F3; 23 | -fx-text-fill: #FFFFFF;*/ 24 | } 25 | 26 | .container { 27 | -fx-padding: 5px; 28 | -fx-alignment: center; 29 | } 30 | 31 | .label, .boldLabel { 32 | -fx-padding: 5px; 33 | } 34 | 35 | .mainContainer { 36 | -fx-padding: 0 10 10 10; 37 | -fx-background-color: #FCFCFC; 38 | } 39 | 40 | .noBorderSplitPane { 41 | -fx-box-border: transparent; 42 | } 43 | 44 | .splitPane { 45 | } 46 | 47 | .topPane { 48 | -fx-padding: 10 0 10 0; 49 | -fx-spacing: 10px; 50 | -fx-alignment: bottom-right; 51 | } 52 | -------------------------------------------------------------------------------- /src/pse_gui/MapTreeItem.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import java.util.ArrayList; 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import javafx.scene.control.TreeItem; 7 | 8 | @SuppressWarnings("restriction") 9 | public class MapTreeItem extends TreeItem{ 10 | 11 | private HashMap map; 12 | 13 | public MapTreeItem(String name) { 14 | super(name); 15 | } 16 | 17 | public HashMap getMap() { 18 | return map; 19 | } 20 | 21 | public void setMap(HashMap map) { 22 | this.map = map; 23 | } 24 | 25 | @SuppressWarnings("unchecked") 26 | public ArrayList getFieldList(){ 27 | ArrayList fieldList = new ArrayList(); 28 | Map fieldMap = (Map)map.get("options"); 29 | if(fieldMap == null) 30 | return null; 31 | for(String item2 : fieldMap.keySet()){ 32 | if(fieldMap.get(item2) instanceof Field){ 33 | fieldList.add((Field)fieldMap.get(item2)); 34 | } 35 | } 36 | return fieldList; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/pse_gui/PSEConstants.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class PSEConstants { 4 | 5 | /* 6 | * All the endpoints 7 | */ 8 | public static final String MODULE_LIST_ENDPOINT = "modules"; 9 | public static final String AGENT_LIST_ENDPOINT = "agents"; 10 | public static final String STAGER_LIST_ENDPOINT = "stagers"; 11 | public static final String LISTENER_LIST_ENDPOINT = "listeners"; 12 | 13 | /* 14 | * Constants needed for the SyntaxAnalyzer. Represents all the keys that the values are needed in the Field object. 15 | */ 16 | public static final String FIELD_DESCRIPTION_KEY = "Description"; 17 | public static final String FIELD_REQUIRED_KEY = "Required"; 18 | public static final String FIELD_VALUE_KEY = "Value"; 19 | 20 | // Constant necessary to get the endpoint value from a Map containing the description of a module 21 | public static final String ENDPOINT_NAME_KEY = "Name"; 22 | 23 | public static final String MESSAGE_KEY = "msg"; 24 | public static final String ERROR_KEY = "error"; 25 | public static final String EXCEPTION_KEY = "Exception"; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/pse_gui/Field.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class Field { 4 | private String name, description, value; 5 | private Boolean required; 6 | 7 | public Field(String Name, String Description, String Value, Boolean Required){ 8 | this.name = Name; 9 | this.description = Description; 10 | if (Value != null && !Value.isEmpty()) 11 | this.value = Value; 12 | else 13 | this.value = ""; 14 | this.required = Required; 15 | } 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public String getDescription() { 22 | return description; 23 | } 24 | 25 | public String getValue() { 26 | return value; 27 | } 28 | 29 | public void setValue(String value) { 30 | this.value = value; 31 | } 32 | 33 | public boolean isRequired() { 34 | return required; 35 | } 36 | 37 | @Override 38 | public String toString(){ 39 | return "FIELD: name: \"" + name + "\", description: \"" + description + "\", value: \"" + (value == null ? "[null]":value) + "\", Required: " + required.toString(); 40 | } 41 | 42 | public Field copy(){ 43 | return new Field(name, description, value, required); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/pse_gui/Communication.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class Communication { 4 | 5 | public enum METHODS{ 6 | GET, 7 | POST, 8 | DELETE 9 | } 10 | 11 | private METHODS method; 12 | private String endPoint; 13 | private ResponseHandler responseHandlerCallback; 14 | private JSON json; 15 | 16 | public Communication(METHODS method, String endPoint, ResponseHandler responseHandlerCallback, JSON json){ 17 | this.method = method; 18 | this.endPoint = endPoint; 19 | this.endPoint = this.endPoint.replace("\\", "/"); 20 | if(this.endPoint.toCharArray()[0] == '/') 21 | this.endPoint = this.endPoint.substring(1); 22 | if(this.endPoint.startsWith("api/")) 23 | this.endPoint = this.endPoint.replace("api/", ""); 24 | this.responseHandlerCallback = responseHandlerCallback; 25 | this.json = json; 26 | } 27 | 28 | public METHODS getMethod(){ 29 | return this.method; 30 | } 31 | 32 | public String getEndPoint(){ 33 | return this.endPoint; 34 | } 35 | 36 | public ResponseHandler getCallBack(){ 37 | return this.responseHandlerCallback; 38 | } 39 | 40 | public JSON getJson(){ 41 | return this.json; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/org/json/JSONException.java: -------------------------------------------------------------------------------- 1 | package org.json; 2 | 3 | /** 4 | * The JSONException is thrown by the JSON.org classes when things are amiss. 5 | * 6 | * @author JSON.org 7 | * @version 2015-12-09 8 | */ 9 | public class JSONException extends RuntimeException { 10 | /** Serialization ID */ 11 | private static final long serialVersionUID = 0; 12 | 13 | /** 14 | * Constructs a JSONException with an explanatory message. 15 | * 16 | * @param message 17 | * Detail about the reason for the exception. 18 | */ 19 | public JSONException(final String message) { 20 | super(message); 21 | } 22 | 23 | /** 24 | * Constructs a JSONException with an explanatory message and cause. 25 | * 26 | * @param message 27 | * Detail about the reason for the exception. 28 | * @param cause 29 | * The cause. 30 | */ 31 | public JSONException(final String message, final Throwable cause) { 32 | super(message, cause); 33 | } 34 | 35 | /** 36 | * Constructs a new JSONException with the specified cause. 37 | * 38 | * @param cause 39 | * The cause. 40 | */ 41 | public JSONException(final Throwable cause) { 42 | super(cause.getMessage(), cause); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/pse_gui/TextUtils.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import javafx.scene.text.Font; 3 | import javafx.scene.text.Text; 4 | import javafx.scene.text.TextBoundsType; 5 | 6 | @SuppressWarnings("restriction") 7 | public class TextUtils { 8 | 9 | static final Text helper; 10 | static final double DEFAULT_WRAPPING_WIDTH; 11 | static final double DEFAULT_LINE_SPACING; 12 | static final String DEFAULT_TEXT; 13 | static final TextBoundsType DEFAULT_BOUNDS_TYPE; 14 | static { 15 | helper = new Text(); 16 | DEFAULT_WRAPPING_WIDTH = helper.getWrappingWidth(); 17 | DEFAULT_LINE_SPACING = helper.getLineSpacing(); 18 | DEFAULT_TEXT = helper.getText(); 19 | DEFAULT_BOUNDS_TYPE = helper.getBoundsType(); 20 | } 21 | 22 | public static double computeTextWidth(Font font, String text, double help0) { 23 | // Toolkit.getToolkit().getFontLoader().computeStringWidth(field.getText(), 24 | // field.getFont()); 25 | 26 | helper.setText(text); 27 | helper.setFont(font); 28 | 29 | helper.setWrappingWidth(0.0D); 30 | helper.setLineSpacing(0.0D); 31 | double d = Math.min(helper.prefWidth(-1.0D), help0); 32 | helper.setWrappingWidth((int) Math.ceil(d)); 33 | d = Math.ceil(helper.getLayoutBounds().getWidth()); 34 | 35 | helper.setWrappingWidth(DEFAULT_WRAPPING_WIDTH); 36 | helper.setLineSpacing(DEFAULT_LINE_SPACING); 37 | helper.setText(DEFAULT_TEXT); 38 | return d; 39 | } 40 | } -------------------------------------------------------------------------------- /src/pse_gui/PowershellEmpireInformations.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | 3 | public class PowershellEmpireInformations { 4 | 5 | private String userName; 6 | private String password; 7 | private String token; 8 | private boolean isTokenInstead; 9 | private String host; 10 | private int port; 11 | private boolean infoHasError = false; 12 | 13 | public PowershellEmpireInformations(){ 14 | setInfoHasError(false); 15 | } 16 | 17 | public String getUserName() { 18 | return userName; 19 | } 20 | public void setUserName(String userName) { 21 | this.userName = userName; 22 | } 23 | public String getPassword() { 24 | return password; 25 | } 26 | public void setPassword(String password) { 27 | this.password = password; 28 | } 29 | public String getToken() { 30 | return token; 31 | } 32 | public void setToken(String token) { 33 | this.token = token; 34 | } 35 | public boolean isTokenInstead(){ 36 | return isTokenInstead; 37 | } 38 | public void setIsTokenInstead(boolean isTokenInstead){ 39 | this.isTokenInstead = isTokenInstead; 40 | } 41 | public String getHost() { 42 | return host; 43 | } 44 | public void setHost(String host) { 45 | this.host = host; 46 | } 47 | public int getPort() { 48 | return port; 49 | } 50 | public void setPort(int port) { 51 | this.port = port; 52 | } 53 | 54 | public boolean isInfoHasError() { 55 | return infoHasError; 56 | } 57 | 58 | public void setInfoHasError(boolean infoHasError) { 59 | this.infoHasError = infoHasError; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/org/json/JSONPointerException.java: -------------------------------------------------------------------------------- 1 | package org.json; 2 | 3 | /* 4 | Copyright (c) 2002 JSON.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | The Software shall be used for Good, not Evil. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | 27 | /** 28 | * The JSONPointerException is thrown by {@link JSONPointer} if an error occurs 29 | * during evaluating a pointer. 30 | * 31 | * @author JSON.org 32 | * @version 2016-05-13 33 | */ 34 | public class JSONPointerException extends JSONException { 35 | private static final long serialVersionUID = 8872944667561856751L; 36 | 37 | public JSONPointerException(String message) { 38 | super(message); 39 | } 40 | 41 | public JSONPointerException(String message, Throwable cause) { 42 | super(message, cause); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/pse_gui/UIMain.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import javafx.application.Application; 3 | import javafx.event.EventHandler; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Parent; 6 | import javafx.scene.Scene; 7 | import javafx.stage.Stage; 8 | import javafx.stage.WindowEvent; 9 | 10 | 11 | @SuppressWarnings("restriction") 12 | public class UIMain extends Application { 13 | 14 | private MainView mainController; 15 | 16 | public MainView getMainController() { 17 | return mainController; 18 | } 19 | 20 | @Override 21 | public void start(Stage primaryStage) throws Exception { 22 | 23 | initializeView(primaryStage); 24 | 25 | // Disconnect from PowershellEmpireConnection if necessary. 26 | primaryStage.setOnCloseRequest(new EventHandler() { 27 | 28 | @Override 29 | public void handle(WindowEvent event) { 30 | if(mainController != null) { 31 | mainController.disconnectDoAction(); 32 | } 33 | } 34 | }); 35 | 36 | SharedCentralisedClass.getInstance().setMainView(mainController); 37 | 38 | Model model = new Model(); 39 | RequestHandler handler = new RequestHandler(); 40 | 41 | handler.setMainController(mainController); 42 | handler.setModel(model); 43 | 44 | mainController.setRequestHandler(handler); 45 | mainController.setModel(model); 46 | 47 | } 48 | 49 | private void initializeView(Stage primaryStage) throws Exception { 50 | FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainView.fxml")); 51 | Parent root = fxmlLoader.load(); 52 | mainController = fxmlLoader.getController(); 53 | primaryStage.setTitle("PowerShell GUI"); 54 | Scene scene = new Scene(root, 1024, 768); 55 | scene.getStylesheets().add("pse_gui/MainView.css"); 56 | primaryStage.setScene(scene); 57 | primaryStage.show(); 58 | } 59 | 60 | public static void main(String[] args) { 61 | launch(args); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/pse_gui/UserRequest.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | // How should we know that RpxWeakStub was modified ? 3 | // We know that its field target was modified via the field associated to it. 4 | // But I have no clue on how to know that RpxWeakStub was the modified module/agent/stagger ? 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class UserRequest { 10 | private List fieldList; 11 | private String endpoint; 12 | private Communication.METHODS method; 13 | private ItemType type; 14 | 15 | public UserRequest(Communication.METHODS method, List fieldList, ItemType type, Map objectMap){ 16 | this.method = method; 17 | this.type = type; 18 | if (fieldList == null) 19 | this.fieldList = new ArrayList(); 20 | else 21 | this.fieldList = fieldList; 22 | this.endpoint = type.getStringValue() + "/" + getEndpoint(objectMap); 23 | } 24 | 25 | public UserRequest(Communication.METHODS method, List fieldList, ItemType type){ 26 | this.method = method; 27 | this.type = type; 28 | if (fieldList == null) 29 | this.fieldList = new ArrayList(); 30 | else 31 | this.fieldList = fieldList; 32 | this.endpoint = type.getStringValue(); 33 | } 34 | 35 | public UserRequest(Communication.METHODS method, List fieldList, ItemType type, String endpoint){ 36 | this.method = method; 37 | this.type = type; 38 | if (fieldList == null) 39 | this.fieldList = new ArrayList(); 40 | else 41 | this.fieldList = fieldList; 42 | this.endpoint = endpoint; 43 | } 44 | 45 | private String getEndpoint(Map objectMap){ 46 | Object value = objectMap.get(PSEConstants.ENDPOINT_NAME_KEY); 47 | if (value instanceof String) 48 | return (String)value; 49 | else 50 | throw new RuntimeException("Invalid value in UserRequest.getEndpoint(). Expected a string."); 51 | } 52 | 53 | 54 | public void addField(Field field){ 55 | this.fieldList.add(field); 56 | } 57 | 58 | public List getFieldList(){ 59 | return this.fieldList; 60 | } 61 | 62 | public Field getFieldFromName(String name){ 63 | for(Field f : this.getFieldList()){ 64 | if(f.getName().equals(name)) 65 | return f; 66 | } 67 | return null; 68 | } 69 | 70 | public String getEndpoint(){ 71 | return this.endpoint; 72 | } 73 | 74 | public Communication.METHODS getMethod(){ 75 | return method; 76 | } 77 | 78 | public ItemType getType(){ 79 | return this.type; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/pse_gui/SharedCentralisedClass.java: -------------------------------------------------------------------------------- 1 | package pse_gui; 2 | import java.io.PrintWriter; 3 | import java.io.StringWriter; 4 | import java.util.ArrayList; 5 | 6 | public class SharedCentralisedClass { 7 | 8 | private static SharedCentralisedClass instance; 9 | 10 | private MainView mainView; 11 | private String queuedOutputLogArea = ""; 12 | private ArrayList queuedStackTraceList = new ArrayList(); 13 | 14 | private SharedCentralisedClass(){ 15 | } 16 | 17 | public static SharedCentralisedClass getInstance(){ 18 | if(instance == null) 19 | instance = new SharedCentralisedClass(); 20 | return instance; 21 | } 22 | 23 | public void setMainView(MainView mainView){ 24 | this.mainView = mainView; 25 | synchronized(queuedOutputLogArea) { 26 | if(!queuedOutputLogArea.isEmpty()) { 27 | this.mainView.writeTextToLogArea(queuedOutputLogArea); 28 | queuedOutputLogArea = ""; 29 | } 30 | } 31 | synchronized(queuedStackTraceList) { 32 | for(StackTraceQueueObject sto : queuedStackTraceList){ 33 | this.mainView.showStackTraceInAlertWindow(sto.getMessage(), sto.getTrace()); 34 | } 35 | queuedStackTraceList.clear(); 36 | } 37 | } 38 | 39 | public void writeTextToLogArea(String text){ 40 | if(this.mainView != null) 41 | this.mainView.writeTextToLogArea(text); 42 | else 43 | synchronized(queuedOutputLogArea) { 44 | System.out.println(text); 45 | queuedOutputLogArea += text + "\n"; 46 | } 47 | } 48 | 49 | public void showStackTraceInAlertWindow(String message, String trace){ 50 | System.out.println("Exception: " + message + "\nTrace: " + trace); 51 | if(this.mainView != null) 52 | this.mainView.showStackTraceInAlertWindow(message, trace); 53 | else { 54 | synchronized(queuedStackTraceList) { 55 | queuedStackTraceList.add(new StackTraceQueueObject(message, trace)); 56 | } 57 | } 58 | 59 | } 60 | 61 | public void showStackTraceInAlertWindow(String message, Exception e){ 62 | StringWriter sw = new StringWriter(); 63 | PrintWriter pw = new PrintWriter(sw); 64 | e.printStackTrace(pw); 65 | e.printStackTrace(); 66 | showStackTraceInAlertWindow(message, sw.toString()); 67 | } 68 | 69 | private class StackTraceQueueObject{ 70 | private String message; 71 | private String trace; 72 | public StackTraceQueueObject(String message, String trace){ 73 | this.message = message; 74 | this.trace = trace; 75 | } 76 | public String getMessage(){ 77 | return message; 78 | } 79 | public String getTrace(){ 80 | return trace; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/pse_gui/LoginView.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 57 | 58 | 59 | 60 | 61 | 64 | 65 | 68 | 69 | 70 | 71 | 72 |