From cb1dd2deb168e796076e8fd72570b514d58ed490 Mon Sep 17 00:00:00 2001 From: rammarj <19270317+rammarj@users.noreply.github.com> Date: Sat, 21 May 2022 14:43:26 -0500 Subject: [PATCH] Changed build to maven --- .gitignore | 13 +- dist/csrf-poc-creator.jar | Bin 40946 -> 0 bytes pom.xml | 34 ++ src/{ => main/java}/burp/BurpExtender.java | 203 +++++----- src/{ => main/java}/burp/Header.java | 82 ++-- .../java}/burp/IHttpServiceImpl.java | 106 +++--- src/{ => main/java}/burp/Parameter.java | 354 +++++++++--------- src/{ => main/java}/burp/Util.java | 244 ++++++------ .../java}/burp/burptab/CloseIcon.java | 62 +-- .../java}/burp/burptab/ITabImpl.java | 86 ++--- .../java}/burp/burptab/PocCreatorTab.java | 347 +++++++++-------- .../java}/burp/burptab/PocTabManager.java | 83 ++-- src/{ => main/java}/burp/pocs/AjaxPoc.java | 161 ++++---- src/{ => main/java}/burp/pocs/HtmlPoc.java | 89 +++-- src/{ => main/java}/burp/pocs/IPoc.java | 38 +- src/{ => main/java}/burp/pocs/Pocs.java | 104 ++--- 16 files changed, 1003 insertions(+), 1003 deletions(-) delete mode 100644 dist/csrf-poc-creator.jar create mode 100644 pom.xml rename src/{ => main/java}/burp/BurpExtender.java (92%) rename src/{ => main/java}/burp/Header.java (96%) rename src/{ => main/java}/burp/IHttpServiceImpl.java (94%) rename src/{ => main/java}/burp/Parameter.java (96%) rename src/{ => main/java}/burp/Util.java (65%) rename src/{ => main/java}/burp/burptab/CloseIcon.java (95%) rename src/{ => main/java}/burp/burptab/ITabImpl.java (95%) rename src/{ => main/java}/burp/burptab/PocCreatorTab.java (95%) rename src/{ => main/java}/burp/burptab/PocTabManager.java (89%) rename src/{ => main/java}/burp/pocs/AjaxPoc.java (85%) rename src/{ => main/java}/burp/pocs/HtmlPoc.java (88%) rename src/{ => main/java}/burp/pocs/IPoc.java (95%) rename src/{ => main/java}/burp/pocs/Pocs.java (94%) diff --git a/.gitignore b/.gitignore index d80bd39..d8dd9c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ nbproject/* build/* -dist/lib/* -dist/README.TXT +dist/* manifest.mf build.xml -/dist/ \ No newline at end of file +/dist/ +/bin/ +/target/ + +## maven ## +.classpath +.project +.settings/ +mvn* diff --git a/dist/csrf-poc-creator.jar b/dist/csrf-poc-creator.jar deleted file mode 100644 index 75a0131ef5464da6e2384ecf77a121b0737aba5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40946 zcmdsg33yyrb^m#zk=`s%mNZ`Fbu4dMEiZ}f$V)8AQmn+19m`9c%^6E$OR=m`Mk6mt zfCLBx!csyKlCXtfV#=1pNxa06ge_3ELfJ|SrIbQjC=_U$QVRJ0``!EAoA+j(Y~$qX z_x&q--g4i)=kDj8?Vh{ks*-R_BqH*pwPcfc{-P3=?v8D(OCs%%j&yc(Ff-heT)KEkd8~EV6Vf`8 z>KjNW5r&VKEnZn3YtN=rxpaS1+Y!cJwRp+yrI#*i+Ou>;vUYPe)i;z*wr8>GcW@957*esoWz2!B(Zcx?dL zaX6PA?oVeI_pwpF^v7qP!`DmX2QgVDhfO&WlaL&a%2K)2l-nY5drV5@ReXOnFR$U{ z4pZ)oNnA&JZCqX_uaC%GyuZPeH%8>{m{iG|`2OaY+#_${<*jjfo4lQuKQrYWrraBo z>GCRG-pL&9W48B4C7S419UJ`crZzC3KoyLo?4Ox`Q+BdGVsl#q!~p{JDI@l#iP7F;hNn$|p>D+>ps^RHp^n(Q$iHefviZnYBsv zN|(2R+|R2GDMt%$OYOmEP3=o(4VkIqGm+{d?^i^x9PH~(507;XAI$WrF__PxJu{q3 zAI|wdBS~Zwy~0pKCT_Ypbue|fdGyfW@V@3N8OR98s68__oHNAeG9-F{8RXIjQ2Hq< zLGxH{aHx6H;PC!*|E9sw9MVL42lox9a%0)FA z4d{ww?K%5`B`MjTKEiC-OwB_nG*WLai?#yfFedc@L#B>XEk@Xr?lZ(hhhCLFf)Y;h zvZoRP@_&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3kg|{}G^=xm#=PQ18~eX}y^QkcUDSbE zYYJa6KCVh10cA0+P_*7Bm35@00j`t`HXt4{w7hp7pD5xM-1EgV0#4( z>mwhEiDe#@3sGOehDmjRV&OpN$&0NpTeZORFG5~LBO-7nlt5vWcS5cN*)~n(VdNYt zt2hYFj<(GoMBxSC-BRX?l*{&~kMuG{m9MoCghnmTms!PeMcF{pafMStKy7GI%tm^) z2?52^Fpf4#@a2nd^z=syrR&tJh4WZ?LW3W}M2T%+1lyvWd^gWX1hQWUCCh9anm4r3 zZrCOvi}?Vaw`N)Z49~2hkhVD)@o+o-RUMbu7X%07#sSrON@96)BkhrPHgL!sSnkZl zKec>U0*+qKS>Q_nhxj;-!oeh}`~{hy-R5IqVc&n-~|p-qv1qLtsq z3boV{20SC+s%e3xcDvPLnW%Fs(O_2sNBUNw_z4_;ZrD}OiM28K1T=O9z|{jB-0yC= z$_Py=fe;R!oS(FoP)6_m@$_%~S1G?}2>R#dg$AT z#2>M!^LO-4uD@>5?$(~J&W_$~i@Q6$5FRhcoJd>$G4o|;R)s6hm4rSd^GUEfT_<6> z9Bs@!{zQ@JDBR&fn2HU&5SH$-Um)x(G3eSVi zgZXStA(&tYg$K^%Ask(7L)gw^YWi@9#b{wI3Z47r6OVP+iCGnnB-ds;7*e5c(LAK} zT?LR_XP1FRD)g9`2lNyss%luLNLaD*M*rh=RH2itJiM=OJr}&-Y8Gzj$U{3mR16K4 z!1nHkU}%L_iFs(N58BYwY; + 4.0.0 + csrf-poc-creator + csrf-poc-creator + 0.0.1 + csrf-poc-creator + Burp Suite Free extension for CSRF Proof Of Concepts + + + 1.8 + UTF-8 + 1.8 + 1.8 + + + + + + net.portswigger.burp.extender + burp-extender-api + 2.3 + + + + + + + + maven-compiler-plugin + 3.8.1 + + + + \ No newline at end of file diff --git a/src/burp/BurpExtender.java b/src/main/java/burp/BurpExtender.java similarity index 92% rename from src/burp/BurpExtender.java rename to src/main/java/burp/BurpExtender.java index 3246583..a372492 100644 --- a/src/burp/BurpExtender.java +++ b/src/main/java/burp/BurpExtender.java @@ -1,103 +1,100 @@ -package burp; - -import burp.burptab.ITabImpl; -import burp.burptab.PocCreatorTab; -import burp.burptab.PocTabManager; -import burp.pocs.Pocs; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import burp.pocs.IPoc; - -/** - * CSRF POC Creator extension for Burp Suite - * - * @author Joaquin R. Martinez - */ -public class BurpExtender implements IBurpExtender, IContextMenuFactory, ActionListener { - - private static IBurpExtenderCallbacks burpExtenderCallbacks; - private PocTabManager pocTabManager; - private IContextMenuInvocation icMenuInvocation; - private final JMenu sendMenu; - private int tabCount; - private final LinkedList menuItems; - - /**Initialize all variables needed*/ - public BurpExtender() { - this.menuItems = new LinkedList<>(); - this.sendMenu = new JMenu("send to CSRF PoC Creator"); - this.tabCount = 1; - } - - @Override - public void registerExtenderCallbacks(IBurpExtenderCallbacks ibec) { - BurpExtender.burpExtenderCallbacks = ibec; - this.pocTabManager = new PocTabManager(); - ibec.registerContextMenuFactory(this); - ibec.setExtensionName("CSRF PoC Creator"); - BurpExtender.burpExtenderCallbacks.addSuiteTab(new ITabImpl("CSRF PoC", this.pocTabManager)); - Pocs.initialize(); - // add menus - Iterator pocKeys = Pocs.getPocKeys(); - while (pocKeys.hasNext()) { - String key = pocKeys.next(); - JMenuItem item = new JMenuItem(key); - item.addActionListener(BurpExtender.this); - this.sendMenu.add(item); - } - this.menuItems.add(this.sendMenu); - BurpExtender.burpExtenderCallbacks.printOutput("Burp csrf-poc-creator plugin for Burp Suite Free loaded!"); - BurpExtender.burpExtenderCallbacks.printOutput("Created by @rammarj"); - } - /** - * Creates the menu items shown in burp suite - * @param icmi the context menu invocation - * @return List of menu items - */ - @Override - public List createMenuItems(IContextMenuInvocation icmi) { - this.icMenuInvocation = icmi; - byte invocation_context = icmi.getInvocationContext(); - if (invocation_context == IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST - || invocation_context == IContextMenuInvocation.CONTEXT_PROXY_HISTORY - || invocation_context == IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST) { - return menuItems; - } - return null; - } - - /**This method is executed when the "send to csrf ..." was clicked - * @param e event argument - */ - @Override - public void actionPerformed(ActionEvent e) { - IHttpRequestResponse[] selectedMessages = this.icMenuInvocation.getSelectedMessages(); - for (IHttpRequestResponse ihrr : selectedMessages) { - try { - String actionCommand = e.getActionCommand(); - IPoc poc = Pocs.getPoc(actionCommand); - byte[] pocContent = poc.getPoc(ihrr); - PocCreatorTab pocCreatorTab = new PocCreatorTab(ihrr, pocContent); - pocCreatorTab.setSelectedItem(actionCommand); - this.pocTabManager.addTab(String.valueOf((this.tabCount++)), pocCreatorTab); - } catch (Exception ex) { - JOptionPane.showMessageDialog(this.pocTabManager, ex.getMessage()); - } - } - } - - /** - * Get the extender callback for this plugin - * @return the extender callbacks - */ - public static IBurpExtenderCallbacks getBurpExtenderCallbacks() { - return burpExtenderCallbacks; - } - -} +package burp; + +import burp.burptab.ITabImpl; +import burp.burptab.PocCreatorTab; +import burp.burptab.PocTabManager; +import burp.pocs.Pocs; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import burp.pocs.IPoc; + +/** + * CSRF POC Creator extension for Burp Suite + * + * @author Joaquin R. Martinez + */ +public class BurpExtender implements IBurpExtender, IContextMenuFactory, ActionListener { + + private static IBurpExtenderCallbacks burpExtenderCallbacks; + private PocTabManager pocTabManager; + private IContextMenuInvocation icMenuInvocation; + private int tabCount; + private final LinkedList menuItems; + + /**Initialize all variables needed*/ + public BurpExtender() { + this.menuItems = new LinkedList<>(); + this.tabCount = 1; + } + + @Override + public void registerExtenderCallbacks(IBurpExtenderCallbacks ibec) { + BurpExtender.burpExtenderCallbacks = ibec; + this.pocTabManager = new PocTabManager(); + ibec.registerContextMenuFactory(this); + ibec.setExtensionName("CSRF PoC Creator"); + BurpExtender.burpExtenderCallbacks.addSuiteTab(new ITabImpl("CSRF PoC", this.pocTabManager)); + Pocs.initialize(); + // add menus + Iterator pocKeys = Pocs.getPocKeys(); + while (pocKeys.hasNext()) { + String key = pocKeys.next(); + JMenuItem item = new JMenuItem(key); + item.addActionListener(BurpExtender.this); + this.menuItems.add(item); + } + BurpExtender.burpExtenderCallbacks.printOutput("Burp csrf-poc-creator plugin for Burp Suite Free loaded!"); + BurpExtender.burpExtenderCallbacks.printOutput("Created by @rammarj"); + } + /** + * Creates the menu items shown in burp suite + * @param icmi the context menu invocation + * @return List of menu items + */ + @Override + public List createMenuItems(IContextMenuInvocation icmi) { + this.icMenuInvocation = icmi; + byte invocation_context = icmi.getInvocationContext(); + if (invocation_context == IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST + || invocation_context == IContextMenuInvocation.CONTEXT_PROXY_HISTORY + || invocation_context == IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST) { + return menuItems; + } + return null; + } + + /**This method is executed when the "send to csrf ..." was clicked + * @param e event argument + */ + @Override + public void actionPerformed(ActionEvent e) { + IHttpRequestResponse[] selectedMessages = this.icMenuInvocation.getSelectedMessages(); + for (IHttpRequestResponse ihrr : selectedMessages) { + try { + String actionCommand = e.getActionCommand(); + IPoc poc = Pocs.getPoc(actionCommand); + byte[] pocContent = poc.getPoc(ihrr); + + PocCreatorTab pocCreatorTab = new PocCreatorTab(ihrr, pocContent); + pocCreatorTab.setSelectedItem(actionCommand); + this.pocTabManager.addTab(String.valueOf((this.tabCount++)), pocCreatorTab); + } catch (Exception ex) { + JOptionPane.showMessageDialog(this.pocTabManager, ex.getMessage()); + } + } + } + + /** + * Get the extender callback for this plugin + * @return the extender callbacks + */ + public static IBurpExtenderCallbacks getBurpExtenderCallbacks() { + return burpExtenderCallbacks; + } + +} diff --git a/src/burp/Header.java b/src/main/java/burp/Header.java similarity index 96% rename from src/burp/Header.java rename to src/main/java/burp/Header.java index f744344..958f8d3 100644 --- a/src/burp/Header.java +++ b/src/main/java/burp/Header.java @@ -1,41 +1,41 @@ - -package burp; - -/** - * - * @author Joaquin R. Martinez - */ -public class Header extends Parameter{ - - /** - * Creates a new header object with the specified name and value - * @param name the header name - * @param value the header value - */ - public Header(String name, String value) { - super(name, value, Type.PARAM_HEADER); - } - /** - * Creates a new header object with empty name and value - */ - public Header() { - this("", ""); - } - - /** - * Creates a new header object with the given strin - * @param header the string to parse (name:value) - * @return The header object created - */ - public static Header build(String header){ - if(header == null) - throw new NullPointerException("header is null"); - String[] split = header.split(":"); - String name = split[0].trim(), value=""; - if (split.length>1) { - value = split[1].trim(); - } - return new Header(name, value); - } - -} + +package burp; + +/** + * + * @author Joaquin R. Martinez + */ +public class Header extends Parameter{ + + /** + * Creates a new header object with the specified name and value + * @param name the header name + * @param value the header value + */ + public Header(String name, String value) { + super(name, value, Type.PARAM_HEADER); + } + /** + * Creates a new header object with empty name and value + */ + public Header() { + this("", ""); + } + + /** + * Creates a new header object with the given strin + * @param header the string to parse (name:value) + * @return The header object created + */ + public static Header build(String header){ + if(header == null) + throw new NullPointerException("header is null"); + String[] split = header.split(":"); + String name = split[0].trim(), value=""; + if (split.length>1) { + value = split[1].trim(); + } + return new Header(name, value); + } + +} diff --git a/src/burp/IHttpServiceImpl.java b/src/main/java/burp/IHttpServiceImpl.java similarity index 94% rename from src/burp/IHttpServiceImpl.java rename to src/main/java/burp/IHttpServiceImpl.java index f9bcf4d..22e8bfb 100644 --- a/src/burp/IHttpServiceImpl.java +++ b/src/main/java/burp/IHttpServiceImpl.java @@ -1,53 +1,53 @@ - -package burp; - -import java.net.URL; -/** - * - * @author Joaquin R. Martinez - */ -public class IHttpServiceImpl implements IHttpService { - - private URL url; - - /** - * Creates a {@link IHttpServiceImpl} using a {@link URL}. - * @param url the url for this http service - */ - public IHttpServiceImpl(URL url) { - this.url = url; - } - - /** - * Creates a {@link IHttpServiceImpl} using a {@link IRequestInfo} - * @param info {@link IRequestInfo} to use. - */ - public IHttpServiceImpl(IRequestInfo info) { - this(info.getUrl()); - } - - /** - * @return the host - */ - @Override - public String getHost() { - return this.url.getHost(); - } - - /** - * @return the port - */ - @Override - public int getPort() { - return this.url.getPort(); - } - - /** - * @return the protocol - */ - @Override - public String getProtocol() { - return this.url.getProtocol(); - } - -} + +package burp; + +import java.net.URL; +/** + * + * @author Joaquin R. Martinez + */ +public class IHttpServiceImpl implements IHttpService { + + private URL url; + + /** + * Creates a {@link IHttpServiceImpl} using a {@link URL}. + * @param url the url for this http service + */ + public IHttpServiceImpl(URL url) { + this.url = url; + } + + /** + * Creates a {@link IHttpServiceImpl} using a {@link IRequestInfo} + * @param info {@link IRequestInfo} to use. + */ + public IHttpServiceImpl(IRequestInfo info) { + this(info.getUrl()); + } + + /** + * @return the host + */ + @Override + public String getHost() { + return this.url.getHost(); + } + + /** + * @return the port + */ + @Override + public int getPort() { + return this.url.getPort(); + } + + /** + * @return the protocol + */ + @Override + public String getProtocol() { + return this.url.getProtocol(); + } + +} diff --git a/src/burp/Parameter.java b/src/main/java/burp/Parameter.java similarity index 96% rename from src/burp/Parameter.java rename to src/main/java/burp/Parameter.java index f536721..cf0775c 100644 --- a/src/burp/Parameter.java +++ b/src/main/java/burp/Parameter.java @@ -1,177 +1,177 @@ - -package burp; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; - -/** - * Implementation of IParameter interface. - * - * @author Joaquin R. Martinez - */ -public class Parameter implements IParameter, Cloneable { - - private String name; - protected String value; - protected Type type; - - /** Sets the name of this parameter. - * @param name the name of the parameter. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the value of this parameter. - * @param value the value of thos parameter. - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Types of parameters. - */ - enum Type { - PARAM_URL, PARAM_HEADER, PARAM_MULTIPART, - PARAM_FORM_URL_ENCODED, PARAM_UNKNOWN - } - - /** - * Constructs a new parameter with its given name, value and type. - * @param name the name of the parameter. - * @param value the value of the parameter. - * @param type the type of the parameter. - */ - public Parameter(String name, String value, Type type) { - this.name = name.trim(); - this.value = value.trim(); - this.type = type; - } - - /** - * Constructs a new parameter with empty name, value and PARAM_URL as its type. - */ - public Parameter() { - this.name = ""; - this.value = ""; - this.type = Type.PARAM_URL; - } - /** - * Deprecated - * Deprecated. Use {@link #getParameterType() } instead. - * @deprecated - * @see #getParameterType() - */ - @Override - public byte getType() { - return 0; - } - - /** - * Gets the parameter type. - * @return the type of the parameter. - */ - public Type getParameterType() { - return this.type; - } - - /** Gets the name of this parameter. - * @return the name of the parameter. - */ - @Override - public String getName() { - return this.name; - } - - /** - * Gets the value of this parameter. - * @return the value of this parameter. - */ - @Override - public String getValue() { - return this.value; - } - - /** - * Gets the index where the name stars. - * @return the index where the name starts. - */ - @Override - public int getNameStart() { - return toString().indexOf(this.name); - } - - /** - * Gets the index where the name ends. - * @return the index where the name ends. - */ - @Override - public int getNameEnd() { - return getNameStart() + this.name.length(); - } - - /** - * Gets the index where the value starts. - * @return index where the value starts. - */ - @Override - public int getValueStart() { - return toString().indexOf(this.getValue()); - } - - /** - * Gets the index where the value ends. - * @return the index where the value ends. - */ - @Override - public int getValueEnd() { - return getValueStart() + this.value.length(); - } - - /** - * Gets a string representation of this parameter. - */ - @Override - public String toString() { - StringBuilder a = new StringBuilder(); - if (null == type) - a.append(getName()).append("=").append(getValue()).toString(); - else switch (type) { - case PARAM_MULTIPART: - a.append("Content-Disposition: form-data; name=\"") - .append(this.getName()).append("\"\r\n") - .append("\r\n").append(getValue()).append("\r\n"); - break; - case PARAM_FORM_URL_ENCODED: - case PARAM_URL: - try { - a.append(getName()).append("=").append(URLEncoder.encode(getValue(), "UTF-8")); - } catch (UnsupportedEncodingException ex) {} - break; - case PARAM_HEADER: - a.append(getName()).append(": ").append(getValue()); - break; - default: - a.append(getName()).append("=").append(getValue()).toString(); - break; - } - return a.toString(); - } - - /** - * Constructs a parameter from a string. - * @param t the parameter as a string. - * @return a {@link Parameter} object. - */ - public static Parameter build(String t){ - Parameter parameter = new Parameter(); - String[] split = t.split("="); - if (split.length>=2) { - parameter.setName(split[0]); - parameter.setValue(split[1]); - } - return parameter; - } -} + +package burp; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +/** + * Implementation of IParameter interface. + * + * @author Joaquin R. Martinez + */ +public class Parameter implements IParameter, Cloneable { + + private String name; + protected String value; + protected Type type; + + /** Sets the name of this parameter. + * @param name the name of the parameter. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Sets the value of this parameter. + * @param value the value of thos parameter. + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Types of parameters. + */ + enum Type { + PARAM_URL, PARAM_HEADER, PARAM_MULTIPART, + PARAM_FORM_URL_ENCODED, PARAM_UNKNOWN + } + + /** + * Constructs a new parameter with its given name, value and type. + * @param name the name of the parameter. + * @param value the value of the parameter. + * @param type the type of the parameter. + */ + public Parameter(String name, String value, Type type) { + this.name = name.trim(); + this.value = value.trim(); + this.type = type; + } + + /** + * Constructs a new parameter with empty name, value and PARAM_URL as its type. + */ + public Parameter() { + this.name = ""; + this.value = ""; + this.type = Type.PARAM_URL; + } + /** + * Deprecated + * Deprecated. Use {@link #getParameterType() } instead. + * @deprecated + * @see #getParameterType() + */ + @Override + public byte getType() { + return 0; + } + + /** + * Gets the parameter type. + * @return the type of the parameter. + */ + public Type getParameterType() { + return this.type; + } + + /** Gets the name of this parameter. + * @return the name of the parameter. + */ + @Override + public String getName() { + return this.name; + } + + /** + * Gets the value of this parameter. + * @return the value of this parameter. + */ + @Override + public String getValue() { + return this.value; + } + + /** + * Gets the index where the name stars. + * @return the index where the name starts. + */ + @Override + public int getNameStart() { + return toString().indexOf(this.name); + } + + /** + * Gets the index where the name ends. + * @return the index where the name ends. + */ + @Override + public int getNameEnd() { + return getNameStart() + this.name.length(); + } + + /** + * Gets the index where the value starts. + * @return index where the value starts. + */ + @Override + public int getValueStart() { + return toString().indexOf(this.getValue()); + } + + /** + * Gets the index where the value ends. + * @return the index where the value ends. + */ + @Override + public int getValueEnd() { + return getValueStart() + this.value.length(); + } + + /** + * Gets a string representation of this parameter. + */ + @Override + public String toString() { + StringBuilder a = new StringBuilder(); + if (null == type) + a.append(getName()).append("=").append(getValue()).toString(); + else switch (type) { + case PARAM_MULTIPART: + a.append("Content-Disposition: form-data; name=\"") + .append(this.getName()).append("\"\r\n") + .append("\r\n").append(getValue()).append("\r\n"); + break; + case PARAM_FORM_URL_ENCODED: + case PARAM_URL: + try { + a.append(getName()).append("=").append(URLEncoder.encode(getValue(), "UTF-8")); + } catch (UnsupportedEncodingException ex) {} + break; + case PARAM_HEADER: + a.append(getName()).append(": ").append(getValue()); + break; + default: + a.append(getName()).append("=").append(getValue()).toString(); + break; + } + return a.toString(); + } + + /** + * Constructs a parameter from a string. + * @param t the parameter as a string. + * @return a {@link Parameter} object. + */ + public static Parameter build(String t){ + Parameter parameter = new Parameter(); + String[] split = t.split("="); + if (split.length>=2) { + parameter.setName(split[0]); + parameter.setValue(split[1]); + } + return parameter; + } +} diff --git a/src/burp/Util.java b/src/main/java/burp/Util.java similarity index 65% rename from src/burp/Util.java rename to src/main/java/burp/Util.java index 9222848..1c7a2cf 100644 --- a/src/burp/Util.java +++ b/src/main/java/burp/Util.java @@ -1,138 +1,106 @@ - -package burp; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.SplittableRandom; -/** - * - * @author Joaquin R. Martinez - */ -public class Util { - /** - * Escapes double coutes - * @param escaping the string to escape - * @return the escaped string - */ - public static String escapeDoubleQuotes(String escaping) { - return escaping.replace("\"", "\\\""); - } - /** - * Escapes single quotes - * @param escape the string to escape - * @return the escaped string - */ - public static String escapeSingleQuotes(String escape) { - return escape.replace("'", "\\'"); - } - /** - * Escapes backslashes - * @param escape the string to escape - * @return the escaped string - */ - public static String escapeBackSlashes(String escape){ - return escape.replace("\\", "\\\\"); - } - /** - * Generates a random string (for Multipart requests) - * @param lenght the char number of the random string - * @return the random string - */ - public static String generateRandomString(int lenght) { - SplittableRandom splittableRandom = new SplittableRandom(); - StringBuffer a = new StringBuffer(); - int nextInt, ext; - for (int i = 0; i < lenght; i++) { - nextInt = splittableRandom.nextInt(0, 2); - ext = 'a'; - if (nextInt == 1) { - ext = splittableRandom.nextInt('A', 'Z'); - } else { - ext = splittableRandom.nextInt('a', 'z'); - } - a.append((char) ext); - } - return a.toString(); - } - /** - * Builds objects of Parameters passed as a string - * @param params the string to build - * @return a list of Parameter objects - */ - public static List getParameters(String params) { - LinkedList linkedList = new LinkedList<>(); - if (params != null) { - String[] split = params.split("&"); - for (String split1 : split) { - if (!"".equals(split1)) { - linkedList.add(Parameter.build(split1)); - } - } - } - return linkedList; - } - /** - * Join all parameters with a "&" - * @param p the list of Parameters to join - * @return the joined parameters as a string - */ - public static String joinParameters(List p) { - StringBuffer a = new StringBuffer(); - p.stream().forEach((Parameter next) -> { - a.append(next.toString()).append("&"); - }); - a.deleteCharAt(a.lastIndexOf("&")); - return a.toString(); - } - /** - * Retrieve the content type header or null if not is in list. - * @param p List in to search. - * @return The content type or null. - */ - public static Header getContentType(List
p){ - Parameter.Type type = Parameter.Type.PARAM_UNKNOWN; - for (Iterator
iterator = p.iterator(); iterator.hasNext();) { - Header next = iterator.next(); - String value = next.getValue(); - if ("Content-Type".equals(next.getName())) { - return next; - } - } - return null; - } - /** - * Build a string to a list of Header objects - * @param headers the string to build - * @return a list of Header objects - */ - public static List
parseHeaderList(List headers){ - LinkedList
a = new LinkedList<>(); - headers.stream().map((next) -> Header.build(next)).forEach((build) -> { - a.add(build); - }); - return a; - } - /** - * Converts a list of @{link IParameter} objects to a list of {@link Parameter} objects. - * @param p List od {@link IParameter} objects. - * @return a list of {@link Parameter} objects. - */ - public static List toParameterList(List p){ - LinkedList a = new LinkedList<>(); - for (Iterator iterator = p.iterator(); iterator.hasNext();) { - Parameter next = new Parameter(null, null, Parameter.Type.PARAM_URL); - a.add(next); - } - return a; - } - - /** - * Tries to encode some problematic HTML when adding to a form value or name. - * @param encode the string to encode. - * @return escaped problematic html chars. - */ - public static String encodeHTML(String encode){ - return encode.replace("\"", """); - } -} +package burp; + +import java.util.LinkedList; +import java.util.List; +import java.util.SplittableRandom; +import java.util.stream.Collectors; +/** + * + * @author Joaquin R. Martinez + */ +public class Util { + /** + * Escapes double coutes + * @param escaping the string to escape + * @return the escaped string + */ + public static String escapeDoubleQuotes(String escaping) { + return escaping.replace("\"", "\\\""); + } + /** + * Escapes single quotes + * @param escape the string to escape + * @return the escaped string + */ + public static String escapeSingleQuotes(String escape) { + return escape.replace("'", "\\'"); + } + /** + * Escapes backslashes + * @param escape the string to escape + * @return the escaped string + */ + public static String escapeBackSlashes(String escape){ + return escape.replace("\\", "\\\\"); + } + /** + * Generates a random string (for Multipart requests) + * @param lenght the char number of the random string + * @return the random string + */ + public static String generateRandomString(int lenght) { + SplittableRandom splittableRandom = new SplittableRandom(); + StringBuffer a = new StringBuffer(); + int nextInt, ext; + for (int i = 0; i < lenght; i++) { + nextInt = splittableRandom.nextInt(0, 2); + ext = 'a'; + if (nextInt == 1) { + ext = splittableRandom.nextInt('A', 'Z'); + } else { + ext = splittableRandom.nextInt('a', 'z'); + } + a.append((char) ext); + } + return a.toString(); + } + /** + * Builds objects of Parameters passed as a string + * @param params the string to build + * @return a list of Parameter objects + */ + public static List getParameters(String params) { + LinkedList linkedList = new LinkedList<>(); + if (params != null) { + String[] split = params.split("&"); + for (String split1 : split) { + if (!"".equals(split1)) { + linkedList.add(Parameter.build(split1)); + } + } + } + return linkedList; + } + + /** + * Join all parameters with a "&" + * @param p the list of Parameters to join + * @return the joined parameters as a string + */ + public static String joinParameters(List p) { + return p.stream().map(Parameter::toString) + .collect(Collectors.joining("&")); + } + + /** + * Build a string to a list of Header objects + * @param headers the string to build + * @return a list of Header objects + */ + public static List
parseHeaderList(List headers){ + LinkedList
a = new LinkedList<>(); + headers.stream().map(next -> Header.build(next)).forEach(build -> { + a.add(build); + }); + return a; + } + + /** + * Tries to encode some problematic HTML when adding to a form value or name. + * @param encode the string to encode. + * @return escaped problematic html chars. + */ + public static String encodeHTML(String encode){ + return encode.replace("\"", """); + } +} diff --git a/src/burp/burptab/CloseIcon.java b/src/main/java/burp/burptab/CloseIcon.java similarity index 95% rename from src/burp/burptab/CloseIcon.java rename to src/main/java/burp/burptab/CloseIcon.java index 2c2b8e2..3894c4c 100644 --- a/src/burp/burptab/CloseIcon.java +++ b/src/main/java/burp/burptab/CloseIcon.java @@ -1,31 +1,31 @@ - -package burp.burptab; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import javax.swing.Icon; -/** - * Creates the tab close icon - * @author Joaquin R. Martinez - */ -public class CloseIcon implements Icon { - - @Override - public void paintIcon(Component c, Graphics g, int x, int y) { - g.setColor(Color.RED); - g.drawLine(6, 6, getIconWidth() - 7, getIconHeight() - 7); - g.drawLine(getIconWidth() - 7, 6, 6, getIconHeight() - 7); - } - - @Override - public int getIconWidth() { - return 16; - } - - @Override - public int getIconHeight() { - return 16; - } - -} + +package burp.burptab; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import javax.swing.Icon; +/** + * Creates the tab close icon + * @author Joaquin R. Martinez + */ +public class CloseIcon implements Icon { + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + g.setColor(Color.RED); + g.drawLine(6, 6, getIconWidth() - 7, getIconHeight() - 7); + g.drawLine(getIconWidth() - 7, 6, 6, getIconHeight() - 7); + } + + @Override + public int getIconWidth() { + return 16; + } + + @Override + public int getIconHeight() { + return 16; + } + +} diff --git a/src/burp/burptab/ITabImpl.java b/src/main/java/burp/burptab/ITabImpl.java similarity index 95% rename from src/burp/burptab/ITabImpl.java rename to src/main/java/burp/burptab/ITabImpl.java index 1354bdf..3ce1205 100644 --- a/src/burp/burptab/ITabImpl.java +++ b/src/main/java/burp/burptab/ITabImpl.java @@ -1,43 +1,43 @@ - -package burp.burptab; - -import burp.ITab; -import java.awt.Component; -/** - * - * @author Joaquin R. Martinez - */ -public class ITabImpl implements ITab, Cloneable{ - - private final Component contentComponent; - private final String tabString; - - /** - * Creates a new ITabImpl object with the given title and component. - * @param tabstring the title of the tab. - * @param ui the component shown on this tab. - */ - public ITabImpl(String tabstring, Component ui) { - this.contentComponent = ui; - this.tabString = tabstring; - } - - /** - * Creates a new ITabImpl object with empty title and NULL object as content component. - */ - public ITabImpl() { - this.contentComponent = null; - this.tabString = ""; - } - - @Override - public String getTabCaption() { - return this.tabString; - } - - @Override - public Component getUiComponent() { - return this.contentComponent; - } - -} + +package burp.burptab; + +import burp.ITab; +import java.awt.Component; +/** + * + * @author Joaquin R. Martinez + */ +public class ITabImpl implements ITab, Cloneable{ + + private final Component contentComponent; + private final String tabString; + + /** + * Creates a new ITabImpl object with the given title and component. + * @param tabstring the title of the tab. + * @param ui the component shown on this tab. + */ + public ITabImpl(String tabstring, Component ui) { + this.contentComponent = ui; + this.tabString = tabstring; + } + + /** + * Creates a new ITabImpl object with empty title and NULL object as content component. + */ + public ITabImpl() { + this.contentComponent = null; + this.tabString = ""; + } + + @Override + public String getTabCaption() { + return this.tabString; + } + + @Override + public Component getUiComponent() { + return this.contentComponent; + } + +} diff --git a/src/burp/burptab/PocCreatorTab.java b/src/main/java/burp/burptab/PocCreatorTab.java similarity index 95% rename from src/burp/burptab/PocCreatorTab.java rename to src/main/java/burp/burptab/PocCreatorTab.java index c37ca59..a94631a 100644 --- a/src/burp/burptab/PocCreatorTab.java +++ b/src/main/java/burp/burptab/PocCreatorTab.java @@ -1,174 +1,173 @@ - -package burp.burptab; - -import burp.BurpExtender; -import burp.IExtensionHelpers; -import burp.IHttpRequestResponse; -import burp.IHttpService; -import burp.IHttpServiceImpl; -import burp.IMessageEditor; -import burp.IMessageEditorController; -import burp.IRequestInfo; -import burp.ITextEditor; -import burp.pocs.Pocs; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Set; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import burp.pocs.IPoc; - -/** - * POC Creator tab - * @author Joaquin R. Martinez - */ -public class PocCreatorTab extends JPanel implements ActionListener, ItemListener { - - private final ITextEditor textEditor; - private final IMessageEditor messageEditor; - private final JButton saveButton, copyButton;//, btn_close; - private final JFileChooser saveFileDialog; - private final JComboBox pocTypesCombo; - private final IHttpRequestResponse request; - - /** - * Creates pocString new tab for pocString poc - * - * @param req the request to show on the left - * @param poc the poc code - */ - public PocCreatorTab(IHttpRequestResponse req, byte[] poc) { - super(new BorderLayout(10, 10)); - this.request = req; - this.saveButton = new JButton("save to file"); - this.copyButton = new JButton("copy"); - this.saveButton.setForeground(Color.blue); - this.copyButton.addActionListener(PocCreatorTab.this); - this.saveButton.addActionListener(PocCreatorTab.this); - this.saveFileDialog = new JFileChooser(); - this.pocTypesCombo = new JComboBox<>(); - Iterator pocKeys = Pocs.getPocKeys(); - while (pocKeys.hasNext()) { - this.pocTypesCombo.addItem(pocKeys.next()); - } - this.pocTypesCombo.addItemListener(PocCreatorTab.this); - /*Create pocString TextEditor*/ - this.textEditor = BurpExtender.getBurpExtenderCallbacks().createTextEditor(); - /*Making our message editor great with burp normal popup menu*/ - this.messageEditor = BurpExtender.getBurpExtenderCallbacks().createMessageEditor(new IMessageEditorController() { - @Override - public IHttpService getHttpService() { - IRequestInfo analyzeRequest = BurpExtender.getBurpExtenderCallbacks().getHelpers().analyzeRequest(req); - return new IHttpServiceImpl(analyzeRequest); - } - - @Override - public byte[] getRequest() { - return messageEditor.getMessage(); - } - - @Override - public byte[] getResponse() { - return req.getResponse(); - } - }, true); - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - splitPane.add(this.messageEditor.getComponent()); - splitPane.add(this.textEditor.getComponent()); - PocCreatorTab.this.add("Center", splitPane); - //buttons panel - JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - buttonsPanel.add(new JLabel("PoC type: ")); - buttonsPanel.add(this.pocTypesCombo); - buttonsPanel.add(this.copyButton); - buttonsPanel.add(this.saveButton); - //add buttons to end - PocCreatorTab.this.add("South", buttonsPanel); - this.textEditor.setText(poc); - this.messageEditor.setMessage(req.getRequest(), true); - BurpExtender.getBurpExtenderCallbacks().customizeUiComponent(PocCreatorTab.this);//burp lookandfeel - } - - /** - * When pocString button is clicked into this tab. - * @param e event argument. - */ - @Override - public void actionPerformed(ActionEvent e) { - if (e.getSource() == this.copyButton) { - copy(); - } else if (e.getSource() == this.saveButton) { - save(); - } - } - - /** - * Passes the poc code to the system clipboard - */ - private void copy() { - IExtensionHelpers helpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); - String bytesToString = helpers.bytesToString(this.textEditor.getText()); - Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - systemClipboard.setContents(new StringSelection(bytesToString), null); - } - - /** - * Handler for the 'save' button. - */ - private void save() { - int showSaveDialog = this.saveFileDialog.showSaveDialog(this.textEditor.getComponent()); - if (showSaveDialog == JFileChooser.APPROVE_OPTION) { - try { - File file = this.saveFileDialog.getSelectedFile(); - try (FileWriter fileWriter = new FileWriter(file); - BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)) { - bufferedWriter.write(BurpExtender.getBurpExtenderCallbacks().getHelpers().bytesToString(this.textEditor.getText())); - bufferedWriter.flush(); - fileWriter.flush(); - } - } catch (IOException ex) { - JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE); - } - } - } - - @Override - public void itemStateChanged(ItemEvent e) { - String selectedItem = this.pocTypesCombo.getSelectedItem().toString(); - IPoc poc = Pocs.getPoc(selectedItem); - try { - byte[] pocContent = poc.getPoc(this.request); - this.textEditor.setText(pocContent); - } catch (Exception ex) { - JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE); - } - } - - /** - * Sets the selected poc item. - * @param key the item. - */ - public void setSelectedItem(String key){ - this.pocTypesCombo.setSelectedItem(key); - } - -} + +package burp.burptab; + +import burp.BurpExtender; +import burp.IExtensionHelpers; +import burp.IHttpRequestResponse; +import burp.IHttpService; +import burp.IHttpServiceImpl; +import burp.IMessageEditor; +import burp.IMessageEditorController; +import burp.IRequestInfo; +import burp.ITextEditor; +import burp.pocs.Pocs; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Iterator; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import burp.pocs.IPoc; + +/** + * POC Creator tab + * @author Joaquin R. Martinez + */ +public class PocCreatorTab extends JPanel implements ActionListener, ItemListener { + + private static final long serialVersionUID = 1L; + private final ITextEditor textEditor; + private final IMessageEditor messageEditor; + private final JButton saveButton, copyButton;//, btn_close; + private final JFileChooser saveFileDialog; + private final JComboBox pocTypesCombo; + private final IHttpRequestResponse request; + + /** + * Creates pocString new tab for pocString poc + * + * @param req the request to show on the left + * @param poc the poc code + */ + public PocCreatorTab(IHttpRequestResponse req, byte[] poc) { + super(new BorderLayout(10, 10)); + this.request = req; + this.saveButton = new JButton("save to file"); + this.copyButton = new JButton("copy"); + this.saveButton.setForeground(Color.blue); + this.copyButton.addActionListener(PocCreatorTab.this); + this.saveButton.addActionListener(PocCreatorTab.this); + this.saveFileDialog = new JFileChooser(); + this.pocTypesCombo = new JComboBox<>(); + Iterator pocKeys = Pocs.getPocKeys(); + while (pocKeys.hasNext()) { + this.pocTypesCombo.addItem(pocKeys.next()); + } + this.pocTypesCombo.addItemListener(PocCreatorTab.this); + /*Create pocString TextEditor*/ + this.textEditor = BurpExtender.getBurpExtenderCallbacks().createTextEditor(); + /*Making our message editor great with burp normal popup menu*/ + this.messageEditor = BurpExtender.getBurpExtenderCallbacks().createMessageEditor(new IMessageEditorController() { + @Override + public IHttpService getHttpService() { + IRequestInfo analyzeRequest = BurpExtender.getBurpExtenderCallbacks().getHelpers().analyzeRequest(req); + return new IHttpServiceImpl(analyzeRequest); + } + + @Override + public byte[] getRequest() { + return messageEditor.getMessage(); + } + + @Override + public byte[] getResponse() { + return req.getResponse(); + } + }, true); + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + splitPane.add(this.messageEditor.getComponent()); + splitPane.add(this.textEditor.getComponent()); + PocCreatorTab.this.add("Center", splitPane); + //buttons panel + JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonsPanel.add(new JLabel("PoC type: ")); + buttonsPanel.add(this.pocTypesCombo); + buttonsPanel.add(this.copyButton); + buttonsPanel.add(this.saveButton); + //add buttons to end + PocCreatorTab.this.add("South", buttonsPanel); + this.textEditor.setText(poc); + this.messageEditor.setMessage(req.getRequest(), true); + BurpExtender.getBurpExtenderCallbacks().customizeUiComponent(PocCreatorTab.this);//burp lookandfeel + } + + /** + * When pocString button is clicked into this tab. + * @param e event argument. + */ + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == this.copyButton) { + copy(); + } else if (e.getSource() == this.saveButton) { + save(); + } + } + + /** + * Passes the poc code to the system clipboard + */ + private void copy() { + IExtensionHelpers helpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); + String bytesToString = helpers.bytesToString(this.textEditor.getText()); + Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + systemClipboard.setContents(new StringSelection(bytesToString), null); + } + + /** + * Handler for the 'save' button. + */ + private void save() { + int showSaveDialog = this.saveFileDialog.showSaveDialog(this.textEditor.getComponent()); + if (showSaveDialog == JFileChooser.APPROVE_OPTION) { + try { + File file = this.saveFileDialog.getSelectedFile(); + try (FileWriter fileWriter = new FileWriter(file); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)) { + bufferedWriter.write(BurpExtender.getBurpExtenderCallbacks().getHelpers().bytesToString(this.textEditor.getText())); + bufferedWriter.flush(); + fileWriter.flush(); + } + } catch (IOException ex) { + JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + + @Override + public void itemStateChanged(ItemEvent e) { + String selectedItem = this.pocTypesCombo.getSelectedItem().toString(); + IPoc poc = Pocs.getPoc(selectedItem); + try { + byte[] pocContent = poc.getPoc(this.request); + this.textEditor.setText(pocContent); + } catch (Exception ex) { + JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE); + } + } + + /** + * Sets the selected poc item. + * @param key the item. + */ + public void setSelectedItem(String key){ + this.pocTypesCombo.setSelectedItem(key); + } + +} diff --git a/src/burp/burptab/PocTabManager.java b/src/main/java/burp/burptab/PocTabManager.java similarity index 89% rename from src/burp/burptab/PocTabManager.java rename to src/main/java/burp/burptab/PocTabManager.java index 6594483..a1c8985 100644 --- a/src/burp/burptab/PocTabManager.java +++ b/src/main/java/burp/burptab/PocTabManager.java @@ -1,41 +1,42 @@ - -package burp.burptab; - -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; - -/** - * Creates the CSRF POC CREATOR tab - * @author Joaquin R. Martinez - */ - -public class PocTabManager extends JTabbedPane { - - /** - * Ads pocString new tab within this tab with all requestInfo about the poc - * @param title the title of the tab - * @param pocCreatorTab the tab - */ - public void addTab(final String title, final PocCreatorTab pocCreatorTab) { - super.addTab(title, pocCreatorTab); - int index = getTabCount() - 1; - JPanel tabContainer = new JPanel(); - tabContainer.setOpaque(false); - tabContainer.add(new JLabel(title)); - CloseIcon closeIcon = new CloseIcon(); - JButton closeTabButton = new JButton(closeIcon); - closeTabButton.setPreferredSize(new Dimension(closeIcon.getIconWidth(), closeIcon.getIconHeight())); - closeTabButton.addActionListener((ActionEvent e) -> { - int indexOfTab = indexOfTab(title); //tabs title does not change - if (indexOfTab != -1) { - removeTabAt(indexOfTab); - } - }); - tabContainer.add(closeTabButton); - setTabComponentAt(index, tabContainer); - } -} + +package burp.burptab; + +import java.awt.Dimension; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; + +/** + * Creates the CSRF POC CREATOR tab + * @author Joaquin R. Martinez + */ + +public class PocTabManager extends JTabbedPane { + + private static final long serialVersionUID = 1L; + + /** + * Ads pocString new tab within this tab with all requestInfo about the poc + * @param title the title of the tab + * @param pocCreatorTab the tab + */ + public void addTab(final String title, final PocCreatorTab pocCreatorTab) { + super.addTab(title, pocCreatorTab); + int index = getTabCount() - 1; + JPanel tabContainer = new JPanel(); + tabContainer.setOpaque(false); + tabContainer.add(new JLabel(title)); + CloseIcon closeIcon = new CloseIcon(); + JButton closeTabButton = new JButton(closeIcon); + closeTabButton.setPreferredSize(new Dimension(closeIcon.getIconWidth(), closeIcon.getIconHeight())); + closeTabButton.addActionListener(e -> { + int indexOfTab = indexOfTab(title); //tabs title does not change + if (indexOfTab != -1) { + removeTabAt(indexOfTab); + } + }); + tabContainer.add(closeTabButton); + setTabComponentAt(index, tabContainer); + } +} diff --git a/src/burp/pocs/AjaxPoc.java b/src/main/java/burp/pocs/AjaxPoc.java similarity index 85% rename from src/burp/pocs/AjaxPoc.java rename to src/main/java/burp/pocs/AjaxPoc.java index 7dda5c5..6a2de4e 100644 --- a/src/burp/pocs/AjaxPoc.java +++ b/src/main/java/burp/pocs/AjaxPoc.java @@ -1,83 +1,78 @@ - -package burp.pocs; - -import burp.BurpExtender; -import burp.IExtensionHelpers; -import burp.IHttpRequestResponse; -import burp.IRequestInfo; -import burp.Parameter; -import burp.Util; - -/** - * Ajax CSRF POCs - * - * @author Joaquin R. Martinez - */ -public class AjaxPoc implements IPoc { - - @Override - public byte[] getPoc(final IHttpRequestResponse request) { - IExtensionHelpers iexHelpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); - String lineSeparator = System.lineSeparator(); - StringBuilder pocString = new StringBuilder(); - pocString.append("").append(lineSeparator); - pocString.append("").append(lineSeparator).append(" ").append(lineSeparator); - pocString.append("").append(lineSeparator).append(" \n
").append(lineSeparator); - pocString.append(" ").append(lineSeparator); - pocString.append("
").append(lineSeparator).append(" ").append(lineSeparator).append(""); - return pocString.toString().getBytes(); - } - -} + +package burp.pocs; + +import burp.BurpExtender; +import burp.IExtensionHelpers; +import burp.IHttpRequestResponse; +import burp.IRequestInfo; +import burp.Parameter; +import burp.Util; + +/** + * Ajax CSRF POCs + * + * @author Joaquin R. Martinez + */ +public class AjaxPoc implements IPoc { + + @Override + public byte[] getPoc(final IHttpRequestResponse request) { + IExtensionHelpers iexHelpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); + String lineSeparator = System.lineSeparator(); + StringBuilder pocString = new StringBuilder(); + pocString.append("").append(lineSeparator); + pocString.append("").append(lineSeparator).append(" ").append(lineSeparator); + pocString.append("").append(lineSeparator).append(" \n
").append(lineSeparator); + pocString.append(" ").append(lineSeparator); + pocString.append("
").append(lineSeparator).append(" ").append(lineSeparator).append(""); + return pocString.toString().getBytes(); + } + +} diff --git a/src/burp/pocs/HtmlPoc.java b/src/main/java/burp/pocs/HtmlPoc.java similarity index 88% rename from src/burp/pocs/HtmlPoc.java rename to src/main/java/burp/pocs/HtmlPoc.java index 93fcfc3..f95caf0 100644 --- a/src/burp/pocs/HtmlPoc.java +++ b/src/main/java/burp/pocs/HtmlPoc.java @@ -1,45 +1,44 @@ - -package burp.pocs; - -import burp.BurpExtender; -import burp.IExtensionHelpers; -import burp.IHttpRequestResponse; -import burp.IParameter; -import burp.IRequestInfo; -import burp.Parameter; -import burp.Util; -import java.util.List; - -/** - * HTML CSRF POCs - * - * @author Joaquin R. Martinez - */ -public class HtmlPoc implements IPoc { - - @Override - public byte[] getPoc(final IHttpRequestResponse request) { - IExtensionHelpers iexHelpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); - String lineSep = System.lineSeparator(); - StringBuilder pocString = new StringBuilder(); - IRequestInfo requestInfo = iexHelpers.analyzeRequest(request); - pocString.append("").append(lineSep); - pocString.append("").append(lineSep) - .append(" ").append(lineSep); - pocString.append("").append(lineSep); - pocString.append("\t
").append(lineSep); - // params - List parameters = requestInfo.getParameters(); - parameters.forEach((parameter) -> { - pocString.append("\t\t").append(lineSep); - }); - pocString.append("\t\t").append(lineSep); - pocString.append("\t").append(lineSep).append("").append(lineSep).append(""); - return pocString.toString().getBytes(); - } - -} + +package burp.pocs; + +import burp.BurpExtender; +import burp.IExtensionHelpers; +import burp.IHttpRequestResponse; +import burp.IParameter; +import burp.IRequestInfo; +import burp.Util; +import java.util.List; + +/** + * HTML CSRF POCs + * + * @author Joaquin R. Martinez + */ +public class HtmlPoc implements IPoc { + + @Override + public byte[] getPoc(final IHttpRequestResponse request) { + IExtensionHelpers iexHelpers = BurpExtender.getBurpExtenderCallbacks().getHelpers(); + String lineSep = System.lineSeparator(); + StringBuilder pocString = new StringBuilder(); + IRequestInfo requestInfo = iexHelpers.analyzeRequest(request); + pocString.append("").append(lineSep); + pocString.append("").append(lineSep) + .append(" ").append(lineSep); + pocString.append("").append(lineSep); + pocString.append("\t
").append(lineSep); + // params + List parameters = requestInfo.getParameters(); + parameters.forEach((parameter) -> { + pocString.append("\t\t").append(lineSep); + }); + pocString.append("\t\t").append(lineSep); + pocString.append("\t").append(lineSep).append("").append(lineSep).append(""); + return pocString.toString().getBytes(); + } + +} diff --git a/src/burp/pocs/IPoc.java b/src/main/java/burp/pocs/IPoc.java similarity index 95% rename from src/burp/pocs/IPoc.java rename to src/main/java/burp/pocs/IPoc.java index 2a4ab4e..a700191 100644 --- a/src/burp/pocs/IPoc.java +++ b/src/main/java/burp/pocs/IPoc.java @@ -1,19 +1,19 @@ - -package burp.pocs; - -import burp.IHttpRequestResponse; - -/** - * @author Joaquin R. Martinez - */ -public interface IPoc { - - /** - * Returns the PoC code. - * @param r {@link IHttpRequestResponse} object to use. - * @return the PoC code. - * @throws java.lang.Exception - */ - public byte[] getPoc(final IHttpRequestResponse r) throws Exception; - -} + +package burp.pocs; + +import burp.IHttpRequestResponse; + +/** + * @author Joaquin R. Martinez + */ +public interface IPoc { + + /** + * Returns the PoC code. + * @param r {@link IHttpRequestResponse} object to use. + * @return the PoC code. + * @throws java.lang.Exception + */ + public byte[] getPoc(final IHttpRequestResponse r) throws Exception; + +} diff --git a/src/burp/pocs/Pocs.java b/src/main/java/burp/pocs/Pocs.java similarity index 94% rename from src/burp/pocs/Pocs.java rename to src/main/java/burp/pocs/Pocs.java index e5c7d70..593a458 100644 --- a/src/burp/pocs/Pocs.java +++ b/src/main/java/burp/pocs/Pocs.java @@ -1,52 +1,52 @@ - -package burp.pocs; - -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; - -/** - * Contains all types of PoC's supported by this plugin. - * @author Joaquin R. Martinez - */ -public class Pocs { - - private static final HashMap POCS = new HashMap() ; - private static Pocs poc = null; - - /** - * Inaccesible constructor. - */ - private Pocs() { - Pocs.POCS.put("Ajax",new AjaxPoc()); - Pocs.POCS.put("HTML",new HtmlPoc()); - // Add more kind of PoC's - } - - /** - * Initializes the types of pocs supported. - */ - public static void initialize(){ - if(poc == null){ - Pocs.poc = new Pocs(); - } - } - - /** - * Get the {@link IPoc} object by its key. - * @param key the key of the {@link IPoc}. - * @return the {@link IPoc} object. - */ - public static IPoc getPoc(String key) { - return Pocs.POCS.get(key); - } - - /** - * Get the {@link IPoc} as a {@link Enumeration}. - * @return an {@link Iterator} with the keys of all {@link IPoc} objects. - */ - public static Iterator getPocKeys(){ - return Pocs.POCS.keySet().iterator(); - } - -} + +package burp.pocs; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; + +/** + * Contains all types of PoC's supported by this plugin. + * @author Joaquin R. Martinez + */ +public class Pocs { + + private static final HashMap POCS = new HashMap<>() ; + private static Pocs poc = null; + + /** + * Inaccesible constructor. + */ + private Pocs() { + Pocs.POCS.put("Ajax",new AjaxPoc()); + Pocs.POCS.put("HTML",new HtmlPoc()); + // Add more kind of PoC's + } + + /** + * Initializes the types of pocs supported. + */ + public static void initialize(){ + if(poc == null){ + Pocs.poc = new Pocs(); + } + } + + /** + * Get the {@link IPoc} object by its key. + * @param key the key of the {@link IPoc}. + * @return the {@link IPoc} object. + */ + public static IPoc getPoc(String key) { + return Pocs.POCS.get(key); + } + + /** + * Get the {@link IPoc} as a {@link Enumeration}. + * @return an {@link Iterator} with the keys of all {@link IPoc} objects. + */ + public static Iterator getPocKeys(){ + return Pocs.POCS.keySet().iterator(); + } + +}