diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0b1a7a1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 raise-isayan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Readme-ja.md b/Readme-ja.md index 7633687..47aec3b 100644 --- a/Readme-ja.md +++ b/Readme-ja.md @@ -92,8 +92,8 @@ gradlew release ``` ## 必須ライブラリ -ビルドには別途 [BurpExtLib](https://github.com/raise-isayan/BurpExtLib) のライブラリを必要とします。 -* BurpExtlib v2.1.2.0 +ビルドには別途 [BurpExtensionCommons](https://github.com/raise-isayan/BurpExtensionCommons) のライブラリを必要とします。 +* BurpExtensionCommons v0.4.1.0 ### 利用ライブラリ diff --git a/Readme.md b/Readme.md index 7f55f8e..45215d5 100644 --- a/Readme.md +++ b/Readme.md @@ -88,9 +88,9 @@ PrivateIP: true gradlew release ``` -## Required libraries -Build requires a separate library of [BurpExtLib](https://github.com/raise-isayan/BurpExtLib). -* BurpExtlib v2.1.2.1 +## Required library +Building requires a [BurpExtensionCommons](https://github.com/raise-isayan/BurpExtensionCommons) library. +* BurpExtensionCommons v0.4.1.0 ## Use Library * google gson (https://github.com/google/gson) diff --git a/build.gradle b/build.gradle index 456102a..237e817 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,8 @@ repositories { jcenter() } -sourceCompatibility = '1.8' // -source -targetCompatibility = '1.8' // -target +sourceCompatibility = '11' // -source +targetCompatibility = '11' // -target mainClassName = 'passive.BigIPDiscover' @@ -37,7 +37,7 @@ jar { manifest { attributes 'Main-Class': mainClassName } - + from { configurations.runtimeClasspath.filter{ it.exists() }.collect { it.isDirectory() ? it : zipTree(it) } } diff --git a/gradle.properties b/gradle.properties index 98897b4..9de8ed3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -netbeans.org-netbeans-modules-javascript2-requirejs.enabled=true -release_version_major=1.7 -release_version_minor=4.1 +netbeans.org-netbeans-modules-javascript2-requirejs.enabled=true +release_version_major=1.8 +release_version_minor=0.0 diff --git a/libs/BurpExtensionCommons-v0.4.1.0.jar b/libs/BurpExtensionCommons-v0.4.1.0.jar new file mode 100644 index 0000000..fd01139 Binary files /dev/null and b/libs/BurpExtensionCommons-v0.4.1.0.jar differ diff --git a/libs/BurpExtlib-v2.1.2.1.jar b/libs/BurpExtlib-v2.1.2.1.jar deleted file mode 100644 index c0718b5..0000000 Binary files a/libs/BurpExtlib-v2.1.2.1.jar and /dev/null differ diff --git a/release/BigIPDiscover-v1.7.jar b/release/BigIPDiscover-v1.8.jar similarity index 59% rename from release/BigIPDiscover-v1.7.jar rename to release/BigIPDiscover-v1.8.jar index 1e1cf82..15a9bd3 100644 Binary files a/release/BigIPDiscover-v1.7.jar and b/release/BigIPDiscover-v1.8.jar differ diff --git a/src/main/java/burp/BurpExtender.java b/src/main/java/burp/BurpExtender.java index 8f8401c..88dc1d0 100644 --- a/src/main/java/burp/BurpExtender.java +++ b/src/main/java/burp/BurpExtender.java @@ -1,13 +1,13 @@ package burp; +import extension.burp.BurpExtenderImpl; +import extension.burp.NotifyType; import passive.Config; import passive.OptionProperty; import passive.signature.BigIPCookieProperty; import passive.IOptionProperty; import passive.signature.BigIPCookieTab; import passive.signature.BigIPCookie; -import extend.util.IpUtil; -import extend.view.base.MatchItem; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -27,14 +27,14 @@ public class BurpExtender extends BurpExtenderImpl implements IBurpExtender, IHt private final static Logger logger = Logger.getLogger(BurpExtender.class.getName()); private final File CONFIG_FILE = new File(Config.getExtensionHomeDir(), Config.getExtensionFile()); - + private final BigIPCookieTab tabbetOption = new BigIPCookieTab(); static { File logDir = Config.getExtensionHomeDir(); logDir.mkdirs(); } - + public static BurpExtender getInstance() { return BurpExtenderImpl.getInstance(); } @@ -101,7 +101,7 @@ public void freePassiveScan(IHttpRequestResponse messageInfo) { } // Request判定 if (property.getScanRequest() && messageInfo.getRequest() != null) { - bigIpList.addAll(bigip.parseMessage(true, messageInfo.getRequest())); + bigIpList.addAll(bigip.parseMessage(true, messageInfo.getRequest())); } StringBuilder buff = new StringBuilder(); for (int i = 0; i < bigIpList.size(); i++) { @@ -119,10 +119,10 @@ public void freePassiveScan(IHttpRequestResponse messageInfo) { buff.append(item.getIPAddr()); } if (buff.length() > 0) { - if (property.getNotifyTypes().contains(MatchItem.NotifyType.ITEM_HIGHLIGHT)) { + if (property.getNotifyTypes().contains(NotifyType.ITEM_HIGHLIGHT)) { messageInfo.setHighlight(property.getHighlightColor().toString()); } - if (this.getProperty().getBigIPCookieProperty().getNotifyTypes().contains(MatchItem.NotifyType.COMMENT)) { + if (this.getProperty().getBigIPCookieProperty().getNotifyTypes().contains(NotifyType.COMMENT)) { messageInfo.setComment(buff.toString()); } } diff --git a/src/main/java/extend/util/external/JsonUtil.java b/src/main/java/extend/util/external/JsonUtil.java deleted file mode 100644 index 46d7730..0000000 --- a/src/main/java/extend/util/external/JsonUtil.java +++ /dev/null @@ -1,207 +0,0 @@ -package extend.util.external; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; -import extend.util.Util; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; - -/** - * - * @author isayan - */ -public class JsonUtil { - - public static boolean validJson(String jsonElementString) { - try { - JsonParser.parseString(jsonElementString); - return true; - } - catch (JsonSyntaxException ex) { - return false; - } - } - - public static String stringify(JsonElement jsonElement) { - return prettyJson(jsonElement, false); - } - - public static JsonElement parse(String jsonElementString) throws JsonSyntaxException { - return JsonParser.parseString(jsonElementString); - } - - public static String prettyJson(String jsonString) throws IOException { - return prettyJson(jsonString, true); - } - - public static String prettyJson(String jsonElementString, boolean pretty) throws JsonSyntaxException { - return prettyJson(parse(jsonElementString), pretty); - } - - public static String prettyJson(JsonElement jsonElement, boolean pretty) { - if (pretty) { - Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().serializeNulls().create(); - return gson.toJson(jsonElement); - } else { - Gson gson = new GsonBuilder().disableHtmlEscaping().serializeNulls().create(); - return gson.toJson(jsonElement); - } - } - - public static DefaultTreeModel toTreeNodeModel(String rootName) { - DefaultMutableTreeNode rootJson = new DefaultMutableTreeNode(rootName); - DefaultTreeModel model = new DefaultTreeModel(rootJson); - return model; - } - - public static DefaultTreeModel toJsonTreeModel(JsonElement jsonElement) { - return toJsonTreeModel(jsonElement, "JSON"); - } - - public static DefaultTreeModel toJsonTreeModel(JsonElement jsonElement, String rootName) { - DefaultMutableTreeNode rootJson = new DefaultMutableTreeNode(rootName); - DefaultTreeModel model = new DefaultTreeModel(rootJson); - toJsonTreeNode(jsonElement, rootJson); - return model; - } - - public static DefaultTreeModel toJsonTreeModel(JsonpElement jsonpElement) { - DefaultMutableTreeNode rootJson = new DefaultMutableTreeNode("JSONP"); - DefaultTreeModel model = new DefaultTreeModel(rootJson); - rootJson.add(new DefaultMutableTreeNode(jsonpElement.getCallbackName() + "()")); - toJsonTreeNode(jsonpElement.getJsonElement(), rootJson); - return model; - } - - private static void toJsonTreeNode(JsonElement jsonElement, DefaultMutableTreeNode parentNode) { - if (jsonElement.isJsonObject()) { -// DefaultMutableTreeNode node = new DefaultMutableTreeNode("{}"); -// parentNode.add(node); - DefaultMutableTreeNode node = parentNode; - JsonObject jsonObject = (JsonObject) jsonElement; - Set> set = jsonObject.entrySet(); - for (Map.Entry s : set) { - JsonElement value = s.getValue(); - if (value.isJsonNull()) { - DefaultMutableTreeNode jsonKeySet = new DefaultMutableTreeNode(s); - node.add(jsonKeySet); - } else if (value.isJsonPrimitive()) { - DefaultMutableTreeNode jsonKeySet = new DefaultMutableTreeNode(s); - node.add(jsonKeySet); - } else { - DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(s.getKey()); - node.add(childNode); - toJsonTreeNode(value, childNode); - } - } - } else if (jsonElement.isJsonArray()) { - JsonArray jsonArray = (JsonArray) jsonElement.getAsJsonArray(); - for (int i = 0; i < jsonArray.size(); i++) { - JsonElement value = jsonArray.get(i); - toJsonTreeNode(value, parentNode); - } - } else if (jsonElement.isJsonNull()) { - DefaultMutableTreeNode jsonKeySet = new DefaultMutableTreeNode(jsonElement); - parentNode.add(jsonKeySet); - } else if (jsonElement.isJsonPrimitive()) { - DefaultMutableTreeNode jsonKeySet = new DefaultMutableTreeNode(jsonElement); - parentNode.add(jsonKeySet); - } - - } - - private final static Pattern JSON_TYPE = Pattern.compile("[\\s\r\n]*((\\[(.*)\\])|(\\{(.*)\\}))[\\s\r\n]*", Pattern.DOTALL); - - public static boolean isJson(String jsonString) { - Matcher m = JSON_TYPE.matcher(jsonString); - if (m.lookingAt()) { - return JsonUtil.validJson(jsonString); - } else { - return false; - } - } - - public static boolean isJsonp(String jsonpString) { - try { - JsonpElement.parseJsonp(jsonpString); - return true; - } - catch (JsonSyntaxException ex) { - return false; - } - } - - private static final Map, Object> typeAdapterMap = new HashMap<>(); - - public static void registerTypeHierarchyAdapter(Class baseType, Object typeAdapter) { - typeAdapterMap.put(baseType, typeAdapter); - } - - public static void removeTypeHierarchyAdapter(Class baseType) { - typeAdapterMap.remove(baseType); - } - - public static void saveToJson(File fo, Object bean, boolean exludeFields) throws IOException { - GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls(); - for (Map.Entry, Object> set : typeAdapterMap.entrySet()) { - gsonBuilder.registerTypeHierarchyAdapter(set.getKey(), set.getValue()); - } - if (exludeFields) { - gsonBuilder = gsonBuilder.excludeFieldsWithoutExposeAnnotation(); - } - Gson gson = gsonBuilder.create(); - String jsonString = gson.toJson(bean); - Util.bytesToFile(Util.encodeMessage(jsonString, StandardCharsets.UTF_8), fo); - } - - public static T loadFromJson(File fi, Class classOfT, boolean exludeFields) throws IOException { - GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls(); - for (Map.Entry, Object> set : typeAdapterMap.entrySet()) { - gsonBuilder.registerTypeHierarchyAdapter(set.getKey(), set.getValue()); - } - if (exludeFields) { - gsonBuilder = gsonBuilder.excludeFieldsWithoutExposeAnnotation(); - } - Gson gson = gsonBuilder.create(); - String jsonString = Util.decodeMessage(Util.bytesFromFile(fi), StandardCharsets.UTF_8); - return gson.fromJson(jsonString, classOfT); - } - - public static String jsonToString(Object bean, boolean exludeFields) { - GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls(); - for (Map.Entry, Object> set : typeAdapterMap.entrySet()) { - gsonBuilder.registerTypeHierarchyAdapter(set.getKey(), set.getValue()); - } - if (exludeFields) { - gsonBuilder = gsonBuilder.excludeFieldsWithoutExposeAnnotation(); - } - Gson gson = gsonBuilder.create(); - return gson.toJson(bean); - } - - public static T jsonFromString(String jsonString, Class classOfT, boolean exludeFields) { - GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls(); - for (Map.Entry, Object> set : typeAdapterMap.entrySet()) { - gsonBuilder.registerTypeHierarchyAdapter(set.getKey(), set.getValue()); - } - if (exludeFields) { - gsonBuilder = gsonBuilder.excludeFieldsWithoutExposeAnnotation(); - } - Gson gson = gsonBuilder.create(); - return gson.fromJson(jsonString, classOfT); - } - -} diff --git a/src/main/java/extend/util/external/JsonpElement.java b/src/main/java/extend/util/external/JsonpElement.java deleted file mode 100644 index ed22788..0000000 --- a/src/main/java/extend/util/external/JsonpElement.java +++ /dev/null @@ -1,59 +0,0 @@ -package extend.util.external; - -import com.google.gson.JsonElement; -import com.google.gson.JsonSyntaxException; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * - * @author isayan - */ -public class JsonpElement { - - private JsonpElement() { - } - - private final static Pattern JSONP_TYPE = Pattern.compile("\\s*([\\w\\$\\.]+)\\s*\\(\\s*(\\{.*?\\}|\\[.*?\\])\\s*\\)([;]*)", Pattern.DOTALL); - - public static JsonpElement parseJsonp(String jsonpString) throws JsonSyntaxException { - Matcher m = JSONP_TYPE.matcher(jsonpString); - if (m.lookingAt()) { - JsonpElement jsonp = new JsonpElement(); - jsonp.raw = m.group(0); - jsonp.callbackName = m.group(1); - jsonp.jsonElement = JsonUtil.parse(m.group(2)); - return jsonp; - } - throw new JsonSyntaxException("jsonp invalid format"); - } - - private String raw; - - public String getRaw() { - return raw; - } - - private String callbackName; - - public String getCallbackName() { - return callbackName; - } - - private JsonElement jsonElement; - - public JsonElement getJsonElement() { - return jsonElement; - } - - public String pretty() throws IOException { - StringBuilder buff = new StringBuilder(); - buff.append(callbackName); - buff.append("(\n"); - buff.append(JsonUtil.prettyJson(jsonElement, true)); - buff.append("\n)"); - return buff.toString(); - } - -} diff --git a/src/main/java/passive/BigIPDiscover.java b/src/main/java/passive/BigIPDiscover.java index 8cc2366..46c9402 100644 --- a/src/main/java/passive/BigIPDiscover.java +++ b/src/main/java/passive/BigIPDiscover.java @@ -1,80 +1,80 @@ -package passive; - -import burp.BurpExtender; -import extend.util.IpUtil; -import java.util.Arrays; -import java.util.logging.Level; -import java.util.logging.Logger; -import passive.signature.BigIPCookie; - -/** - * - * @author isayan - */ -public class BigIPDiscover { - private final static Logger logger = Logger.getLogger(BigIPDiscover.class.getName()); - - private final static java.util.ResourceBundle BUNDLE = java.util.ResourceBundle.getBundle("burp/resources/release"); - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - try { - String encrypt_value = null; - for (int i = 0; i < args.length; i += 2) { - String[] param = Arrays.copyOfRange(args, i, args.length); - if (param.length > 1) { - if ("-d".equals(param[0])) { - encrypt_value = param[1]; - } - } else if (param.length > 0) { - if ("-v".equals(param[0])) { - System.out.print("Version: " + getVersion()); - System.exit(0); - } - if ("-h".equals(param[0])) { - usage(); - System.exit(0); - } - - } else { - throw new IllegalArgumentException("argment err:" + String.join(" ", param)); - } - } - - // 必須チェック - if (encrypt_value == null) { - System.out.println("-d argument err "); - usage(); - return; - } - - String bigIPaddr = BigIPCookie.decrypt(encrypt_value); - System.out.println("IP addres: " + bigIPaddr); - System.out.println("PrivateIP: " + IpUtil.isPrivateIP(bigIPaddr)); - System.out.println("LinkLocalIP: " + IpUtil.isLinkLocalIP(bigIPaddr)); - - } catch (Exception ex) { - String errmsg = String.format("%s: %s", ex.getClass().getName(), ex.getMessage()); - System.out.println(errmsg); - logger.log(Level.SEVERE, null, ex); - usage(); - } - } - - private static void usage() { - final String projname = BUNDLE.getString("projname"); - System.out.println(String.format("Usage: java -jar %s.jar -d ", projname)); - System.out.println(String.format(" ex: java -jar %s.jar -d BIGipServer16122=1677787402.36895.0000", projname)); - } - - public static String getProjectName() { - return BUNDLE.getString("projname"); - } - - public static String getVersion() { - return BUNDLE.getString("version"); - } - -} +package passive; + +import burp.BurpExtender; +import extension.helpers.IpUtil; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; +import passive.signature.BigIPCookie; + +/** + * + * @author isayan + */ +public class BigIPDiscover { + private final static Logger logger = Logger.getLogger(BigIPDiscover.class.getName()); + + private final static java.util.ResourceBundle BUNDLE = java.util.ResourceBundle.getBundle("burp/resources/release"); + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + try { + String encrypt_value = null; + for (int i = 0; i < args.length; i += 2) { + String[] param = Arrays.copyOfRange(args, i, args.length); + if (param.length > 1) { + if ("-d".equals(param[0])) { + encrypt_value = param[1]; + } + } else if (param.length > 0) { + if ("-v".equals(param[0])) { + System.out.print("Version: " + getVersion()); + System.exit(0); + } + if ("-h".equals(param[0])) { + usage(); + System.exit(0); + } + + } else { + throw new IllegalArgumentException("argment err:" + String.join(" ", param)); + } + } + + // 必須チェック + if (encrypt_value == null) { + System.out.println("-d argument err "); + usage(); + return; + } + + String bigIPaddr = BigIPCookie.decrypt(encrypt_value); + System.out.println("IP addres: " + bigIPaddr); + System.out.println("PrivateIP: " + IpUtil.isPrivateIP(bigIPaddr)); + System.out.println("LinkLocalIP: " + IpUtil.isLinkLocalIP(bigIPaddr)); + + } catch (Exception ex) { + String errmsg = String.format("%s: %s", ex.getClass().getName(), ex.getMessage()); + System.out.println(errmsg); + logger.log(Level.SEVERE, null, ex); + usage(); + } + } + + private static void usage() { + final String projname = BUNDLE.getString("projname"); + System.out.println(String.format("Usage: java -jar %s.jar -d ", projname)); + System.out.println(String.format(" ex: java -jar %s.jar -d BIGipServer16122=1677787402.36895.0000", projname)); + } + + public static String getProjectName() { + return BUNDLE.getString("projname"); + } + + public static String getVersion() { + return BUNDLE.getString("version"); + } + +} diff --git a/src/main/java/passive/Config.java b/src/main/java/passive/Config.java index 29cb463..42e17b6 100644 --- a/src/main/java/passive/Config.java +++ b/src/main/java/passive/Config.java @@ -1,6 +1,7 @@ package passive; -import extend.util.external.JsonUtil; +import extension.burp.BurpConfig; +import extension.helpers.json.JsonUtil; import java.io.File; import java.io.IOException; @@ -8,14 +9,11 @@ * * @author isayan */ -public class Config { - - public static String getUserHome() { - return System.getProperties().getProperty("user.home"); - } +public class Config extends BurpConfig { + public static File getExtensionHomeDir() { - return new File(getUserHome(), getExtensionDir()); + return new File(BurpConfig.getUserDirFile(), getExtensionDir()); } public static String getExtensionDir() { @@ -25,11 +23,11 @@ public static String getExtensionDir() { public static String getExtensionFile() { return "BigIPDiscover.json"; } - + public static String getUserDir() { return System.getProperties().getProperty("user.dir"); } - + public static void saveToJson(File fo, OptionProperty option) throws IOException { JsonUtil.saveToJson(fo, option, true); } diff --git a/src/main/java/passive/ISignatureItem.java b/src/main/java/passive/ISignatureItem.java index 40c6236..bbc3ef3 100644 --- a/src/main/java/passive/ISignatureItem.java +++ b/src/main/java/passive/ISignatureItem.java @@ -1,13 +1,14 @@ package passive; -import extend.view.base.MatchItem; +import extension.burp.Severity; + /** * * @author isayan */ public interface ISignatureItem { - + /** * @return the enable */ @@ -17,7 +18,7 @@ public interface ISignatureItem { * @param enable the enable to set */ public void setEnable(boolean enable); - + /** * @return the issueName */ @@ -26,6 +27,6 @@ public interface ISignatureItem { /** * @return the serverity */ - public MatchItem.Severity getServerity(); - + public Severity getServerity(); + } diff --git a/src/main/java/passive/IssueItem.java b/src/main/java/passive/IssueItem.java index d0da314..d909e4c 100644 --- a/src/main/java/passive/IssueItem.java +++ b/src/main/java/passive/IssueItem.java @@ -1,14 +1,15 @@ package passive; -import extend.view.base.CaptureItem; -import extend.view.base.MatchItem; +import extension.burp.Confidence; +import extension.burp.Severity; +import extension.view.base.CaptureItem; /** * * @author raise.isayan */ public class IssueItem extends CaptureItem { - + private boolean messageIsRequest = false; /** @@ -40,36 +41,36 @@ public String getType() { public void setType(String type) { this.type = type; } - - private MatchItem.Severity serverity = MatchItem.Severity.INFORMATION; + + private Severity serverity = Severity.INFORMATION; /** * @return the serverity */ - public MatchItem.Severity getServerity() { + public Severity getServerity() { return serverity; } /** * @param serverity the serverity to set */ - public void setServerity(MatchItem.Severity serverity) { + public void setServerity(Severity serverity) { this.serverity = serverity; } - private MatchItem.Confidence confidence = MatchItem.Confidence.CERTAIN; + private Confidence confidence = Confidence.CERTAIN; /** * @return the confidence */ - public MatchItem.Confidence getConfidence() { + public Confidence getConfidence() { return confidence; } /** * @param confidence the confidence to set */ - public void setConfidence(MatchItem.Confidence confidence) { + public void setConfidence(Confidence confidence) { this.confidence = confidence; } diff --git a/src/main/java/passive/SignatureItem.java b/src/main/java/passive/SignatureItem.java index 71cbb5e..a3cf4ca 100644 --- a/src/main/java/passive/SignatureItem.java +++ b/src/main/java/passive/SignatureItem.java @@ -5,7 +5,7 @@ import burp.IHttpRequestResponseWithMarkers; import burp.IScanIssue; import burp.IScannerCheck; -import extend.view.base.MatchItem; +import extension.burp.Severity; import java.util.ArrayList; import java.util.List; @@ -15,7 +15,7 @@ */ public class SignatureItem implements ISignatureItem { - public SignatureItem(String issueName, MatchItem.Severity serverity) { + public SignatureItem(String issueName, Severity serverity) { this.issueName = issueName; this.serverity = serverity; } @@ -45,10 +45,10 @@ public String getIssueName() { return issueName; } - private final MatchItem.Severity serverity; + private final Severity serverity; @Override - public MatchItem.Severity getServerity() { + public Severity getServerity() { return serverity; } @@ -68,13 +68,13 @@ public IHttpRequestResponseWithMarkers applyMarkers(IHttpRequestResponse baseReq requestMarkers.add(new int [] { issue.start(), issue.end() }); } else { - responseMarkers.add(new int [] { issue.start(), issue.end() }); + responseMarkers.add(new int [] { issue.start(), issue.end() }); } } List applyRequestMarkers = (requestMarkers.size() > 0) ? requestMarkers : null; List applyResponseMarkers = (responseMarkers.size() > 0) ? responseMarkers : null; - - return BurpExtender.getCallbacks().applyMarkers(baseRequestResponse, applyRequestMarkers, applyResponseMarkers); + + return BurpExtender.getCallbacks().applyMarkers(baseRequestResponse, applyRequestMarkers, applyResponseMarkers); } - + } diff --git a/src/main/java/passive/signature/BigIPCookie.java b/src/main/java/passive/signature/BigIPCookie.java index 699bfaa..3215edf 100644 --- a/src/main/java/passive/signature/BigIPCookie.java +++ b/src/main/java/passive/signature/BigIPCookie.java @@ -9,9 +9,10 @@ import burp.IResponseInfo; import burp.IScanIssue; import burp.IScannerCheck; -import extend.util.IpUtil; -import extend.util.Util; -import extend.view.base.MatchItem; +import extension.burp.Confidence; +import extension.burp.Severity; +import extension.helpers.StringUtil; +import extension.helpers.IpUtil; import java.net.URL; import java.nio.ByteOrder; import java.util.ArrayList; @@ -31,7 +32,7 @@ public class BigIPCookie extends SignatureItem { private final BigIPCookieProperty property; public BigIPCookie(final BigIPCookieProperty property) { - super("BIG-IP Cookie Discloses IP Address", MatchItem.Severity.LOW); + super("BIG-IP Cookie Discloses IP Address", Severity.LOW); this.property = property; } @@ -232,7 +233,7 @@ public List parseMessage(boolean messageIsRequest, byte[] messag public static List parseHeader(boolean messageIsRequest, byte[] messageByte) { List list = new ArrayList<>(); - String message = Util.getRawStr(messageByte); + String message = StringUtil.getStringRaw(messageByte); String cookieAll = null; int cookieOffset = 0; @@ -274,14 +275,14 @@ protected static List parseDecryptList(boolean messageIsRequest, cookieIP.setStart(cookieOffset + m.start()); cookieIP.setEnd(cookieOffset + m.end()); if (cookieIP.isPrivateIP()) { - cookieIP.setServerity(MatchItem.Severity.LOW); - cookieIP.setConfidence(MatchItem.Confidence.CERTAIN); + cookieIP.setServerity(Severity.LOW); + cookieIP.setConfidence(Confidence.CERTAIN); } else if (cookieIP.isLinkLocalIP()) { - cookieIP.setServerity(MatchItem.Severity.LOW); - cookieIP.setConfidence(MatchItem.Confidence.CERTAIN); + cookieIP.setServerity(Severity.LOW); + cookieIP.setConfidence(Confidence.CERTAIN); } else { - cookieIP.setServerity(MatchItem.Severity.INFORMATION); - cookieIP.setConfidence(MatchItem.Confidence.FIRM); + cookieIP.setServerity(Severity.INFORMATION); + cookieIP.setConfidence(Confidence.FIRM); } list.add(cookieIP); } diff --git a/src/main/java/passive/signature/BigIPCookieProperty.java b/src/main/java/passive/signature/BigIPCookieProperty.java index fcc1f5e..8a37c49 100644 --- a/src/main/java/passive/signature/BigIPCookieProperty.java +++ b/src/main/java/passive/signature/BigIPCookieProperty.java @@ -2,7 +2,8 @@ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; -import extend.view.base.MatchItem; +import extension.burp.HighlightColor; +import extension.burp.NotifyType; import java.util.EnumSet; /** @@ -13,37 +14,37 @@ public class BigIPCookieProperty extends IPCookieProperty { @Expose @SerializedName("notifyTypes") - private EnumSet notifyTypes = EnumSet.allOf(MatchItem.NotifyType.class); + private EnumSet notifyTypes = EnumSet.allOf(NotifyType.class); /** * @return the notifyTypes */ - public EnumSet getNotifyTypes() { + public EnumSet getNotifyTypes() { return this.notifyTypes; } /** * @param notifyTypes the notifyType to set */ - public void setNotifyTypes(EnumSet notifyTypes) { + public void setNotifyTypes(EnumSet notifyTypes) { this.notifyTypes = notifyTypes; } @Expose @SerializedName("highlightColor") - private MatchItem.HighlightColor highlightColor = MatchItem.HighlightColor.RED; + private HighlightColor highlightColor = HighlightColor.RED; /** * @return the highlightColor */ - public MatchItem.HighlightColor getHighlightColor() { + public HighlightColor getHighlightColor() { return this.highlightColor; } /** * @param highlightColor the highlightColor to set */ - public void setHighlightColor(MatchItem.HighlightColor highlightColor) { + public void setHighlightColor(HighlightColor highlightColor) { this.highlightColor = highlightColor; } diff --git a/src/main/java/passive/signature/BigIPCookieTab.java b/src/main/java/passive/signature/BigIPCookieTab.java index b56caaa..5d3889c 100644 --- a/src/main/java/passive/signature/BigIPCookieTab.java +++ b/src/main/java/passive/signature/BigIPCookieTab.java @@ -3,10 +3,11 @@ import burp.BurpExtender; import passive.IOptionProperty; import burp.ITab; -import extend.util.IpUtil; -import extend.util.SwingUtil; -import extend.util.Util; -import extend.view.base.MatchItem; +import extension.burp.HighlightColor; +import extension.burp.NotifyType; +import extension.helpers.ConvertUtil; +import extension.helpers.IpUtil; +import extension.helpers.SwingUtil; import java.awt.Component; import java.awt.event.ComponentEvent; import java.text.ParseException; @@ -26,7 +27,7 @@ public class BigIPCookieTab extends javax.swing.JPanel implements ITab { private final String PRIVATE_IP_INFO = "
  • PrivateIP: %s
  • LinkLocalIP: %s
"; - + /** * Creates new form BigIpDecryptTab */ @@ -275,24 +276,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }// //GEN-END:initComponents private final static java.util.ResourceBundle BUNDLE = java.util.ResourceBundle.getBundle("burp/resources/release"); - + private boolean isFreeSupport() { boolean freeSupport = false; try { - freeSupport = Util.parseBooleanDefault(BUNDLE.getString("freeSupport"), false); - } catch (MissingResourceException ex) { + freeSupport = ConvertUtil.parseBooleanDefault(BUNDLE.getString("freeSupport"), false); + } catch (MissingResourceException ex) { } return freeSupport; } - + private void customizeComponents() { this.cmbHighlightColor.setModel( - new DefaultComboBoxModel( - new MatchItem.HighlightColor[]{MatchItem.HighlightColor.RED, MatchItem.HighlightColor.ORANGE, - MatchItem.HighlightColor.YELLOW, MatchItem.HighlightColor.GREEN, MatchItem.HighlightColor.CYAN, - MatchItem.HighlightColor.BLUE, MatchItem.HighlightColor.PINK, MatchItem.HighlightColor.MAGENTA, - MatchItem.HighlightColor.GRAY})); + new DefaultComboBoxModel( + new HighlightColor[]{HighlightColor.RED, HighlightColor.ORANGE, + HighlightColor.YELLOW, HighlightColor.GREEN, HighlightColor.CYAN, + HighlightColor.BLUE, HighlightColor.PINK, HighlightColor.MAGENTA, + HighlightColor.GRAY})); this.cmbHighlightColor.setEnabled(false); this.cmbHighlightColor.setRenderer(new DefaultListCellRenderer() { @@ -300,7 +301,7 @@ private void customizeComponents() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel l = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - MatchItem.HighlightColor hc = (MatchItem.HighlightColor) value; + HighlightColor hc = (HighlightColor) value; if (hc != null) { l.setIcon(hc.toIcon()); l.setIconTextGap(2); @@ -325,37 +326,37 @@ public void removeUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) { lblDecryptInfo.setText(""); txtDecrypt.setText(""); - } + } }); - this.pnlFreeScan.setVisible(isFreeSupport()); + this.pnlFreeScan.setVisible(isFreeSupport()); // FreeVersion only this.addComponentListener(new java.awt.event.ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { if (isFreeSupport()) { boolean isProfessional = BurpExtender.getInstance().getBurpVersion().isProfessional(); - pnlFreeScan.setVisible(isFreeSupport()); - SwingUtil.setContainerEnable(pnlFreeScan, !isProfessional); + pnlFreeScan.setVisible(isFreeSupport()); + SwingUtil.setContainerEnable(pnlFreeScan, !isProfessional); } } }); - + } private void btnDecryptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDecryptActionPerformed - this.txtDecrypt.setText(""); + this.txtDecrypt.setText(""); this.lblDecryptInfo.setText(""); String value = BigIPCookie.decrypt(this.txtEncrypt.getText()); if (value != null) { try { - this.lblDecryptInfo.setText(String.format(PRIVATE_IP_INFO, IpUtil.isPrivateIP(value), IpUtil.isLinkLocalIP(value))); + this.lblDecryptInfo.setText(String.format(PRIVATE_IP_INFO, IpUtil.isPrivateIP(value), IpUtil.isLinkLocalIP(value))); this.txtDecrypt.setText(value); } catch (ParseException ex) { } } }//GEN-LAST:event_btnDecryptActionPerformed - + private void cmbHighlightColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbHighlightColorActionPerformed this.firePropertyChange(IOptionProperty.BIGIP_COOKIE_PROPERTY, null, this.getProperty()); }//GEN-LAST:event_cmbHighlightColorActionPerformed @@ -416,9 +417,9 @@ public void setProperty(BigIPCookieProperty property) { this.chkRequest.setSelected(property.getScanRequest()); this.chkResponse.setSelected(property.getScanResponse()); - EnumSet notifyTypes = property.getNotifyTypes(); - this.chkItem_highlight.setSelected(notifyTypes.contains(MatchItem.NotifyType.ITEM_HIGHLIGHT)); - this.chk_Comment.setSelected(notifyTypes.contains(MatchItem.NotifyType.COMMENT)); + EnumSet notifyTypes = property.getNotifyTypes(); + this.chkItem_highlight.setSelected(notifyTypes.contains(NotifyType.ITEM_HIGHLIGHT)); + this.chk_Comment.setSelected(notifyTypes.contains(NotifyType.COMMENT)); this.cmbHighlightColor.setSelectedItem(property.getHighlightColor()); this.chkPrivateIP.setSelected(property.isDetectionPrivateIP()); @@ -429,16 +430,16 @@ public BigIPCookieProperty getProperty() { property.setScanRequest(this.chkRequest.isSelected()); property.setScanResponse(this.chkResponse.isSelected()); - EnumSet notifyTypes = EnumSet.noneOf(MatchItem.NotifyType.class); + EnumSet notifyTypes = EnumSet.noneOf(NotifyType.class); if (this.chkItem_highlight.isSelected()) { - notifyTypes.add(MatchItem.NotifyType.ITEM_HIGHLIGHT); + notifyTypes.add(NotifyType.ITEM_HIGHLIGHT); } if (this.chk_Comment.isSelected()) { - notifyTypes.add(MatchItem.NotifyType.COMMENT); + notifyTypes.add(NotifyType.COMMENT); } property.setNotifyTypes(notifyTypes); - if (property.getNotifyTypes().contains(MatchItem.NotifyType.ITEM_HIGHLIGHT)) { - property.setHighlightColor((MatchItem.HighlightColor) this.cmbHighlightColor.getSelectedItem()); + if (property.getNotifyTypes().contains(NotifyType.ITEM_HIGHLIGHT)) { + property.setHighlightColor((HighlightColor) this.cmbHighlightColor.getSelectedItem()); } property.setDetectionPrivateIP(this.chkPrivateIP.isSelected()); diff --git a/src/main/java/passive/signature/IPAddressIssueItem.java b/src/main/java/passive/signature/IPAddressIssueItem.java index d47cb8d..513bb11 100644 --- a/src/main/java/passive/signature/IPAddressIssueItem.java +++ b/src/main/java/passive/signature/IPAddressIssueItem.java @@ -1,6 +1,6 @@ package passive.signature; -import extend.util.IpUtil; +import extension.helpers.IpUtil; import java.text.ParseException; import passive.IssueItem; diff --git a/src/test/java/passive/signature/BigIPCookieTest.java b/src/test/java/passive/signature/BigIPCookieTest.java index 1999880..9896048 100644 --- a/src/test/java/passive/signature/BigIPCookieTest.java +++ b/src/test/java/passive/signature/BigIPCookieTest.java @@ -1,6 +1,6 @@ package passive.signature; -import extend.util.Util; +import extension.helpers.StringUtil; import java.util.List; import org.junit.After; import org.junit.AfterClass; @@ -40,7 +40,7 @@ public void tearDown() { + "Cookie: %s\r\n" + "Connection: close\r\n"; - private final static String RES_TEST_FMT = "GHTTP/1.1 200 OK\r\n" + private final static String RES_TEST_FMT = "HTTP/1.1 200 OK\r\n" + "Content-Length: 0\r\n" + "Content-Type: text/html\r\n" + "Set-Cookie: %s\r\n"; @@ -66,7 +66,7 @@ public void tearDown() { + "Content-Length: 116\r\n" + "Connection: close\r\n" + "Content-Type: text/html; charset=UTF-8\r\n\r\n"; - + /** * Test of decrypt method, of class BigIPCookie. */ @@ -74,12 +74,12 @@ public void tearDown() { public void testBigIPCookie_Req1() { System.out.println("BigIpEncrypt Req1"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=1677787402.36895.0000"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("10.1.1.100:8080", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=1677787402.36895.0000"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("10.1.1.100:8080", bigIP2.get(0).getIPAddr()); assertEquals(false, bigIP2.get(0).startsBIGipServer()); } @@ -91,12 +91,12 @@ public void testBigIPCookie_Req1() { public void testBigIPCookie_Req2() { System.out.println("BigIpEncrypt Req2"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP2.get(0).getIPAddr()); assertEquals(false, bigIP2.get(0).startsBIGipServer()); } @@ -108,12 +108,12 @@ public void testBigIPCookie_Req2() { public void testBigIPCookie_Req3() { System.out.println("BigIpEncrypt Req3"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("192.0.2.1:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("192.0.2.1:80", bigIP2.get(0).getIPAddr()); assertEquals(false, bigIP2.get(0).startsBIGipServer()); } @@ -125,12 +125,12 @@ public void testBigIPCookie_Req3() { public void testBigIPCookie_Req4() { System.out.println("BigIpEncrypt Req4"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP2.get(0).getIPAddr()); assertEquals(false, bigIP2.get(0).startsBIGipServer()); @@ -158,12 +158,12 @@ public void testBigIPCookieList_Req1() { public void testBigIPCookie_Res1() { System.out.println("BigIpEncrypt Res1"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=1677787402.36895.0000"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("10.1.1.100:8080", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=1677787402.36895.0000"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("10.1.1.100:8080", bigIP2.get(0).getIPAddr()); assertEquals(false, bigIP2.get(0).startsBIGipServer()); } @@ -175,12 +175,12 @@ public void testBigIPCookie_Res1() { public void testBigIPCookie_Res2() { System.out.println("BigIpEncrypt Res2"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP2.get(0).getIPAddr()); } @@ -191,12 +191,12 @@ public void testBigIPCookie_Res2() { public void testBigIPCookie_Res3() { System.out.println("BigIpEncrypt Res3"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("192.0.2.1:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("192.0.2.1:80", bigIP2.get(0).getIPAddr()); } @@ -207,12 +207,12 @@ public void testBigIPCookie_Res3() { public void testBigIPCookie_Res4() { System.out.println("BigIpEncrypt Res4"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", bigIP2.get(0).getIPAddr()); } @@ -222,7 +222,7 @@ public void testBigIPCookie_Res4() { @Test public void testBigIPCookie_Res10() { System.out.println("BigIpEncrypt Res10"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(RES_TEST10_FMT)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(RES_TEST10_FMT)); assertEquals("10.1.1.100:8080", bigIP1.get(0).getIPAddr()); assertEquals(true, bigIP1.get(0).isPrivateIP()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); @@ -234,12 +234,12 @@ public void testBigIPCookie_Res10() { @Test public void testBigIPCookie_Res11() { System.out.println("BigIpEncrypt Res11"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(RES_TEST11_FMT)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(RES_TEST11_FMT)); assertEquals("192.0.2.1:80", bigIP1.get(0).getIPAddr()); assertEquals(false, bigIP1.get(0).isPrivateIP()); assertEquals(true, bigIP1.get(0).startsBIGipServer()); } - + /** * Test of decrypt method, of class BigIPCookie. */ @@ -250,7 +250,7 @@ public void testDecrypt() { assertEquals("10.1.1.100:8080", ip1); String ip2 = BigIPCookie.decrypt("vi20010112000000000000000000000030.20480"); - // [2001:0112::0030]:80 + // [2001:0112::0030]:80 assertEquals("[2001:0112:0000:0000:0000:0000:0000:0030]:80", ip2); String ip3 = BigIPCookie.decrypt("rd5o00000000000000000000ffffc0000201o80"); @@ -282,11 +282,11 @@ public void testDecrypt2() { public void testStartEnd_Req1() { System.out.println("start and end req1"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=1677787402.36895.0000"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("BIGipServer_aa_bb_cc=1677787402.36895.0000", req1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=1677787402.36895.0000"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("aa_bb_cc=1677787402.36895.0000", req2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -297,11 +297,11 @@ public void testStartEnd_Req1() { public void testStartEnd_Req2() { System.out.println("start and end req2"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480", req1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("aa_bb_cc=vi20010112000000000000000000000030.20480", req2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -312,11 +312,11 @@ public void testStartEnd_Req2() { public void testStartEnd_Req3() { System.out.println("start and end req3"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80", req1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("aa_bb_cc=rd5o00000000000000000000ffffc0000201o80", req2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -328,11 +328,11 @@ public void testStartEnd_Req3() { public void testStartEnd_Req4() { System.out.println("start and end req4"); String req1 = String.format(REQ_TEST_FMT, "BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP1 = BigIPCookie.parseHeader(true, Util.getRawByte(req1)); + List bigIP1 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req1)); assertEquals("BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80", req1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String req2 = String.format(REQ_TEST_FMT, "aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP2 = BigIPCookie.parseHeader(true, Util.getRawByte(req2)); + List bigIP2 = BigIPCookie.parseHeader(true, StringUtil.getBytesRaw(req2)); assertEquals("aa_bb_cc=rd3o20010112000000000000000000000030o80", req2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -343,11 +343,11 @@ public void testStartEnd_Req4() { public void testStartEnd_Res1() { System.out.println("start and end res1"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=1677787402.36895.0000"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("BIGipServer_aa_bb_cc=1677787402.36895.0000", res1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=1677787402.36895.0000"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("aa_bb_cc=1677787402.36895.0000", res2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -358,11 +358,11 @@ public void testStartEnd_Res1() { public void testStartEnd_Res2() { System.out.println("start and end res2"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("BIGipServer_aa_bb_cc=vi20010112000000000000000000000030.20480", res1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=vi20010112000000000000000000000030.20480"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("aa_bb_cc=vi20010112000000000000000000000030.20480", res2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -373,11 +373,11 @@ public void testStartEnd_Res2() { public void testStartEnd_Res3() { System.out.println("start and end res3"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("BIGipServer_aa_bb_cc=rd5o00000000000000000000ffffc0000201o80", res1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=rd5o00000000000000000000ffffc0000201o80"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("aa_bb_cc=rd5o00000000000000000000ffffc0000201o80", res2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); } @@ -389,11 +389,11 @@ public void testStartEnd_Res3() { public void testStartEnd_Res4() { System.out.println("start and end res4"); String res1 = String.format(RES_TEST_FMT, "BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP1 = BigIPCookie.parseHeader(false, Util.getRawByte(res1)); + List bigIP1 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res1)); assertEquals("BIGipServer_aa_bb_cc=rd3o20010112000000000000000000000030o80", res1.substring(bigIP1.get(0).start(), bigIP1.get(0).end())); String res2 = String.format(RES_TEST_FMT, "aa_bb_cc=rd3o20010112000000000000000000000030o80"); - List bigIP2 = BigIPCookie.parseHeader(false, Util.getRawByte(res2)); + List bigIP2 = BigIPCookie.parseHeader(false, StringUtil.getBytesRaw(res2)); assertEquals("aa_bb_cc=rd3o20010112000000000000000000000030o80", res2.substring(bigIP2.get(0).start(), bigIP2.get(0).end())); }