Пример #1
0
    def registerExtenderCallbacks(self, callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.getHelpers()
        callbacks.setExtensionName("Hello Burp")

        self.panel = JPanel()
        self.label = JLabel("Hello Burp")
        self.buttonOutput = Button("Print to Output",
                                   actionPerformed=self.printToOutput)
        self.buttonErrors = Button("Print to Errors",
                                   actionPerformed=self.printToErrors)
        self.buttonAlerts = Button("Print to Alerts",
                                   actionPerformed=self.printToAlerts)
        self.panel.add(self.label)
        self.panel.add(self.buttonOutput)
        self.panel.add(self.buttonErrors)
        self.panel.add(self.buttonAlerts)

        callbacks.customizeUiComponent(self.panel)
        callbacks.addSuiteTab(self)

        self.stdout = PrintWriter(callbacks.getStdout(), True)
        self.stderr = PrintWriter(callbacks.getStderr(), True)
        burpInfo = callbacks.getBurpVersion()
        self.stdout.println("Hello " + burpInfo[0] + " v" + burpInfo[1] + "." +
                            burpInfo[2] + "!")
Пример #2
0
    def registerExtenderCallbacks(self, callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.getHelpers()
        self.stdout = PrintWriter(callbacks.getStdout(), True)
        self.stderr = PrintWriter(callbacks.getStderr(), True)

        callbacks.setExtensionName('Save URL List')
        self.panel = JPanel()
        self.myLabel = JLabel('Save URL List as a Text File', JLabel.CENTER)
        self.buttonFile = Button('Select File',
                                 actionPerformed=self.selectFile)
        self.buttonSaveProxy = Button('Save All Proxy History',
                                      actionPerformed=self.saveProxy)
        self.buttonSaveSiteTree = Button('Save All Target SiteTree ',
                                         actionPerformed=self.saveSiteTree)
        self.buttonSaveProxyScope = Button('Save In-Scope Proxy History',
                                           actionPerformed=self.saveProxyScope)
        self.buttonSaveSiteTreeScope = Button(
            'Save In-Scope Target SiteTree',
            actionPerformed=self.saveSiteTreeScope)
        self.panel.add(self.myLabel)
        self.panel.add(self.buttonFile)
        self.panel.add(self.buttonSaveProxy)
        self.panel.add(self.buttonSaveSiteTree)
        self.panel.add(self.buttonSaveProxyScope)
        self.panel.add(self.buttonSaveSiteTreeScope)
        callbacks.customizeUiComponent(self.panel)
        callbacks.addSuiteTab(self)
Пример #3
0
 def getUiComponent(self):
     panel = Panel()
     panel.setBackground(Color.gray)
     button = Button('Hello Burp Button!')
     panel.add(button)
     self.callbacks.customizeUiComponent(
         panel)  # customize UI components in line with Burp's UI style
     return panel
Пример #4
0
	def createAndShowGUI(self):
		'''
		Create and display the gui.
		'''
		self.setLayout(FlowLayout())

		serverLabel = Label("BIAFlows host: ");
		serverField =TextField(30)
		serverField.setName('host')
		serverField.setText(self.biaflows.getHost())
		serverField.addTextListener(self)
		publicKeyLabel = Label("public key: ")
		publicKeyField=TextField(40)
		publicKeyField.setName('publicKey')
		publicKeyField.setText(self.biaflows.getPublicKey())
		publicKeyField.addTextListener(self)
		privateKeyLabel = Label("private key: ")
		privateKeyField=TextField(40)
		privateKeyField.setName('privateKey')
		privateKeyField.setEchoChar('*')
		privateKeyField.setText(self.biaflows.getPrivateKey())
		privateKeyField.addTextListener(self)

		closeButton = Button("Disconnect and close")
		closeButton.addActionListener(self)

		self.add(serverLabel)
		self.add(serverField)
		self.add(publicKeyLabel)
		self.add(publicKeyField)
		self.add(privateKeyLabel)
		self.add(privateKeyField)
		self.add(closeButton)
				
		self.setSize(400,250)
		self.setVisible(True)
Пример #5
0
print 'Bad input to __import__ raises a Java exception #27'

try:
    __import__("")
    raise TestFailed
except ValueError:
    pass

print 'xrange implementation is broken for almost any complex case #29'

assert list(xrange(10)[9:1:-1]) == [9, 8, 7, 6, 5, 4, 3, 2]

print 'Trying to assign to a method of a Java instance throws a NullPointerException #30'

from java.awt import Button
b = Button()
try:
    b.setLabel = 4
    raise TestFailed
except TypeError:
    pass

print 'From 1.0.1 to 1.0.2'
print 'A threading test'

from java.lang import Thread


class TestThread(Thread):
    def run(self):
        for i in range(100):
Пример #6
0
#


class TestButtonAction(ActionListener):
    def actionPerformed(self, e):
        textArea.append("Test Button Clicked!\n")


#
# Create the Frame, Panel, Button,
# TextArea, and TestButtonAction objects.
#

frame = Frame("Hello World")
panel = Panel()
button = Button("Test Button")
buttonAction = TestButtonAction()
textArea = TextArea()

#
# Put everything together and show
# the window.
#

button.addActionListener(buttonAction)
panel.add(button)
panel.add(textArea)
frame.add(panel)
frame.pack()
frame.show()
Пример #7
0
#!/usr/bin/env python
# vim: set fileencoding=utf-8

from java.awt import Color
from java.lang import StringBuffer
from java.awt import Button

print("\nButton")

b = Button("label")
print(b.getLabel())
print(b.label)

b.setLabel("new label")
print(b.getLabel())
print(b.label)

b.label = "yet another label"
print(b.getLabel())
print(b.label)

print("\nb")
b.background = Color.RED
print(b.background)

print("\nb2")
b2 = Button(label="label", background=Color.GREEN)
print(b2.background)
def perform_user_qc(in_imp, edges, alt_edges, fixed_anchors_list, params):
	"""allow the user to intervene to fix erroneously identified membrane edges"""
	n_frames = in_imp.getNFrames();
	n_channels = in_imp.getNChannels();
	output_folder = params.output_path;
	current_edges = edges;
	rgbstack = ImageStack(in_imp.getWidth(), in_imp.getHeight());
	if n_frames > 1:
		for tidx in range(n_frames): 
			in_imp.setT(tidx+1);
			ip = in_imp.getProcessor();
			rgbip = ip.convertToRGB();
			rgbstack.addSlice(rgbip);
	else:
		for cidx in range(n_channels):
			in_imp.setC(cidx+1);
			ip = in_imp.getProcessor();
			rgbip = ip.convertToRGB();
			rgbstack.addSlice(rgbip);
	imp = ImagePlus(("RGB " + in_imp.getTitle()), rgbstack);
	IJ.run("Colors...", "foreground=red background=white selection=yellow");
	for tidx in range(imp.getNSlices()):
		imp.setSlice(tidx+1);
		for anchor in params.manual_anchor_positions:
			imp.setRoi(PointRoi(anchor[0], anchor[1]));
			IJ.run(imp, "Draw", "slice");
	imp.show();
	autoset_zoom(imp);
	imp.setPosition(1);
	imp.setRoi(current_edges[0]);
	if n_frames > 1:
		listener = UpdateRoiImageListener(current_edges);
		imp.addImageListener(listener);
	IJ.setTool("freeline");
	do_flip = True;
	while do_flip:
		dialog = NonBlockingGenericDialog("User quality control");
		dialog.enableYesNoCancel("Continue", "Flip all edges");
		dialog.setCancelLabel("Cancel analysis");
		dialog.addMessage("Please redraw the membrane edges as necessary, \n" + 
						"making sure to draw beyond anchor points at either end...\n" + 
						"Click OK when done. ");
		p = Panel();
		but = Button("Flip this edge");
		al = Listener(edges, alt_edges, imp);
		but.addActionListener(al);
		p.add(but);
		dialog.addPanel(p);
		dialog.showDialog();
		if dialog.wasCanceled():
			raise KeyboardInterrupt("Run canceled");
		elif dialog.wasOKed():
			do_flip = False;
		else:
			print("flip edges");
			do_flip = True;
			if n_frames > 1:
				imp.removeImageListener(listener);
			current_edges = alt_edges if (current_edges == edges) else edges;
			imp.setPosition(1);
			imp.setRoi(current_edges[0]);
			if n_frames > 1:
				listener = UpdateRoiImageListener(current_edges);
				imp.addImageListener(listener);

	last_roi = imp.getRoi();
	if n_frames > 1:
		qcd_edges = listener.getRoiList();
		if imp.getNFrames() > imp.getNSlices():
			qcd_edges[imp.getT() - 1] = last_roi;
		else:
			qcd_edges[imp.getZ() - 1] = last_roi;
		imp.removeImageListener(listener);
	else:
		qcd_edges = [last_roi];
	mbio.save_qcd_edges2(qcd_edges, output_folder);
	# next four lines are a quick and dirty hack...
	if n_frames > 1:
		nframes = imp.getNFrames() if imp.getNFrames()>imp.getNSlices() else imp.getNSlices();
	else:
		nframes = n_frames;
	for fridx in range(0, nframes):
		if (qcd_edges[fridx].getType()==Roi.FREELINE) or (qcd_edges[fridx].getType()==Roi.POLYLINE):
			if (fridx == 0) or params.constrain_anchors:
				anchors = params.manual_anchor_positions;
			else:
				anchors = fixed_anchors_list[fridx - 1];
			fixed_anchors = mb.fix_anchors_to_membrane(anchors, qcd_edges[fridx], params);
			fixed_anchors = mb.order_anchors(fixed_anchors, params.manual_anchor_midpoint);
			fixed_anchors_list[fridx] = fixed_anchors;
			poly =  qcd_edges[fridx].getInterpolatedPolygon(0.25, False);
			polypoints = [(x,y) for x,y in zip(poly.xpoints, poly.ypoints)];
			idx = [polypoints.index(fixed_anchors[0]), polypoints.index(fixed_anchors[1])];
			idx.sort();
			polypoints = polypoints[idx[0]:idx[1]];
			newedge = PolygonRoi([x for (x,y) in polypoints], 
									[y for (x,y) in polypoints], 
									Roi.POLYLINE);
			newedge = mb.check_edge_order(anchors, newedge);
			imp.setPosition(fridx + 1);
			imp.setRoi(newedge);
			IJ.run(imp, "Interpolate", "interval=1.0 smooth adjust");
			IJ.run(imp, "Fit Spline", "");
			qcd_edges[fridx] = imp.getRoi();
	mbio.save_qcd_edges2(qcd_edges, output_folder);
	imp.changes = False;
	imp.close();
	return qcd_edges, fixed_anchors_list;
Пример #9
0
	def createAndShowGUI(self):
		'''
		Create and display the gui.
		'''
		layout = GridBagLayout()
		c = GridBagConstraints()
		self.setLayout(layout)
		projectLabel = Label("Project: ")
		c.gridx = 0
		c.gridy = 0
		c.ipady = 5
		c.ipadx = 5
		c.anchor = GridBagConstraints.EAST
		layout.setConstraints(projectLabel, c)
		self.projectChoice = Choice()
		for name in self.projectNames:
			self.projectChoice.add(name)
		c.gridx = 1
		c.gridy = 0
		c.fill = GridBagConstraints.HORIZONTAL 
		layout.setConstraints(self.projectChoice, c)
		storageLabel = Label("Storage: ")
		c.gridx = 0
		c.gridy = 1
		c.fill = GridBagConstraints.NONE 
		c.anchor = GridBagConstraints.EAST
		layout.setConstraints(storageLabel, c)
		self.storageChoice = Choice()
		for name in self.storageNames:
			self.storageChoice.add(name)	
		c.gridx = 1
		c.gridy = 1
		c.fill = GridBagConstraints.HORIZONTAL 
		layout.setConstraints(self.storageChoice, c)
		self.convertToOMETIFCheckBox = Checkbox("convert to OME-TIF", True)
		c.gridx = 1
		c.gridy = 2
		layout.setConstraints(self.convertToOMETIFCheckBox, c)
		self.uploadAsGroundTruthCheckBox = Checkbox("upload as ground-truth images")
		c.gridx = 1
		c.gridy = 3
		layout.setConstraints(self.uploadAsGroundTruthCheckBox, c)
		self.folderTextField = TextField("", 15)
		self.folderTextField.setText("<Image-Folder>")
		c.gridx = 0
		c.gridy = 4
		layout.setConstraints(self.folderTextField, c)
		self.folderTextField.setEditable(False)
		browseButton = Button('Browse...')
		browseButton.addActionListener(self)
		c.gridx = 1
		c.gridy = 4
		layout.setConstraints(browseButton, c)
		statusLabel = Label("Status:")
		c.gridy = 5
		c.gridx = 0
		c.fill = GridBagConstraints.NONE 
		c.anchor = GridBagConstraints.EAST
		layout.setConstraints(statusLabel, c)
		self.statusTextField = TextField("Select a folder!", 20)
		c.gridy = 5
		c.gridx = 1
		c.fill = GridBagConstraints.HORIZONTAL 
		layout.setConstraints(self.statusTextField, c)
		self.statusTextField.setEditable(False)
		self.uploadButton = Button("Upload Images")
		self.uploadButton.addActionListener(self)
		c.gridwidth = 2
		c.gridheight = 2
		c.gridy = 6
		c.gridx = 0
		c.weighty = 1.0
		layout.setConstraints(self.uploadButton, c)
		self.add(projectLabel)
		self.add(self.projectChoice)
		self.add(storageLabel)
		self.add(self.storageChoice)
		self.add(self.convertToOMETIFCheckBox)
		self.add(self.uploadAsGroundTruthCheckBox)
		self.add(self.folderTextField)
		self.add(browseButton)
		self.add(statusLabel)
		self.add(self.statusTextField)
		self.add(self.uploadButton)
		self.setSize(400,300)
		self.setVisible(True)