diff --git a/src/main/java/com/nccgroup/loggerplusplus/exports/HarSerializer.java b/src/main/java/com/nccgroup/loggerplusplus/exports/HarSerializer.java index c748dbf9..d313449c 100644 --- a/src/main/java/com/nccgroup/loggerplusplus/exports/HarSerializer.java +++ b/src/main/java/com/nccgroup/loggerplusplus/exports/HarSerializer.java @@ -62,6 +62,7 @@ public void write(JsonWriter writer, List logEntries) throws IOExcepti writer.name("method").value(logEntry.method); writer.name("url").value(logEntry.url.toString()); writer.name("httpVersion").value(logEntry.requestHttpVersion); + writer.name("origin").value(logEntry.origin); writer.name("cookies").beginArray(); if (logEntry.hasCookieParam) { diff --git a/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntry.java b/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntry.java index a84496af..85978f31 100644 --- a/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntry.java +++ b/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntry.java @@ -72,6 +72,7 @@ public class LogEntry { public CookieJarStatus usesCookieJar = CookieJarStatus.NO; public String responseHash; public String redirectURL; + public String origin = ""; // public String[] regexAllReq = {"","","","",""}; // public String[] regexAllResp = {"","","","",""}; @@ -235,10 +236,12 @@ private Status processRequest() { this.usesCookieJar = CookieJarStatus.YES; } } - } else if (headerItem[0].equals("referer")) { + } else if (headerItem[0].equalsIgnoreCase("referer")) { this.referrerURL = headerItem[1]; - } else if (headerItem[0].equals("content-type")) { + } else if (headerItem[0].equalsIgnoreCase("content-type")) { this.requestContentType = headerItem[1]; + } else if (headerItem[0].equalsIgnoreCase("origin")) { + this.origin = headerItem[1]; } } } @@ -598,6 +601,8 @@ public Object getValueByKey(LogEntryField columnName) { return this.sentCookies; case USES_COOKIE_JAR: return this.usesCookieJar.toString(); + case ORIGIN: + return this.origin; // case REGEX1REQ: // return this.regexAllReq[0]; // case REGEX2REQ: diff --git a/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntryField.java b/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntryField.java index aff9afe1..37673931 100644 --- a/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntryField.java +++ b/src/main/java/com/nccgroup/loggerplusplus/logentry/LogEntryField.java @@ -45,6 +45,7 @@ public enum LogEntryField { SENTCOOKIES(FieldGroup.REQUEST, Boolean.class, "The value of the cookies header sent to the server.", "CookieString", "SentCookies", "Cookies"), PARAMETER_COUNT(FieldGroup.REQUEST, Integer.class, "The number of parameters in the request.", "ParameterCount", "ParamCount"), PARAMETERS(FieldGroup.REQUEST, String.class, "The parameters in the request.", "Parameters", "Params"), + ORIGIN(FieldGroup.REQUEST, String.class, "The Origin header", "Origin"), //Response BASE64_RESPONSE(FieldGroup.RESPONSE, String.class, "The entire response encoded in Base64", "AsBase64"), diff --git a/src/main/java/com/nccgroup/loggerplusplus/util/Globals.java b/src/main/java/com/nccgroup/loggerplusplus/util/Globals.java index 6c1b32af..c942a85a 100644 --- a/src/main/java/com/nccgroup/loggerplusplus/util/Globals.java +++ b/src/main/java/com/nccgroup/loggerplusplus/util/Globals.java @@ -109,6 +109,7 @@ public enum Protocol {HTTP, HTTPS} .append("{'id':" + PARAMETERS + ",'name':'Parameters','defaultVisibleName':'Parameters','visibleName':'Parameters','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(PARAMETERS.getDescription()) + "'},") .append("{'id':" + REFLECTED_PARAMS + ",'name':'ReflectedParams','defaultVisibleName':'Reflected Params','visibleName':'Reflected Params','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(REFLECTED_PARAMS.getDescription()) + "'},") .append("{'id':" + REFLECTION_COUNT + ",'name':'ReflectionCount','defaultVisibleName':'Reflection Count','visibleName':'Reflection Count','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(REFLECTION_COUNT.getDescription()) + "'},") + .append("{'id':" + ORIGIN + ",'name':'origin','defaultVisibleName':'Origin header','visibleName':'Origin header','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(ORIGIN.getDescription()) + "'},") .append("{'id':" + MIME_TYPE + ",'name':'MimeType','defaultVisibleName':'MIME type','visibleName':'MIME type','preferredWidth':100,'readonly':true,'order':" + colOrder++ + ",'visible':false,'description':'" + StringEscapeUtils.escapeJson(MIME_TYPE.getDescription()) + "'},") .append("{'id':" + NEW_COOKIES + ",'name':'NewCookies','defaultVisibleName':'New Cookies','visibleName':'New Cookies','preferredWidth':125,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(NEW_COOKIES.getDescription()) + "'},") .append("{'id':" + REQUEST_TIME + ",'name':'RequestTime','defaultVisibleName':'Request Time','visibleName':'Request Time','preferredWidth':150,'readonly':true,'order':" + colOrder++ + ",'visible':true,'description':'" + StringEscapeUtils.escapeJson(REQUEST_TIME.getDescription()) + "'},")