Skip to content

Commit

Permalink
Client: code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Bennetts <psiinon@gmail.com>
  • Loading branch information
psiinon committed Dec 11, 2024
1 parent b6f72f2 commit 276bad4
Show file tree
Hide file tree
Showing 41 changed files with 107 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.parosproxy.paros.Constant;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedEvent;
import org.zaproxy.addon.client.internal.ReportedObject;

public class ClientHistoryTableModel extends AbstractTableModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
import org.parosproxy.paros.network.HttpHeader;
import org.parosproxy.paros.network.HttpMessage;
import org.parosproxy.paros.network.HttpRequestHeader;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideComponent;
import org.zaproxy.addon.client.internal.ClientSideDetails;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedEvent;
import org.zaproxy.zap.extension.api.API;
import org.zaproxy.zap.extension.api.ApiAction;
import org.zaproxy.zap.extension.api.ApiException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.parosproxy.paros.Constant;
import org.zaproxy.addon.client.internal.ClientSideComponent;

public class ComponentTableModel extends AbstractTableModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,29 @@
import org.parosproxy.paros.model.SiteNode;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.impl.ClientZestRecorder;
import org.zaproxy.addon.client.internal.ClientMap;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideComponent;
import org.zaproxy.addon.client.internal.ClientSideDetails;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedEvent;
import org.zaproxy.addon.client.internal.ReportedObject;
import org.zaproxy.addon.client.pscan.ClientPassiveScanController;
import org.zaproxy.addon.client.pscan.ClientPassiveScanHelper;
import org.zaproxy.addon.client.pscan.OptionsPassiveScan;
import org.zaproxy.addon.client.spider.ClientSpider;
import org.zaproxy.addon.client.spider.ClientSpiderDialog;
import org.zaproxy.addon.client.spider.PopupMenuSpider;
import org.zaproxy.addon.client.ui.ClientDetailsPanel;
import org.zaproxy.addon.client.ui.ClientHistoryPanel;
import org.zaproxy.addon.client.ui.ClientMapPanel;
import org.zaproxy.addon.client.ui.PopupMenuClientAttack;
import org.zaproxy.addon.client.ui.PopupMenuClientCopyUrls;
import org.zaproxy.addon.client.ui.PopupMenuClientDelete;
import org.zaproxy.addon.client.ui.PopupMenuClientDetailsCopy;
import org.zaproxy.addon.client.ui.PopupMenuClientHistoryCopy;
import org.zaproxy.addon.client.ui.PopupMenuClientOpenInBrowser;
import org.zaproxy.addon.client.ui.PopupMenuClientShowInSites;
import org.zaproxy.addon.network.ExtensionNetwork;
import org.zaproxy.zap.ZAP;
import org.zaproxy.zap.eventBus.Event;
Expand All @@ -75,9 +92,9 @@ public class ExtensionClientIntegration extends ExtensionAdaptor {

private static final String FIREFOX_PROFILES_INI = "profiles.ini";

protected static final String PREFIX = "client";
public static final String PREFIX = "client";

protected static final String RESOURCES = "resources";
public static final String RESOURCES = "resources";

private static final Logger LOGGER = LogManager.getLogger(ExtensionClientIntegration.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.parosproxy.paros.network.HttpRequestHeader;
import org.parosproxy.paros.network.HttpSender;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideDetails;
import org.zaproxy.zap.eventBus.Event;
import org.zaproxy.zap.model.SessionStructure;
import org.zaproxy.zap.model.StructuralNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import java.util.Comparator;
import java.util.HashMap;
Expand All @@ -27,6 +27,7 @@
import javax.swing.tree.TreeNode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.zap.ZAP;
import org.zaproxy.zap.eventBus.Event;
import org.zaproxy.zap.eventBus.EventPublisher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import java.util.Objects;
import net.sf.json.JSONObject;
import org.parosproxy.paros.Constant;
import org.zaproxy.addon.client.ExtensionClientIntegration;

public class ClientSideComponent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import net.sf.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import net.sf.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.internal;

import java.util.Date;
import net.sf.json.JSONObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.parosproxy.paros.core.scanner.Alert;
import org.parosproxy.paros.core.scanner.Alert.Source;
import org.zaproxy.addon.client.ReportedObject;
import org.zaproxy.addon.client.internal.ReportedObject;

public abstract class ClientPassiveAbstractScanRule implements ClientPassiveScanRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.zaproxy.addon.client.pscan;

import org.zaproxy.addon.client.ReportedObject;
import org.zaproxy.addon.client.internal.ReportedObject;
import org.zaproxy.zap.extension.alert.ExampleAlertProvider;

public interface ClientPassiveScanRule extends ExampleAlertProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.core.scanner.Alert;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.ReportedElement;
import org.zaproxy.addon.client.ReportedObject;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedObject;

public class InformationInStorageScanRule extends ClientPassiveAbstractScanRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.core.scanner.Alert;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.ReportedElement;
import org.zaproxy.addon.client.ReportedObject;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedObject;

public class JwtInStorageScanRule extends ClientPassiveAbstractScanRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.parosproxy.paros.core.scanner.Alert;
import org.parosproxy.paros.model.HistoryReference;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.ReportedElement;
import org.zaproxy.addon.client.ReportedObject;
import org.zaproxy.addon.client.internal.ReportedElement;
import org.zaproxy.addon.client.internal.ReportedObject;

public class SensitiveInfoInStorageScanRule extends ClientPassiveAbstractScanRule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
import org.openqa.selenium.WebDriver;
import org.parosproxy.paros.control.Control;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.ClientMap;
import org.zaproxy.addon.client.ClientNode;
import org.zaproxy.addon.client.ClientOptions;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ClientMap;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.zap.ZAP;
import org.zaproxy.zap.eventBus.Event;
import org.zaproxy.zap.eventBus.EventConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
Expand All @@ -29,6 +29,9 @@
import javax.swing.JScrollPane;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.AbstractPanel;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideComponent;
import org.zaproxy.zap.view.LayoutHelper;

public class ClientDetailsPanel extends AbstractPanel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.Component;
import java.awt.GridBagLayout;
Expand All @@ -35,6 +35,9 @@
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.AbstractPanel;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.ClientHistoryTableModel;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ReportedObject;
import org.zaproxy.zap.utils.FontUtils;
import org.zaproxy.zap.view.LayoutHelper;
import org.zaproxy.zap.view.ZapTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.Component;
import java.awt.GridBagConstraints;
Expand All @@ -36,6 +36,9 @@
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.AbstractPanel;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ClientMap;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.zap.view.LayoutHelper;

@SuppressWarnings("serial")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.Component;
import java.awt.FlowLayout;
Expand All @@ -26,6 +26,9 @@
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideDetails;
import org.zaproxy.zap.utils.DisplayUtils;
import org.zaproxy.zap.view.OverlayIcon;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.BorderLayout;
import java.awt.Component;
Expand All @@ -33,6 +33,10 @@
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.AbstractPanel;
import org.parosproxy.paros.view.View;
import org.zaproxy.addon.client.ComponentTableModel;
import org.zaproxy.addon.client.ExtensionClientIntegration;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.addon.client.internal.ClientSideComponent;
import org.zaproxy.zap.view.ZapTable;

public class ClientNodeDetailsPanel extends AbstractPanel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.Component;
import java.util.List;
import javax.swing.JTree;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.extension.ExtensionPopupMenuItem;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.zap.extension.ExtensionPopupMenu;

public class PopupMenuClientAttack extends ExtensionPopupMenu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.event.ActionEvent;
import org.parosproxy.paros.Constant;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.internal.ClientNode;

public class PopupMenuClientCopyUrls extends PopupMenuItemClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.event.ActionEvent;
import java.util.function.Function;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.internal.ClientSideComponent;

@SuppressWarnings("serial")
public class PopupMenuClientDetailsCopy extends PopupMenuItemClientDetails {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.event.ActionEvent;
import java.util.function.Function;
import org.zaproxy.addon.client.ClientUtils;
import org.zaproxy.addon.client.internal.ReportedObject;

@SuppressWarnings("serial")
public class PopupMenuClientHistoryCopy extends PopupMenuItemClientHistory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zaproxy.addon.client;
package org.zaproxy.addon.client.ui;

import java.awt.Component;
import java.util.List;
import javax.swing.JTree;
import org.parosproxy.paros.Constant;
import org.parosproxy.paros.control.Control;
import org.zaproxy.addon.client.internal.ClientNode;
import org.zaproxy.zap.extension.ExtensionPopupMenu;
import org.zaproxy.zap.extension.selenium.Browser;
import org.zaproxy.zap.extension.selenium.ExtensionSelenium;
Expand Down
Loading

0 comments on commit 276bad4

Please sign in to comment.