Skip to content

Commit

Permalink
v0.9.5 release
Browse files Browse the repository at this point in the history
bugfix: * RequestList selection does not reflect to Request(RequestEditor) pane.
        * when Add2MacroBuilder menu execute, selected language does not reflect to RequestList
  • Loading branch information
gdgd009xcd committed Jul 27, 2020
1 parent bde4790 commit 2fe0b63
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion addOns/automacrobuilder/automacrobuilder.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.zaproxy.gradle.addon.AddOnStatus

version = "0.9.4"
version = "0.9.5"
description = "AutoMacroBuilder for ZAP"

tasks.withType<JavaCompile> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ public PRequestResponse(
init(h, p, ssl, binrequest, binresponse, pageenc, pageenc);
}

public PRequestResponse(ClientDependMessageContainer cdmc) {
public PRequestResponse(ClientDependMessageContainer cdmc, Encode defaultenc) {
this.cdmc = cdmc;
init(
cdmc.getHost(),
cdmc.getPort(),
cdmc.isSSL(),
cdmc.getRequestByte(),
cdmc.getResponseByte(),
cdmc.getRequestEncode(),
cdmc.getResponseEncode());
cdmc.getRequestEncode() != null ? cdmc.getRequestEncode() : defaultenc,
cdmc.getResponseEncode() != null ? cdmc.getResponseEncode() : defaultenc);
}

public void setClientDependMessageContainer(ClientDependMessageContainer cdmc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,16 @@ public int getCurrentSelectedRequestIndex(){
}

public StyledDocumentWithChunk getMacroRequestStyledDocument() {
int pos = getCurrentSelectedRequestIndex();
if (pos < 0 || pos != selected_request_idx) {
logger4j.error(
"getMacroRequestStyledDocument pos["
+ pos
+ "]!=selected_request_idx["
+ selected_request_idx + "]");
return null;
}
MacroRequestLoadContents();
StyledDocument doc = MacroRequest.getStyledDocument();
if ( doc instanceof StyledDocumentWithChunk) {
return CastUtils.castToType(doc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ public class PopUpItemActiveScan extends JMenuItem {

addActionListener(
ev -> {
int pos = this.mbui.getCurrentSelectedRequestIndex();

if (pos > -1) {
PRequest newrequest = ZapUtil.getPRequestFromMacroRequest(this.mbui);
PRequest newrequest = ZapUtil.getPRequestFromMacroRequest(this.mbui);
if (newrequest != null) {
int pos = this.mbui.getCurrentSelectedRequestIndex();
ParmGenMacroTraceParams targetStepNo = new ParmGenMacroTraceParams(pos);
this.extension.setTargetStepNo(targetStepNo);
ParmGenMacroTrace pmt = this.mbui.getParmGenMacroTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ public class PopUpItemSingleSend extends JMenuItem {
addActionListener(
e -> {
PRequest newrequest = ZapUtil.getPRequestFromMacroRequest(f_mbui);
int pos = f_mbui.getCurrentSelectedRequestIndex();
HttpMessage htmess = ZapUtil.getHttpMessage(newrequest);

final ParmGenMacroTraceParams pmtParams = new ParmGenMacroTraceParams(pos);

if (htmess != null) {
if (newrequest != null) {
int pos = f_mbui.getCurrentSelectedRequestIndex();
final HttpMessage htmess = ZapUtil.getHttpMessage(newrequest);
final ParmGenMacroTraceParams pmtParams = new ParmGenMacroTraceParams(pos);
final Thread t =
new Thread(
new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class PopupMenuAdd2MacroBuilder extends PopupMenuItemHistoryReferenceCont
private ParmGenMacroTrace pmt = null;
private MacroBuilderUI mbui = null;
private List<PRequestResponse> listprr = null;
private List<HistoryReference> hrefs = null;

/** @param label */
public PopupMenuAdd2MacroBuilder(MacroBuilderUI mbui, ParmGenMacroTrace pmt, String label) {
Expand All @@ -50,15 +51,19 @@ public void performAction(HistoryReference href) {}

@Override
protected void performHistoryReferenceActions(List<HistoryReference> hrefs) {
hrefs.stream()
this.hrefs = hrefs;
this.hrefs.stream()
.forEach(
href -> {
System.out.println("" + href.toString());
});

this.listprr =
hrefs.stream()
.map(href -> new PRequestResponse(new ClientDependMessageContainer(href)))
.map(
href ->
new PRequestResponse(
new ClientDependMessageContainer(href), null))
.collect(Collectors.toList());

if (pmt.getRlistCount() <= 0) {
Expand All @@ -74,6 +79,15 @@ protected void performHistoryReferenceActions(List<HistoryReference> hrefs) {

@Override
public void LangOK() {
// selected encode applied to PRequestResponses.
this.listprr =
this.hrefs.stream()
.map(
href ->
new PRequestResponse(
new ClientDependMessageContainer(href),
ParmVars.enc))
.collect(Collectors.toList());
mbui.addNewRequests(this.listprr);
langdialog.setVisible(false);
}
Expand Down

0 comments on commit 2fe0b63

Please sign in to comment.