Skip to content

Commit

Permalink
Merge pull request #4 from cyal1/single-logConsole
Browse files Browse the repository at this point in the history
update
  • Loading branch information
cyal1 authored Sep 7, 2024
2 parents 8b44c19 + 771fb84 commit fd199e8
Show file tree
Hide file tree
Showing 48 changed files with 1,126 additions and 594 deletions.
166 changes: 166 additions & 0 deletions README-ZH.md

Large diffs are not rendered by default.

173 changes: 151 additions & 22 deletions README.md

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ dependencies {
compileOnly 'net.portswigger.burp.extensions:montoya-api:2023.12.1'
// compileOnly files('/Users/test/Downloads/montoya-api-2023.9.jar')
implementation 'org.mozilla:rhino:1.7.14'
implementation 'org.json:json:20230227'
implementation 'org.json:json:20231013'
implementation 'com.fifesoft:rsyntaxtextarea:3.3.3'
compileOnly 'org.python:jython-standalone:2.7.3'
implementation 'org.python:jython-standalone:2.7.3'
runtimeOnly 'io.grpc:grpc-netty-shaded:1.54.1'
implementation 'io.grpc:grpc-protobuf:1.54.1'
implementation 'io.grpc:grpc-stub:1.54.1'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.7.2'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.41.2.2'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
implementation "com.github.kklisura.cdt:cdt-java-client:4.0.0"
}

jar {
Expand All @@ -31,5 +32,5 @@ jar {
}
}

sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
Binary file removed images/BcryptMontoya.png
Binary file not shown.
Binary file removed images/BcryptMontoya1.png
Binary file not shown.
Binary file removed images/contextMenu.png
Binary file not shown.
Binary file removed images/contextMenu1.png
Binary file not shown.
Binary file removed images/grpc.png
Binary file not shown.
Binary file added images/pyburp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 0 additions & 72 deletions src/main/java/io/github/cyal1/bcryptmontoya/BcryptMontoya.java

This file was deleted.

93 changes: 0 additions & 93 deletions src/main/java/io/github/cyal1/bcryptmontoya/BcryptMontoyaTabs.java

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/io/github/cyal1/bcryptmontoya/Tools.java

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package io.github.cyal1.bcryptmontoya;
package io.github.cyal1.pyburp;

import burp.api.montoya.core.ByteArray;
import com.google.protobuf.*;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;

import static io.github.cyal1.pyburp.PyBurpTabs.logTextArea;

public class CallFuncClient {
private final ManagedChannel channel;
Expand All @@ -15,7 +19,7 @@ public CallFuncClient(String host, int port) {
this.blockingStub = CallFuncServiceGrpc.newBlockingStub(channel);
}

public Object callFunc(String funcName, Object... args){
public Object callFunc(String funcName, Object... args) {
// https://protobuf.dev/reference/protobuf/google.protobuf/#string-value
Burpextender.Request.Builder requestBuilder = Burpextender.Request.newBuilder().setFuncName(funcName);
for (Object arg : args) {
Expand All @@ -29,10 +33,12 @@ public Object callFunc(String funcName, Object... args){
param = Any.pack(DoubleValue.of((double) arg));
}else if (arg instanceof Boolean) {
param = Any.pack(BoolValue.newBuilder().setValue((Boolean) arg).build());
}else if (arg instanceof byte[]) {
param = Any.pack(BytesValue.newBuilder().setValue(ByteString.copyFrom((byte[])arg)).build());
}else if (arg instanceof ByteArray) {
param = Any.pack(BytesValue.newBuilder().setValue(ByteString.copyFrom(((ByteArray) arg).getBytes())).build());
}else if (arg instanceof byte[]){
param = Any.pack(BytesValue.newBuilder().setValue(ByteString.copyFrom((byte[]) arg)).build());
}else{
System.out.println(arg.getClass().getName() + " param type not support, return empty.");
logTextArea.append(arg.getClass().getName() + " param type not support. \n");
param = Any.newBuilder().setValue(ByteString.empty()).build();
}
requestBuilder.addArgs(param);
Expand All @@ -43,7 +49,11 @@ public Object callFunc(String funcName, Object... args){
try {
Burpextender.Response response = blockingStub.callFunc(request);
result = response.getRes();
if(result.is(StringValue.class)){
if (result.is(ListValue.class)){
return null;
}if (result.getSerializedSize() == 0){
return null;
}else if(result.is(StringValue.class)){
return result.unpack(StringValue.class).getValue();
}else if(result.is(Int64Value.class)){
return result.unpack(Int64Value.class).getValue();
Expand All @@ -52,13 +62,14 @@ public Object callFunc(String funcName, Object... args){
}else if(result.is(BoolValue.class)){
return result.unpack(BoolValue.class).getValue();
}else if(result.is(BytesValue.class)){
return result.unpack(BytesValue.class).getValue();
return result.unpack(BytesValue.class).getValue().toByteArray();
}else{
throw new RuntimeException("unexcept type returned, only allowed StringValue,Int64Value,DoubleValue,BoolValue,BytesValue");
}
} catch (StatusRuntimeException e) {
throw new RuntimeException(e.getStatus().toString());
} catch (Exception e){
BcryptMontoya.Api.logging().logToError(e.getMessage());
throw new RuntimeException(e.getMessage());
throw new RuntimeException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.cyal1.bcryptmontoya;
package io.github.cyal1.pyburp;

import static io.grpc.MethodDescriptor.generateFullMethodName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.cyal1.bcryptmontoya;
package io.github.cyal1.pyburp;

import javax.swing.*;
import javax.swing.border.Border;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.cyal1.bcryptmontoya;
package io.github.cyal1.pyburp;

import burp.api.montoya.core.ToolType;
import burp.api.montoya.http.message.ContentType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.cyal1.bcryptmontoya;
package io.github.cyal1.pyburp;

import org.json.JSONObject;
import org.json.JSONTokener;
Expand All @@ -25,7 +25,7 @@ public class ContentTypeConverter {
public ContentTypeConverter() {
context = Context.enter();
scope = context.initStandardObjects();
String jsCode = Tools.readFromInputStream(BcryptMontoya.class.getResourceAsStream("/qs.js"));
String jsCode = Tools.readFromInputStream(PyBurp.class.getResourceAsStream("/qs.js"));
context.evaluateString(scope, jsCode, "JavaScript", 1, null);
}
public String queryString2JSON(String qs){
Expand Down
Loading

0 comments on commit fd199e8

Please sign in to comment.