Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tatac1 committed Oct 6, 2016
0 parents commit 9986a55
Show file tree
Hide file tree
Showing 47 changed files with 4,011 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.vscode/*
target/*
*.log
target/
.classpath
.project
.settings/

20 changes: 20 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

## Build

```
mvn clean compile assembly:single
```

## Debug

To Set Debug Mode:
locate log4j.properties where json-pretty-n.n.n-SNAPSHOT.jar located,

change the file following
````
log4j.rootLogger = INFO, A1
````
to
````
log4j.rootLogger = DEBUG, A1
````
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# pretty-json for burpsuite

pretty-json is a Java Extension plugin for Burp Suite that can be used to view JSON file format for humans

###*License*

pretty-json is released under the [Apache 2.0 license](LICENSE).

```
Copyright 2016 Cyber Defense Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
73 changes: 73 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.cyberdefense.burp</groupId>
<artifactId>pretty-json</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>pretty-json</name>
<description>a pretty json printer for burpsuite</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-sample-jar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<organization>
<name>Cyber Defense Institute</name>
<url>https://www.cyberdefense.jp/</url>
</organization>
<url>https://github.com/CyberDefenseInstitute/burp-pretty-json</url>
<scm>
<url>https://github.com/CyberDefenseInstitute/burp-pretty-json.git</url>
</scm>
<issueManagement>
<url>https://github.com/CyberDefenseInstitute/burp-pretty-json/issues</url>
</issueManagement>
</project>
Binary file not shown.
54 changes: 54 additions & 0 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package burp;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import jp.cyberdefense.burp.json.PrettyJsonTab;
import burp.IBurpExtender;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IMessageEditorController;
import burp.IMessageEditorTab;
import burp.IMessageEditorTabFactory;


public class BurpExtender implements IBurpExtender, IMessageEditorTabFactory {
static Logger log = Logger.getLogger(BurpExtender.class.toString());
private IBurpExtenderCallbacks callbacks;
private IExtensionHelpers helpers;

public IMessageEditorTab createNewInstance(
IMessageEditorController controller, boolean editable) {
Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();

PropertyConfigurator.configure(s + "/log4j.properties");

log.debug("create a new instance of PrettyJsonTab");

return new PrettyJsonTab(controller, editable,callbacks, helpers);

}

public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
// keep a reference to our callbacks object
this.callbacks = callbacks;
log.debug("keep a reference to our callbacks object");

// obtain an extension helpers object
helpers = callbacks.getHelpers();
log.debug("obtain an extension helpers object");

// set our extension name
callbacks.setExtensionName("Pretty print JSON editor");
log.debug("set our extension name");

// register ourselves as a message editor tab factory
callbacks.registerMessageEditorTabFactory(this);
log.debug("register ourselves as a message editor tab factory");
}

}
31 changes: 31 additions & 0 deletions src/main/java/burp/IBurpExtender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package burp;

/*
* @(#)IBurpExtender.java
*
* Copyright PortSwigger Ltd. All rights reserved.
*
* This code may be used to extend the functionality of Burp Suite Free Edition
* and Burp Suite Professional, provided that this usage does not violate the
* license terms for those products.
*/
/**
* All extensions must implement this interface.
*
* Implementations must be called BurpExtender, in the package burp, must be
* declared public, and must provide a default (public, no-argument)
* constructor.
*/
public interface IBurpExtender
{
/**
* This method is invoked when the extension is loaded. It registers an
* instance of the
* <code>IBurpExtenderCallbacks</code> interface, providing methods that may
* be invoked by the extension to perform various actions.
*
* @param callbacks An
* <code>IBurpExtenderCallbacks</code> object.
*/
void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks);
}
Loading

0 comments on commit 9986a55

Please sign in to comment.