Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
source committed Aug 29, 2018
1 parent 389c35f commit 4128a93
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
Binary file modified release/BigIpDiscover.jar
Binary file not shown.
17 changes: 7 additions & 10 deletions src/burp/BigIpDecrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import java.nio.ByteOrder;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -52,7 +49,7 @@ private BigIpDecrypt() {
}

public static List<BigIpDecrypt> parseMessage(boolean messageIsRequest, byte[] messageByte) {
List<BigIpDecrypt> decryptList = new ArrayList<>();
List<BigIpDecrypt> list = new ArrayList<>();
String message = Util.getRawStr(messageByte);
String cookieAll = null;
int cookieOffset = 0;
Expand All @@ -63,22 +60,22 @@ public static List<BigIpDecrypt> parseMessage(boolean messageIsRequest, byte[] m
while (m.find()) {
cookieOffset = m.start(1);
cookieAll = m.group(1);
decryptList.addAll(parseDecryptList(messageIsRequest, cookieAll, cookieOffset));
list.addAll(parseDecryptList(messageIsRequest, cookieAll, cookieOffset));
}
} else {
// Set-Cookieの取得
Matcher m = RESPONSE_COOKE.matcher(message);
while (m.find()) {
cookieOffset = m.start(1);
cookieAll = m.group(1);
decryptList.addAll(parseDecryptList(messageIsRequest, cookieAll, cookieOffset));
list.addAll(parseDecryptList(messageIsRequest, cookieAll, cookieOffset));
}
}
return decryptList;
return list;
}

protected static List<BigIpDecrypt> parseDecryptList(boolean messageIsRequest, String cookieAll, int cookieOffset) {
List<BigIpDecrypt> decryptList = new ArrayList<>();
List<BigIpDecrypt> list = new ArrayList<>();
if (cookieAll != null) {
Matcher m = BIGIP_COOKIE.matcher(cookieAll);
while (m.find()) {
Expand All @@ -94,11 +91,11 @@ protected static List<BigIpDecrypt> parseDecryptList(boolean messageIsRequest, S
bigIP.encryptCookie = cookieValue;
bigIP.startPos = cookieOffset + m.start();
bigIP.endPos = cookieOffset + m.end();
decryptList.add(bigIP);
list.add(bigIP);
}
}
}
return decryptList;
return list;
}

/*
Expand Down
1 change: 0 additions & 1 deletion src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package burp;

import burp.signature.BigIPCookie;
import extend.util.BurpWrap;
import extend.util.ConvertUtil;
import extend.util.IpUtil;
import extend.view.base.MatchItem;
Expand Down
2 changes: 1 addition & 1 deletion src/burp/release.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BigIP Discover build xml properties

# version
version=1.1.1
version=1.1.2
projname=BigIpDiscover
9 changes: 4 additions & 5 deletions src/burp/signature/BigIPCookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import burp.BigIpDecrypt;
import burp.BurpExtender;
import static burp.BurpExtenderImpl.getCallbacks;
import burp.IHttpRequestResponse;
import burp.IHttpRequestResponseWithMarkers;
import burp.IHttpService;
Expand All @@ -26,7 +25,7 @@
*
* @author isayan
*/
public class BigIPCookie implements Signature<BigIpDecrypt> {
public class BigIPCookie implements Signature<List<BigIpDecrypt>> {

private final OptionProperty option;

Expand Down Expand Up @@ -74,9 +73,9 @@ public List<IScanIssue> makeIssueList(boolean messageIsRequest, IHttpRequestResp
}
IHttpRequestResponseWithMarkers messageInfoMark = null;
if (messageIsRequest) {
messageInfoMark = getCallbacks().applyMarkers(baseRequestResponse, requestResponseMarkers, null);
messageInfoMark = BurpExtender.getCallbacks().applyMarkers(baseRequestResponse, requestResponseMarkers, null);
} else {
messageInfoMark = getCallbacks().applyMarkers(baseRequestResponse, null, requestResponseMarkers);
messageInfoMark = BurpExtender.getCallbacks().applyMarkers(baseRequestResponse, null, requestResponseMarkers);
}

if (markIPList.size() > 0) {
Expand Down Expand Up @@ -111,7 +110,7 @@ public IScanIssue makeScanIssue(IHttpRequestResponse messageInfo, List<BigIpDecr
return new IScanIssue() {
@Override
public URL getUrl() {
IRequestInfo reqInfo = getCallbacks().getHelpers().analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest());
IRequestInfo reqInfo = BurpExtender.getCallbacks().getHelpers().analyzeRequest(messageInfo.getHttpService(), messageInfo.getRequest());
return reqInfo.getUrl();
}

Expand Down
2 changes: 1 addition & 1 deletion src/burp/signature/Signature.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public interface Signature<M> {

public IScanIssue makeScanIssue(final IHttpRequestResponse messageInfo, final List<M> list);
public IScanIssue makeScanIssue(final IHttpRequestResponse messageInfo, final M issue);

public IScannerCheck passiveScanCheck();

Expand Down

0 comments on commit 4128a93

Please sign in to comment.