Development Guide

Extension

Valid PETEP extension is any JAR file that contains package "petep" with class "PetepExtension" that extends the Extension class and implements all the abstract methods.

Attributes

Path
Contains path to the extension JAR file.
Code
Extension code has to be unique for the project, so choose is wisely. (Characters recommended: A-Za-z0-9-_.)
Name
Name of the extension displayed to the user.
Description
Description of the extension displayed to the user.
Version
Version of your extension.

Methods

void init(ExtensionHelper helper)
Extension should be initalized inside this method - registration of modules etc.
void initGui(GuiHelper helper)
Extension GUI should be initialized inside this method - creation of tabs etc.

Extension class

com.warxim.petep.extension.Extension
/*
 * PEnetration TEsting Proxy (PETEP)
 * 
 * Copyright (C) 2020 Michal Válka
 *
 * 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 of the
 * License, or (at your option) 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 <https://www.gnu.org/licenses/>.
 */
/** Superclass for extensions. */
@PetepAPI
public abstract class Extension {
  /** Path where the extension .jar file is located. */
  protected final String path;

  public Extension(String path) {
    this.path = path;
  }

  public final String getPath() {
    return path;
  }

  /** Initializes the extension. */
  public abstract void init(ExtensionHelper helper);

  /** Initializes the extension GUI. */
  public abstract void initGui(GuiHelper helper);

  public abstract String getCode();

  public abstract String getName();

  public abstract String getDescription();

  public abstract String getVersion();
}

Before & After initialization

If you want to take some action before or after initalization, you can implement the following interfaces into your extension class (you can use this, for example, to add rule factories to Tagger/Modifier before it initializes):

ExtensionInitListener interface

com.warxim.petep.extension.ExtensionInitListener
/*
 * PEnetration TEsting Proxy (PETEP)
 * 
 * Copyright (C) 2020 Michal Válka
 *
 * 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 of the
 * License, or (at your option) 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 <https://www.gnu.org/licenses/>.
 */
@PetepAPI
public interface ExtensionInitListener {
  /** Runs before extensions are initialized. */
  void beforeInit(ExtensionHelper helper);

  /** Runs after extensions are initialized. */
  void afterInit(ExtensionHelper helper);
}

ExtensionGuiInitListener interface

com.warxim.petep.extension.ExtensionGuiInitListener
/*
 * PEnetration TEsting Proxy (PETEP)
 * 
 * Copyright (C) 2020 Michal Válka
 *
 * 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 of the
 * License, or (at your option) 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 <https://www.gnu.org/licenses/>.
 */
@PetepAPI
public interface ExtensionGuiInitListener {
  /** Runs before extension GUIs are initialized. */
  void beforeInitGui(GuiHelper helper);

  /** Runs after extension GUIs are initialized. */
  void afterInitGui(GuiHelper helper);
}

These methods will be automatically called if you implement these interfaces.

Získejte registraci domén s tld .online, .space, .store, .tech zdarma!
Stačí si k jedné z těchto domén vybrat hosting Plus nebo Mega a registraci domény od nás dostanete za 0 Kč!
Objednat