Skip to content

Commit

Permalink
Initial commit - PETEP v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Warxim committed Aug 1, 2020
0 parents commit 26ea0e3
Show file tree
Hide file tree
Showing 388 changed files with 26,744 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Gradle
.gradle
# Eclipse, ...
.settings
bin
build
doc
# Testing
ext/**
projects
.project
petep.json
.classpath
src/test/**

!ext/README.txt
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

## [1.2.1] - 2020-05-31
### Added
- version checks
- small bugfixes

## [1.2.0] - 2020-04-15
### Added
- encoding (charsets)
- new byte editor with charset support
- SAST, refactoring
### Removed
- old byte editor

## [1.1.0] - 2020-04-15
### Added
- bugfixes
- performance improvements
675 changes: 675 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# PETEP - PEnetration TEsting Proxy
PETEP is open-source Java application for network communication proxying for the purpose of penetration testing.

Currently PETEP supports primarily TCP (with SSL/TLS support).

You can find out more about PETEP on the following website: http://petep.warxim.com/

## Using PETEP with tools for HTTP
PETEP allows you to use your favorite tools for web penetration testing (like Burp, Zap etc.) for non-HTTP traffic.

See http://petep.warxim.com/user-guide/#external-http-proxy.

## Extensibility
It is possible to develop extensions using Java to implement support for new protocols and/or to implement new functionality.

For more information about extension development, please see http://petep.warxim.com/dev-guide/.

## License
PETEP is licensed under GNU GPL 3.0.
135 changes: 135 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* PETEP Gradle Build
*/

plugins {
id 'java-library'
id 'java'
id 'eclipse'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
id "org.sonarqube" version "2.8"
}

repositories {
jcenter()
}

javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.web' ]
}

dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'

testImplementation('org.junit.jupiter:junit-jupiter:5.4.2')
}

// UTF-8 encoding
compileJava.options.encoding = 'UTF-8'

mainClassName='com.warxim.petep.Main'

// Copy extensions from their build/libs/ to projects ext/
task copyExtensions (type: Copy, dependsOn: gradle.includedBuilds*.task(':jar')) {
into 'ext/'

gradle.includedBuilds.each { build ->
println 'Moving extension "' + build.rootDirectory + '" to ext/ directory.'
from build.rootDirectory.path + '/build/libs/'
}
}

// Run task
run {
if (gradle.ext.wizard) {
args = []
} else {
if (gradle.GUI) {
args = [gradle.ext.testProjectDirectory]
} else {
args = [gradle.ext.testProjectDirectory, "--nogui"]
}
}
dependsOn gradle.includedBuilds*.task(':jar'), copyExtensions
}

// Export com.sun.javafx.css (for css editing)
application {
applicationDefaultJvmArgs = [
"--add-opens=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED"
]
}

// Create jar library for extensions
task petepLibJar(type: Jar) {
println "Creating jar library"
includes = includedFiles(sourceSets.main.allSource.files)
baseName = "PetepLib"
with jar
}

// Create fat jar
jar {
from(sourceSets.main.output) {
println "Creating fat jar"
manifest {
attributes 'Main-Class': "$mainClassName"
}
baseName = 'PETEP'
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
duplicatesStrategy = 'exclude'
}

// Include only @PetepAPI classes to jar
def includedFiles(Collection<File> files) {
List<String> included = new ArrayList<>()
files.each { file ->
if (file.isDirectory()) {
excludedFiles(Arrays.asList(file.listFiles()))
} else {
if (file.text.contains("@PetepAPI") || file.text.contains("<!-- PetepAPI -->")) {
String temp = projectDir.toURI().relativize(
file.toURI()).toString()
.replace(".java", ".class")
.replace("src/main/java/", "")
.replace("src/main/resources/", "")
included += temp
println "- including: " + temp
}
}
}
return included
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

distributions {
main {
contents {
exclude 'PETEP', 'PETEP.bat'

from("LICENSE.md") {
into ""
}

from(petepLibJar) {
into "api"
}

from("ext") {
into "ext"
}

from("project_template") {
into "project_template"
}
}
}
}
1 change: 1 addition & 0 deletions ext/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
It is recommended to place your extensions into this directory.
1 change: 1 addition & 0 deletions project_template/conf/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is default PETEP project template.
27 changes: 27 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* PETEP Gradle Settings
*/

rootProject.name = 'PETEP'

// If "gradle.ext.wizard" is set to "false", gradle "Run" will run PETEP with project (gradle.ext.testProjectDirectory) automatically.
gradle.ext.wizard = true

// If GUI is set to "false", gradle "Run" will run PETEP without GUI.
gradle.ext.GUI = true

// Path to project to open automatically when "gradle.ext.wizard" is set to "false".
gradle.ext.testProjectDirectory = './projects/test_project'

// Include external extensions to gradle build?
gradle.ext.extensions = false

// Path to extensions to automatically include (useful for extension development).
gradle.ext.extensionsDirectory = '../petep_extensions/'

// Include extensions
if (gradle.ext.extensions) {
file(gradle.ext.extensionsDirectory).eachDir { f ->
includeBuild f.path
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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/>.
*/
package com.warxim.booleanexpressioninterpreter;

/** Logical AND expression. */
public final class AndExpression implements Expression {
private final Expression left;
private final Expression right;

public AndExpression(Expression left, Expression right) {
this.left = left;
this.right = right;
}

@Override
public boolean solve() {
return left.solve() && right.solve();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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/>.
*/
package com.warxim.booleanexpressioninterpreter;

import java.util.function.BiPredicate;

/**
* BiPredicate expression uses BiPredicate for solve method. Result of BiPredicate is cached until
* new parameters are provided.
*/
public class BiPredicateExpression<T, U> implements Expression {
private final BiPredicate<T, U> predicate;

private boolean value;
private boolean cached;
private T firstParameter;
private U secondParameter;

public BiPredicateExpression(BiPredicate<T, U> predicate) {
this.predicate = predicate;
cached = false;
}

public BiPredicateExpression(BiPredicate<T, U> function, T firstParam, U secondParam) {
this(function);
firstParameter = firstParam;
secondParameter = secondParam;
}

public void setParams(T firstParam, U secondParam) {
firstParameter = firstParam;
secondParameter = secondParam;
cached = false;
}

@Override
public boolean solve() {
if (cached) {
return value;
}

cached = true;
value = predicate.test(firstParameter, secondParameter);

return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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/>.
*/
package com.warxim.booleanexpressioninterpreter;

/** Expression interface. */
@FunctionalInterface
public interface Expression {
/** Method returning result of expression. */
boolean solve();
}
Loading

0 comments on commit 26ea0e3

Please sign in to comment.