Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Blink tab when request is send to extended macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
miroc committed Dec 17, 2016
1 parent 230433a commit f1a9834
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

public class BurpExtender implements IBurpExtender, IHttpListener, IContextMenuFactory, ITab {
private static String EXTENSION_NAME = "ExtendedMacro";
private static String EXTENSION_NAME_TAB_NAME = "Extended Macro";
private static String VERSION = "v0.0.2";
public PrintWriter stdout;
public PrintWriter stderr;
Expand Down Expand Up @@ -64,7 +65,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IContextMenuF
private JCheckBox boxProxy;
private JFormattedTextField delayInput;

private Color headerColor = new Color(229, 137, 0);
static Color BURP_ORANGE = new Color(229, 137, 0);
private Font headerFont = new Font("Nimbus", Font.BOLD, 13);

@Override
Expand Down Expand Up @@ -396,7 +397,7 @@ private void initSettingsGui(JTabbedPane mainTabPane){

JLabel header1 = new JLabel("Tools scope");
header1.setAlignmentX(Component.LEFT_ALIGNMENT);
header1.setForeground(headerColor);
header1.setForeground(BURP_ORANGE);
header1.setFont(headerFont);
header1.setBorder(new EmptyBorder(5, 0, 5, 0));

Expand Down Expand Up @@ -441,7 +442,7 @@ private void initSettingsGui(JTabbedPane mainTabPane){
// Other settings
JLabel header2 = new JLabel("Other settings");
header2.setAlignmentX(Component.LEFT_ALIGNMENT);
header2.setForeground(headerColor);
header2.setForeground(BURP_ORANGE);
header2.setFont(headerFont);
header2.setBorder(new EmptyBorder(5, 0, 5, 0));

Expand Down Expand Up @@ -630,7 +631,7 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {

@Override
public String getTabCaption() {
return EXTENSION_NAME;
return EXTENSION_NAME_TAB_NAME;
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions src/burp/MenuListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public void actionPerformed(ActionEvent actionEvent) {
IHttpRequestResponse persistedMsg = extender.getCallbacks().saveBuffersToTempFiles(msgInfo);
model.addMessage(persistedMsg, extender.getNextMsgId());
}

Utils.blinkTab(extender);

break;

case A_REMOVE_MSG:
Expand Down
44 changes: 44 additions & 0 deletions src/burp/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package burp;
import javax.swing.*;
import java.awt.*;

public class Utils {

public static void blinkTab(ITab iTab){
JTabbedPane tp = (JTabbedPane) iTab.getUiComponent().getParent();
int tabidx = getTabIndex(iTab);
tp.setBackgroundAt(tabidx, BurpExtender.BURP_ORANGE);

// unblink tab in 4 seconds
Thread t1 = new Thread(new Runnable() {
public void run()
{
try {
Thread.sleep(4000);

unblinkTab(iTab);
} catch (InterruptedException e) {
e.printStackTrace();
}

}});
t1.start();
}

public static void unblinkTab(ITab iTab){
JTabbedPane tp = (JTabbedPane) iTab.getUiComponent().getParent();
int tabidx = getTabIndex(iTab);
tp.setBackgroundAt(tabidx, Color.BLACK);
}

private static int getTabIndex(ITab iTab) {
JTabbedPane mom = (JTabbedPane) iTab.getUiComponent().getParent();;
for(int i = 0; i < mom.getTabCount(); ++i) {
if(iTab.getTabCaption().equals(mom.getTitleAt(i))) {
return i;
}
}
return -1;
}

}

0 comments on commit f1a9834

Please sign in to comment.