示例#1
0
    def create_ui(self):
        cpanel = CreatePanle(self._burpColor)
        self.content_ui = swing.JPanel()

        content_panel = swing.JPanel()
        content_panel.setLayout(BorderLayout())
        text = swing.JLabel(self.option['text'])
        if self.option['type'] == 'file_chooser':
            #fileSelecter
            button = cpanel.create_button(self.option['funcopt']['FNfilter'],
                                          self.option, content_panel)
            button.setPreferredSize(Dimension(40, 40))
        elif self.option['type'] == 'param_list':
            ui = cpanel.create_table_panel(self.option)
            content_panel.add(ui)
        elif self.option['type'] == 'file_loader':
            button = cpanel.create_button(self.option['funcopt']['FNfilter'],
                                          self.option, content_panel)
            button.setPreferredSize(Dimension(40, 40))

        text.setFont(Font("Arial", Font.PLAIN, 12))
        content_panel.add(text, BorderLayout.PAGE_START)
        self.content_ui.setLayout(BorderLayout())
        self.content_ui.add(content_panel)
        if self.option['type'] == 'file_chooser' or self.option[
                'type'] == 'file_loader':
            self.content_ui.add(button, BorderLayout.SOUTH)
示例#2
0
    def helpMenu(self,event):
        self._helpPopup = JFrame('JWT Fuzzer', size=(550, 450) );
        self._helpPopup.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
        helpPanel = JPanel()
        helpPanel.setPreferredSize(Dimension(550, 450))
        helpPanel.setBorder(EmptyBorder(10, 10, 10, 10))
        helpPanel.setLayout(BoxLayout(helpPanel, BoxLayout.Y_AXIS))
        self._helpPopup.setContentPane(helpPanel)
        helpHeadingText = JLabel("<html><h2>JWT Fuzzer</h2></html>")
        authorText = JLabel("<html><p>@author: &lt;pinnace&gt;</p></html>")
        aboutText = JLabel("<html><br /> <p>This extension adds an Intruder payload processor for JWTs.</p><br /></html>")
        repositoryText = JLabel("<html>Documentation and source code:</html>")
        repositoryLink = JLabel("<html>- <a href=\"https://github.com/pinnace/burp-jwt-fuzzhelper-extension\">https://github.com/pinnace/burp-jwt-fuzzhelper-extension</a></html>")
        licenseText = JLabel("<html><br/><p>JWT Fuzzer uses a GPL 3 license. This license does not apply to the dependency below:<p></html>") 
        dependencyLink = JLabel("<html>- <a href=\"https://github.com/jpadilla/pyjwt/blob/master/LICENSE\">pyjwt</a></html>")
        dependencyLink.addMouseListener(ClickListener())
        dependencyLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
        repositoryLink.addMouseListener(ClickListener())
        repositoryLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
        
        helpPanel.add(helpHeadingText)
        helpPanel.add(authorText)
        helpPanel.add(aboutText)
        helpPanel.add(repositoryText)
        helpPanel.add(repositoryLink)
        helpPanel.add(licenseText)
        helpPanel.add(dependencyLink)

        self._helpPopup.setSize(Dimension(550, 450))
        self._helpPopup.pack()
        self._helpPopup.setLocationRelativeTo(None)
        self._helpPopup.setVisible(True)
        return
示例#3
0
    def run(self):
        frame = JFrame('flexible Box',
                       locationRelativeTo=None,
                       defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
        print '\nscreenSize:', Toolkit.getDefaultToolkit().getScreenSize()

        box = Box.createHorizontalBox()
        box.add(Box.createGlue())
        box.add(Box.createRigidArea(Dimension(5, 5)))
        box.add(JLabel('Name:'))
        box.add(Box.createRigidArea(Dimension(5, 5)))
        self.tf = box.add(
            JTextField(
                10  # ,
                #               maximumSize = Dimension(   2000, 20 )
                #               maximumSize = Dimension(  20000, 20 )
                #               maximumSize = Dimension( 200000, 20 )
            ))
        box.add(Box.createRigidArea(Dimension(5, 5)))
        box.add(JButton('Submit', actionPerformed=self.buttonPress))
        box.add(Box.createRigidArea(Dimension(5, 5)))
        box.add(Box.createGlue())

        frame.add(box)
        frame.pack()
        frame.setVisible(1)
示例#4
0
    def __init__(self, parent, title, modal, app):
        JDialog.__init__(self, parent, title, modal)

        #Download and Read Dialog
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        self.getContentPane().setBorder(border)
        self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))

        panel = JPanel()
        panel.setAlignmentX(0.5)
        panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS))
        panel.add(Box.createRigidArea(Dimension(0, 10)))

        self.progressLbl = JLabel(
            app.strings.getString("downloading_and_reading_errors"))
        panel.add(self.progressLbl)

        panel.add(Box.createRigidArea(Dimension(0, 10)))

        self.progressBar = JProgressBar(0, 100, value=0)
        panel.add(self.progressBar)
        self.add(panel)

        self.add(Box.createRigidArea(Dimension(0, 20)))

        cancelBtn = JButton(app.strings.getString("cancel"),
                            ImageProvider.get("cancel"),
                            actionPerformed=app.on_cancelBtn_clicked)
        cancelBtn.setAlignmentX(0.5)
        self.add(cancelBtn)

        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
        self.pack()
示例#5
0
    def __init__(self):  # constructor
        #origing of coordinates
        self.coordx = 10
        self.coordy = 10

        #inintialize values
        self.Canvas = None

        #create panel (what is inside the GUI)
        self.panel = self.getContentPane()
        self.panel.setLayout(GridLayout(9, 2))
        self.setTitle('Subdividing ROIs')

        #define buttons here:
        self.Dapi_files = DefaultListModel()
        mylist = JList(self.Dapi_files, valueChanged=self.open_dapi_image)
        #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        mylist.setLayoutOrientation(JList.VERTICAL)
        mylist.setVisibleRowCount(-1)
        listScroller1 = JScrollPane(mylist)
        listScroller1.setPreferredSize(Dimension(300, 80))

        self.output_files = DefaultListModel()
        mylist2 = JList(self.output_files)
        #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        mylist2.setLayoutOrientation(JList.VERTICAL)
        mylist2.setVisibleRowCount(-1)
        listScroller2 = JScrollPane(mylist2)
        listScroller2.setPreferredSize(Dimension(300, 80))

        quitButton = JButton("Quit", actionPerformed=self.quit)
        selectInputFolderButton = JButton("Select Input",
                                          actionPerformed=self.select_input)
        cubifyROIButton = JButton("Cubify ROI",
                                  actionPerformed=self.cubify_ROI)
        saveButton = JButton("Save ROIs", actionPerformed=self.save)
        summsaveButton = JButton("Save Summary",
                                 actionPerformed=self.save_summary)

        self.textfield1 = JTextField('500')

        #add buttons here
        self.panel.add(listScroller1)
        self.panel.add(listScroller2)
        self.panel.add(selectInputFolderButton)
        self.panel.add(Label("Adjust the size of the ROIs"))
        self.panel.add(self.textfield1)
        self.panel.add(cubifyROIButton)
        self.panel.add(saveButton)
        self.panel.add(summsaveButton)
        self.panel.add(quitButton)

        #self.panel.add(saveButton)
        #self.panel.add(Zslider)

        #other stuff to improve the look
        self.pack()  # packs the frame
        self.setVisible(True)  # shows the JFrame
        self.setLocation(self.coordx, self.coordy)
示例#6
0
    def __init__(self):
        super(BeautifierPanel, self).__init__()
        self.setLayout(BorderLayout())

        self.beautifyTextArea = JTextArea(5, 10)
        self.beautifyTextArea.setLineWrap(True)
        self.beautifyTextArea.setDocument(self.CustomUndoPlainDocument())
        # The undo doesn't work well before replace text. Below is rough fix, so not need to know how undo work for now
        self.beautifyTextArea.setText(" ")
        self.beautifyTextArea.setText("")

        self.undoManager = UndoManager()
        self.beautifyTextArea.getDocument().addUndoableEditListener(
            self.undoManager)
        self.beautifyTextArea.getDocument().addDocumentListener(
            self.BeautifyDocumentListener(self))

        beautifyTextWrapper = JPanel(BorderLayout())
        beautifyScrollPane = JScrollPane(self.beautifyTextArea)
        beautifyTextWrapper.add(beautifyScrollPane, BorderLayout.CENTER)
        self.add(beautifyTextWrapper, BorderLayout.CENTER)

        self.beautifyButton = JButton("Beautify")
        self.beautifyButton.addActionListener(self.beautifyListener)
        self.undoButton = JButton("Undo")
        self.undoButton.addActionListener(self.undoListener)

        formatLabel = JLabel("Format:")
        self.formatsComboBox = JComboBox()
        for f in supportedFormats:
            self.formatsComboBox.addItem(f)

        self.statusLabel = JLabel("Status: Ready")
        preferredDimension = self.statusLabel.getPreferredSize()
        self.statusLabel.setPreferredSize(
            Dimension(preferredDimension.width + 20,
                      preferredDimension.height))
        self.sizeLabel = JLabel("0 B")
        preferredDimension = self.sizeLabel.getPreferredSize()
        self.sizeLabel.setPreferredSize(
            Dimension(preferredDimension.width + 64,
                      preferredDimension.height))
        self.sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT)

        buttonsPanel = JPanel(FlowLayout())
        buttonsPanel.add(formatLabel)
        buttonsPanel.add(self.formatsComboBox)
        buttonsPanel.add(Box.createHorizontalStrut(10))
        buttonsPanel.add(self.beautifyButton)
        buttonsPanel.add(self.undoButton)

        bottomPanel = JPanel(BorderLayout())
        bottomPanel.add(self.statusLabel, BorderLayout.WEST)
        bottomPanel.add(buttonsPanel, BorderLayout.CENTER)
        bottomPanel.add(self.sizeLabel, BorderLayout.EAST)
        self.add(bottomPanel, BorderLayout.SOUTH)

        self.currentBeautifyThread = None
示例#7
0
	def __init__(self,linac_wizard_document):
		#--- linac_wizard_document the parent document for all controllers
		self.linac_wizard_document = linac_wizard_document		
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()		
		#------tables with Seq. names and button
		tables_panel = JPanel(BorderLayout())
		tables_panel.setBorder(etched_border)
		self.first_table = JTable(WS_Records_Table_Model("First "))
		self.last_table = JTable(WS_Records_Table_Model("Last "))
		self.first_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.last_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
		self.first_table.setFillsViewportHeight(true)
		self.last_table.setFillsViewportHeight(true)
		tables01_panel = JPanel(BorderLayout())
		scrl_panel0 = JScrollPane(self.first_table)
		scrl_panel1 = JScrollPane(self.last_table)
		#tables01_panel.add(JScrollPane(self.first_table),BorderLayout.WEST)
		#tables01_panel.add(JScrollPane(self.last_table),BorderLayout.EAST)
		self.first_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
		self.last_table.getCellRenderer(0,0).setHorizontalAlignment(JLabel.CENTER)
		self.first_table.setPreferredScrollableViewportSize(Dimension(120,300))
		self.last_table.setPreferredScrollableViewportSize(Dimension(120,300))
		tables01_panel.add(scrl_panel0,BorderLayout.WEST)
		tables01_panel.add(scrl_panel1,BorderLayout.EAST)	
		tables_button_panel = JPanel(BorderLayout())
		tables_button_panel.add(tables01_panel,BorderLayout.WEST)
		seq_button_panel = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		seq_set_button = JButton(" Set ComboSequence ")	
		seq_button_panel.add(seq_set_button)
		tables_button_panel.add(seq_button_panel,BorderLayout.SOUTH)
		tables_panel.add(tables_button_panel,BorderLayout.NORTH)
		self.main_panel.add(tables_panel,BorderLayout.WEST)
		#--------central panel-------
		cav_amp_phase_button = JButton(" Read Cavities Amp.&Phases from Ext. File ")	
		cav_info_from_scl_tuneup_button = JButton("Get SCL Cav. Amp.&Phases from SCL Long. TuneUp")	
		new_accelerator_button = JButton(" Setup a New Accelerator File ")
		center_buttons_panel0 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel0.add(cav_amp_phase_button)
		center_buttons_panel1 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel1.add(cav_info_from_scl_tuneup_button)			
		center_buttons_panel2 = JPanel(FlowLayout(FlowLayout.CENTER,5,5))
		center_buttons_panel2.add(new_accelerator_button)	
		center_buttons_panel = JPanel(GridLayout(3,1))
		center_buttons_panel.add(center_buttons_panel0)
		center_buttons_panel.add(center_buttons_panel1)
		center_buttons_panel.add(center_buttons_panel2)
		center_panel = JPanel(BorderLayout())		
		center_panel.add(center_buttons_panel,BorderLayout.NORTH)
		self.main_panel.add(center_panel,BorderLayout.CENTER)
		#---------add actions listeners
		seq_set_button.addActionListener(Make_Sequence_Listener(self))
		cav_amp_phase_button.addActionListener(Read_Cav_Amp_Phase_Dict_Listener(self))
		cav_info_from_scl_tuneup_button.addActionListener(Get_SCL_Cav_Amp_Phase_Listener(self))
		new_accelerator_button.addActionListener(SetUp_New_Accelerator_Listener(self))	
示例#8
0
 def __init__(self, width=100, height=100):
     '''
     Constructor
     '''
     self.setSize(width, height)
     self.setMaximumSize(Dimension(width, height))
     self.setMinimumSize(Dimension(width, height))
     self.setPreferredSize(Dimension(width, height))
     self.setBackground(Color(1.0, 1.0, 1.0, 1.0))
     self.setForeground(Color(0.0, 0.0, 0.0, 1.0))
     mouse_handler = PaintArea.MouseHandler(self.update_painting)
     self.addMouseMotionListener(mouse_handler)
     self.addMouseListener(mouse_handler)
示例#9
0
    def createButtonPane(self):
        """Create a new button pane for the message editor tab"""
        self._button_listener = EditorButtonListener(self)

        panel = JPanel()
        panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS))
        panel.setBorder(EmptyBorder(5, 5, 5, 5))

        panel.add(Box.createRigidArea(Dimension(0, 5)))
        type_scroll_pane = JScrollPane(self._type_list_component)
        type_scroll_pane.setMaximumSize(Dimension(200, 100))
        type_scroll_pane.setMinimumSize(Dimension(150, 100))
        panel.add(type_scroll_pane)
        panel.add(Box.createRigidArea(Dimension(0, 3)))

        new_type_panel = JPanel()
        new_type_panel.setLayout(BoxLayout(new_type_panel, BoxLayout.X_AXIS))
        new_type_panel.add(self._new_type_field)
        new_type_panel.add(Box.createRigidArea(Dimension(3, 0)))
        new_type_panel.add(
            self.createButton(
                "New", "new-type", "Save this message's type under a new name"
            )
        )
        new_type_panel.setMaximumSize(Dimension(200, 20))
        new_type_panel.setMinimumSize(Dimension(150, 20))

        panel.add(new_type_panel)

        button_panel = JPanel()
        button_panel.setLayout(FlowLayout())
        if self._editable:
            button_panel.add(
                self.createButton(
                    "Validate", "validate", "Validate the message can be encoded."
                )
            )
        button_panel.add(
            self.createButton("Edit Type", "edit-type", "Edit the message type")
        )
        button_panel.add(
            self.createButton(
                "Reset Message", "reset", "Reset the message and undo changes"
            )
        )
        button_panel.add(
            self.createButton(
                "Clear Type", "clear-type", "Reparse the message with an empty type"
            )
        )
        button_panel.setMinimumSize(Dimension(100, 200))
        button_panel.setPreferredSize(Dimension(200, 1000))

        panel.add(button_panel)

        return panel
示例#10
0
    def test_get_set(self):
        d = Dimension(3, 9)
        self.assertEquals(d.width, 3)
        self.assertEquals(d.height, 9)
        d.width = 42
        self.assertEquals(d.width, 42)
        self.assertEquals(d.height, 9)

        try:
            d.foo
        except AttributeError:
            pass
        else:
            raise AssertionError('d.foo should throw type error')
示例#11
0
    def test_get_set(self):
        d = Dimension(3, 9)
        self.assertEqual(d.width, 3)
        self.assertEqual(d.height, 9)
        d.width = 42
        self.assertEqual(d.width, 42)
        self.assertEqual(d.height, 9)

        try:
            d.foo
        except AttributeError:
            pass
        else:
            raise AssertionError('d.foo should throw type error')
示例#12
0
    def __init__(self, parent, title, modal, app):
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        self.getContentPane().setBorder(border)
        self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))

        #Intro
        falsePositivePng = File.separator.join(
            [app.SCRIPTDIR, "images", "icons", "not_error36.png"])
        introLbl = JMultilineLabel(
            app.strings.getString("manual_false_positives_info"))
        introLbl.setMaxWidth(600)

        #Table
        table = JTable()
        columns = [
            app.strings.getString("Tool"),
            app.strings.getString("Check"),
            app.strings.getString("Error_id"),
            app.strings.getString("OSM_id")
        ]
        self.tableModel = MyTableModel([], columns)
        table.setModel(self.tableModel)
        scrollPane = JScrollPane(table)
        scrollPane.setAlignmentX(0.0)

        #OK button
        btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
        okBtn = JButton("OK",
                        ImageProvider.get("ok"),
                        actionPerformed=self.on_okBtn_clicked)
        btnPanel.add(okBtn)
        btnPanel.setAlignmentX(0.0)

        #Layout
        headerPnl = JPanel()
        headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS))
        headerPnl.add(JLabel(ImageIcon(falsePositivePng)))
        headerPnl.add(Box.createRigidArea(Dimension(10, 0)))
        headerPnl.add(introLbl)
        headerPnl.setAlignmentX(0.0)
        self.add(headerPnl)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(scrollPane)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(btnPanel)

        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
        self.pack()
    def actionPerformed(self, e):
        bugs_tab = self.tabbed_panes[self.key].getComponentAt(1)
        tab_count = str(bugs_tab.getTabCount())

        request_tab = self.view.set_request_tab_pane(self.request_response)
        response_tab = self.view.set_response_tab_pane(self.request_response)
        bugs_tabbed_pane = self.view.set_bugs_tabbed_pane(request_tab, response_tab)

        bugs_tab.add(tab_count, bugs_tabbed_pane)
        index = bugs_tab.indexOfTab(tab_count)
        panel_tab = JPanel(GridBagLayout())
        panel_tab.setOpaque(False)
        label_title = JLabel(tab_count)

        # Create a button to close tab
        button_close = JButton("x")
        button_close.setToolTipText("Close tab")
        button_close.setOpaque(False);
        button_close.setContentAreaFilled(False);
        button_close.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        button_close.setPreferredSize(Dimension(18, 18))
        button_close.setMargin(Insets(0, 0, 0, 0))
        button_close.setForeground(Color.gray)

        panel_tab.add(label_title)
        panel_tab.add(button_close)

        bugs_tab.setTabComponentAt(index, panel_tab)

        button_close.addMouseListener(CloseTab(button_close, bugs_tab))
示例#14
0
    def buildSessionCheck(self, state, callbacks):
        """
        Builds the session check portion of the config page
        """
        rules = JPanel()
        rules.setLayout(None)
        rules.setMaximumSize(Dimension(self.CONFIG_PAGE_WIDTH, 300))

        title = self.getTitle("Session Check", 20, 10)

        check = self.getButton("Check", 20, 50)
        check.addActionListener(self.callbacks.checkButtonClicked)

        resendAll = self.getButton("Resend ALL", 20, 90)
        resendAll.addActionListener(self.callbacks.resendAllButtonClicked)

        fuzz = self.getButton("FUZZ", 20, 130)
        fuzz.addActionListener(self.callbacks.fuzzButtonClicked)

        textarea = self.getTextArea()
        state.sessionCheckTextarea = textarea.viewport.view
        state.sessionCheckTextarea.setText(
            callbacks.loadExtensionSetting("scopeCheckRequest"))

        rules.add(title)
        rules.add(check)
        rules.add(resendAll)
        rules.add(fuzz)
        rules.add(textarea)

        return rules
示例#15
0
    def buildScope(self, state, callbacks):
        """
        Builds the scope pane in the configuration page
        """
        scope = JPanel()
        scope.setLayout(None)
        scope.setMaximumSize(Dimension(self.CONFIG_PAGE_WIDTH, 300))

        title = self.getTitle("Scope Selection", 20, 10)

        refresh = self.getButton("Refresh", 20, 50)
        refresh.addActionListener(self.callbacks.refreshButtonClicked)

        textarea = self.getTextArea()
        state.scopeTextArea = textarea.viewport.view

        scopeText = callbacks.loadExtensionSetting("scopes")
        state.scopeTextArea.setText(scopeText)

        scope.add(title)
        scope.add(refresh)
        scope.add(textarea)

        if scopeText:
            refresh.doClick()  # refresh automatically to save users one click.

        return scope
示例#16
0
 def __init__(self, width, height, isTemporal=False):
     JPanel()
     self.isTemporal = isTemporal
     self.minY = 0.0  # -0.05
     self.minX = 0.0  # -0.02
     self.maxX = 0.5  # 0.52
     self.maxY = 1.0
     self.drawCI = False
     if isTemporal:
         self.title = "Fgt/Hs"
     else:
         self.title = "Fst/He"
     self.labelSelected = True
     self.labelNeutral = False
     self.posColor = Color.RED
     self.neuColor = Color.LIGHT_GRAY
     self.balColor = Color.YELLOW
     self.markerColor = Color.BLUE
     self.exportX = width
     self.exportY = height
     self.chart = self._createEmptyChart()
     self.chart.setAntiAlias(True)
     self.resetData()
     self.cp = ChartPanel(self.chart)
     self.cp.setDisplayToolTips(True)
     self.cp.setPreferredSize(Dimension(width, height))
     self.add(self.cp)
示例#17
0
 def registerExtenderCallbacks(self, callbacks):
     self.hashes = {}
     #self._stdout = PrintWriter(callbacks.getStdout(), True)
     self._callbacks = callbacks
     self._helpers = callbacks.getHelpers()
     self._callbacks.setExtensionName("Password Hash Scanner")
     self._callbacks.registerScannerCheck(self)
     self._fileLocation = None
     self._jPanel = swing.JPanel()
     boxVertical = swing.Box.createVerticalBox()
     boxHorizontal = swing.Box.createHorizontalBox()
     getFileButton = swing.JButton('Open hashout.txt',
                                   actionPerformed=self.getFile)
     self._fileText = swing.JTextArea("", 1, 50)
     boxHorizontal.add(getFileButton)
     boxHorizontal.add(self._fileText)
     boxVertical.add(boxHorizontal)
     boxHorizontal = swing.Box.createHorizontalBox()
     submitQueryButton = swing.JButton('Parse hash file',
                                       actionPerformed=self.hashParse)
     boxHorizontal.add(submitQueryButton)
     boxVertical.add(boxHorizontal)
     boxHorizontal = swing.Box.createHorizontalBox()
     boxHorizontal.add(swing.JLabel("Output"))
     boxVertical.add(boxHorizontal)
     boxHorizontal = swing.Box.createHorizontalBox()
     self._resultsTextArea = swing.JTextArea()
     resultsOutput = swing.JScrollPane(self._resultsTextArea)
     resultsOutput.setPreferredSize(Dimension(500, 200))
     boxHorizontal.add(resultsOutput)
     boxVertical.add(boxHorizontal)
     self._jPanel.add(boxVertical)
     # add the custom tab to Burp's UI
     self._callbacks.addSuiteTab(self)
     return
示例#18
0
    def run(self):

        #-----------------------------------------------------------------------
        # Starting width, height & location of the application frame
        #-----------------------------------------------------------------------
        screenSize = Toolkit.getDefaultToolkit().getScreenSize()
        w = screenSize.width >> 1  # Use 1/2 screen width
        h = screenSize.height >> 1  # and 1/2 screen height
        x = (screenSize.width - w) >> 1  # Top left corner of frame
        y = (screenSize.height - h) >> 1

        #-----------------------------------------------------------------------
        # Center the application frame in the window
        #-----------------------------------------------------------------------
        frame = self.frame = JFrame('WASports_02',
                                    bounds=(x, y, w, h),
                                    defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

        #-----------------------------------------------------------------------
        # Internal frames require us to use a JDesktopPane()
        #-----------------------------------------------------------------------
        desktop = JDesktopPane()

        #-----------------------------------------------------------------------
        # Create our initial internal frame, and add it to the desktop
        #-----------------------------------------------------------------------
        internal = InternalFrame('InternalFrame',
                                 size=Dimension(w >> 1, h >> 1),
                                 location=Point(5, 5))
        desktop.add(internal)

        frame.setContentPane(desktop)
        frame.setVisible(1)
示例#19
0
    def __init__(self, out_of_scope):
        ColumnPanel.__init__(self)

        out_of_scope_list = JList(tuple(out_of_scope))
        self.add(JScrollPane(out_of_scope_list))
        self.setBorder(make_title_border("Out of scope"))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height))
	def __init__(self,top_document,accl):
		#--- top_document is a parent document for all controllers
		self.top_document = top_document
		self.main_loop_controller = self.top_document.main_loop_controller
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#---------------------------------------------
		#---- Cavities' Controllers - only DTLs
		self.cav_acc_scan_controllers = []
		self.cav_wrappers = self.main_loop_controller.cav_wrappers[4:10]
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[0],"FC160"))
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[1],"FC248"))
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[2],"FC334"))
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[3],"FC428"))
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[4],"FC524"))
		self.cav_acc_scan_controllers.append(DTL_Acc_Scan_Cavity_Controller(self,self.cav_wrappers[5],"FC104"))
		#----acceptance scans loop timer
		self.acc_scan_loop_timer = Acc_Scan_Loop_Timer(self)			
		#----------------------------------------------   
		self.tabbedPane = JTabbedPane()		
		self.tabbedPane.add("Cavity",JPanel(BorderLayout()))	
		self.tabbedPane.add("Pattern",JPanel(BorderLayout()))
		#--------------------------------------------------------
		self.cav_table = JTable(Cavities_Table_Model(self))
		self.cav_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.cav_table.setFillsViewportHeight(true)
		self.cav_table.setPreferredScrollableViewportSize(Dimension(500,120))
		self.cav_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self))
		scrl_cav_panel = JScrollPane(self.cav_table)
		#-------------------------------------------------------
		scrl_cav_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"Cavities' Parameters"))
		init_buttons_panel = JPanel(FlowLayout(FlowLayout.LEFT,5,2))
		#---- initialization buttons
		init_selected_cavs_button = JButton("Init Selected Cavs")
		init_selected_cavs_button.addActionListener(Init_Selected_Cavs_Button_Listener(self))
		fc_in_selected_cavs_button = JButton("FC In for Selected Cavs")
		fc_in_selected_cavs_button.addActionListener(FC_In_Selected_Cavs_Button_Listener(self))	
		fc_out_selected_cavs_button = JButton("FC Out for Selected Cavs")
		fc_out_selected_cavs_button.addActionListener(FC_Out_Selected_Cavs_Button_Listener(self))
		init_buttons_panel.add(init_selected_cavs_button)
		init_buttons_panel.add(fc_in_selected_cavs_button)
		init_buttons_panel.add(fc_out_selected_cavs_button)
		#---- start stop buttons panel
		self.start_stop_panel = Start_Stop_Panel(self)
		#-------------------------------------------------
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(init_buttons_panel,BorderLayout.NORTH)
		tmp0_panel.add(scrl_cav_panel,BorderLayout.CENTER)
		tmp0_panel.add(self.start_stop_panel,BorderLayout.SOUTH)
		tmp1_panel = JPanel(BorderLayout())
		tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
		#-------------------------------------------------
		left_panel = JPanel(BorderLayout())
		left_panel.add(tmp1_panel,BorderLayout.WEST)
		#--------------------------------------------------
		self.main_panel.add(left_panel,BorderLayout.WEST)
		self.main_panel.add(self.tabbedPane,BorderLayout.CENTER)
		#----------- loop state
		self.loop_run_state = Acc_Scans_Loop_Run_State()	
示例#21
0
 def __init__(self, top_document, main_loop_controller):
     #--- top_document is a parent document for all controllers
     self.top_document = top_document
     self.main_loop_controller = main_loop_controller
     self.main_panel = JPanel(BorderLayout())
     #----etched border
     etched_border = BorderFactory.createEtchedBorder()
     #----------------------------------------------
     left_panel = JPanel(BorderLayout())
     self.rf_power_table = JTable(RF_Power_Table_Model(self))
     self.rf_power_table.setSelectionMode(
         ListSelectionModel.SINGLE_INTERVAL_SELECTION)
     self.rf_power_table.setFillsViewportHeight(true)
     self.rf_power_table.setPreferredScrollableViewportSize(
         Dimension(800, 240))
     scrl_rf_power_panel = JScrollPane(self.rf_power_table)
     scrl_rf_power_panel.setBorder(
         BorderFactory.createTitledBorder(etched_border, "RF Net Power"))
     self.init_buttons_panel = Init_RF_Power_Controller_Panel(self)
     self.start_stop_panel = Start_Stop_Panel(self)
     tmp0_panel = JPanel(BorderLayout())
     tmp0_panel.add(self.init_buttons_panel, BorderLayout.NORTH)
     tmp0_panel.add(scrl_rf_power_panel, BorderLayout.CENTER)
     tmp0_panel.add(self.start_stop_panel, BorderLayout.SOUTH)
     tmp1_panel = JPanel(BorderLayout())
     tmp1_panel.add(tmp0_panel, BorderLayout.NORTH)
     left_panel.add(tmp1_panel, BorderLayout.WEST)
     #--------------------------------------------------------
     self.main_panel.add(left_panel, BorderLayout.WEST)
     #---- non GUI controllers
     self.loop_run_state = Loop_Run_State()
示例#22
0
def createMainWindow():
    # Create window
    frame = JFrame('Epiphany Core Visualisation',
                   defaultCloseOperation=JFrame.EXIT_ON_CLOSE,
                   size=(660, 675))

    # Main layout
    mainLayout = JPanel()
    frame.add(mainLayout)

    # Title
    #title = JLabel('hello', JLabel.CENTER)
    #mainLayout.add(title)

    # Cores
    corepanel = JPanel(GridLayout(8, 8))
    global cores
    cores = []
    for i in range(0, 64):
        core = JPanel(GridLayout(2, 1))
        core.setPreferredSize(Dimension(80, 80))
        corename = '(' + str(i % 8) + ',' + str(i / 8) + ')'
        namelabel = JLabel(corename, JLabel.CENTER)
        namelabel.setFont(Font("Dialog", Font.PLAIN, 18))
        portname = str(i + MINPORT)
        portlabel = JLabel(portname, JLabel.CENTER)
        portlabel.setFont(Font("Dialog", Font.PLAIN, 16))
        core.add(namelabel)
        core.add(portlabel)
        core.setBackground(Color.BLACK)
        corepanel.add(core)
        cores.append(core)
    mainLayout.add(corepanel)

    frame.visible = True
    def convert_with_custom_size(dataDir):

        dataDir = Settings.dataDir + 'WorkingWithPresentation/ConvertingToTiff/'

        # Instantiate a Presentation object that represents a PPTX file
        pres = Presentation(dataDir + "Aspose.pptx")

        # Instantiate the TiffOptions class
        opts = TiffOptions

        # Setting compression type
        tiff_compression_types = TiffCompressionTypes
        opts.setCompressionType(tiff_compression_types.Default)

        #Setting image DPI
        opts.setDpiX(200)
        opts.setDpiY(100)

        # Set Image Size
        opts.setImageSize(Dimension(1728, 1078))

        # Save the presentation to TIFF with specified image size
        save_format = SaveFormat
        pres.save(dataDir + "Aspose-Custom-Size.tiff", save_format.Tiff, opts)

        print "Document has been converted, please check the output file."
示例#24
0
    def bg(self, panel2, e):
        bground = JFrame()
        bground.setTitle("Change Background")
        bground.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE)
        bground.setSize(350, 100)
        bground.setLocationRelativeTo(None)
        bground.setVisible(True)
        bground.setResizable(False)

        panel = JPanel()
        #panel.setBackground(Color(46, 64, 96))
        bground.getContentPane().add(panel)

        path = JLabel("File:")
        panel.add(path)

        path2 = JTextField()
        path2.setPreferredSize(Dimension(180, 20))
        panel.add(path2)

        browse = JButton("Browse file",
                         actionPerformed=lambda e: self.browse(path2, e))
        panel.add(browse)

        change = JButton(
            "Change",
            actionPerformed=lambda e: self.change(path2.getText(), panel2, e))
        panel.add(change)

        bground.add(panel)
示例#25
0
    def __init__(self, program):
        self.setLayout(BorderLayout())
        title = JLabel(program.title)
        title.setFont(Font("Arial", Font.BOLD, 28))
        title.setHorizontalAlignment(JLabel.CENTER)
        title.setVerticalAlignment(JLabel.CENTER)
        title.setBorder(createEmptyBorder(15, 5, 15, 5))

        if not program.public:
            lbl = JLabel("Private")
            lbl.setFont(Font("Arial", Font.BOLD, 20))
            lbl.setForeground(Color(0xFF2424))
            lbl.setBorder(createEmptyBorder(15, 15, 15, 15))
            leftbox = lbl
        else:
            leftbox = Box.createHorizontalGlue()
        btnbox = TitleBtnBox(program)
        btnbox.setBorder(createEmptyBorder(5, 5, 5, 5))
        self.add(leftbox, BorderLayout.LINE_START)
        self.add(title, BorderLayout.CENTER)
        self.add(btnbox, BorderLayout.LINE_END)

        same_size(leftbox, btnbox)

        self.setMaximumSize(Dimension(99999, self.getPreferredSize().height))
示例#26
0
    def __init__(self, program):
        self.setLayout(GridBagLayout())
        self.setBorder(make_title_border("User-Agent", padding=5))
        btn = JButton("Add to settings")
        ua_text = JTextField(program.user_agent)
        self.add(
            ua_text, make_constraints(weightx=4, fill=GridBagConstraints.HORIZONTAL)
        )
        self.add(btn, make_constraints(weightx=1))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height + 10))

        def add_to_options(event):
            prefix = "Generated by YWH-addon"
            config = json.loads(
                context.callbacks.saveConfigAsJson("proxy.match_replace_rules")
            )

            # remove other YWH addon rules
            match_replace_rules = filter(
                lambda rule: not rule["comment"].startswith(prefix),
                config["proxy"]["match_replace_rules"],
            )
            new_rule = {
                "is_simple_match": False,
                "enabled": True,
                "rule_type": "request_header",
                "string_match": "^User-Agent: (.*)$",
                "string_replace": "User-Agent: $1 {}".format(program.user_agent),
                "comment": "{} for {}".format(prefix, program.slug),
            }
            match_replace_rules.append(new_rule)
            config["proxy"]["match_replace_rules"] = match_replace_rules
            context.callbacks.loadConfigFromJson(json.dumps(config))

        btn.addActionListener(CallbackActionListener(add_to_options))
示例#27
0
    def __init__(self):

        self.holdPanel = JPanel()
        self.topPanel = JPanel()
        self.bottomPanel = JPanel()

        self.holdPanel.setBackground(Color.decode('#dddee6'))
        self.topPanel.setBackground(Color.decode('#dddee6'))
        self.bottomPanel.setBackground(Color.decode('#dddee6'))

        self.topPanel.setPreferredSize(Dimension(300, 30))

        self.regBar = JProgressBar()
        self.gatePassBar = JProgressBar()
        self.regLabel = JLabel('Register : ')
        self.gatepassLabel = JLabel('          Gate Pass : '******'')
        self.gatePercentlabel = JLabel('')

        self.refreshButton = JButton('Refresh',
                                     actionPerformed=self.updateProgress)

        self.regBar.setMinimum(0)
        self.regBar.setMaximum(100)
        self.regBar.setStringPainted(True)

        self.gatePassBar.setMinimum(0)
        self.gatePassBar.setMaximum(100)
        self.gatePassBar.setStringPainted(True)

        self.setLayout(BorderLayout())

        self.updateProgress(None)
示例#28
0
    def __init__(self, program):
        self.setLayout(BorderLayout())

        left_col = RulesBox(program.rules_html)

        right_col = ColumnPanel()

        scopes = ScopesBox(program.scopes)
        right_col.add(scopes)

        if program.out_of_scope:
            out_of_scopes = OutOfScopeBox(program.out_of_scope)
            right_col.add(out_of_scopes)
        if program.user_agent:
            right_col.add(UABox(program))

        reward_stat = FixedRowPanel()
        reward_stat.add(RewardBox(program))
        reward_stat.add(StatsBox(program))
        reward_stat.setMaximumSize(
            Dimension(99999, reward_stat.getPreferredSize().height)
        )

        right_col.add(reward_stat)
        right_col.add(Box.createVerticalGlue())

        cols = FixedRowPanel()
        cols.add(left_col)
        cols.add(right_col)

        self.add(TitleBox(program), BorderLayout.PAGE_START)
        self.add(cols, BorderLayout.CENTER)
示例#29
0
 def create_log_pane(self, logTA):
     lp = swing.JScrollPane(logTA)
     lp.setBorder(EtchedBorder(EtchedBorder.RAISED))
     lp.setVerticalScrollBarPolicy(
         swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS)
     lp.setPreferredSize(Dimension(Short.MAX_VALUE, 60))
     return lp
示例#30
0
    def addLine(self, objectID, category, text):
        """
        Add a new panel containing the text corresponding to one line in the
        ATF file.
        This panel will show the line type (ruling, comment, text,
        translation...), followed by the line content and a group of icons to
        add, edit or remove the line.
        """
        linePanel = JPanel()
        linePanel.setLayout(BorderLayout())

        label = JLabel(category)

        combo = JComboBox(text)
        combo.setEditable(True)
        combo.setPreferredSize(Dimension(500, 20))
        combo.setSize(combo.getPreferredSize())
        combo.setMinimumSize(combo.getPreferredSize())
        combo.setMaximumSize(combo.getPreferredSize())

        buttonsPanel = JPanel()
        addButton = JButton("Add")
        editButton = JButton("Edit")
        deleteButton = JButton("Delete")
        buttonsPanel.add(addButton)
        buttonsPanel.add(editButton)
        buttonsPanel.add(deleteButton)

        linePanel.add(label, BorderLayout.WEST)
        linePanel.add(combo, BorderLayout.CENTER)
        linePanel.add(buttonsPanel, BorderLayout.EAST)

        # Add metadataPanel to object tab in main panel
        self.objectTabs[objectID].add(linePanel)
示例#31
0
 def btnModifyIssues_click(self, *args):
     selectionModel = self.tblIssues.getSelectionModel()
     if selectionModel.isSelectionEmpty():
         return
     report = self.report
     store = report.getStore()
     ft = store.getDefaultFeatureType().getCopy()
     for attr in ft:
         isHidden = not attr.getTags().getBoolean("editable", False)
         attr.setHidden(isHidden)
         #print "%s.isHidden() %s" % (attr.getName(), isHidden)
     f = store.createNewFeature(ft, False)
     dynformManager = DynFormLocator.getDynFormManager()
     x = f.getAsDynObject()
     form = dynformManager.createJDynForm(ft)
     winManager = ToolsSwingLocator.getWindowManager()
     form.asJComponent().setPreferredSize(Dimension(400, 200))
     dialog = winManager.createDialog(form.asJComponent(),
                                      "Modificar incidencias", None,
                                      winManager.BUTTONS_OK_CANCEL)
     dialog.show(winManager.MODE.DIALOG)
     if dialog.getAction() == winManager.BUTTON_OK:
         form.getValues(x)
         for row in xrange(selectionModel.getMinSelectionIndex(),
                           selectionModel.getMaxSelectionIndex() + 1):
             if selectionModel.isSelectedIndex(row):
                 row = self.tblIssues.convertRowIndexToModel(row)
                 issue = report.getIssue(row).getEditable()
                 for attr in ft:
                     if not attr.isHidden():
                         issue.set(attr.getName(), f.get(attr.getName()))
                 report.putIssue(row, issue)
         report.refresh()
示例#32
0
        else:
            SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)


def get_ip():
    if not System.getProperty("os.name").startswith("Linux"):
        ip = socket.gethostbyname(socket.gethostname())
    else:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("8.8.8.8", 53))  # Google's public DNS server
        ip = s.getsockname()[0]
        s.close()

    return ip


d = Dimension(Toolkit.getDefaultToolkit().getScreenSize())
W = int(d.getWidth()) - 1
H = int(d.getHeight()) - 1

rbt = Robot()

if len(sys.argv) == 2:
    PORT = int(sys.argv[1])
else:
    PORT = DEFAULT_PORT

httpd = SocketServer.ThreadingTCPServer(("", PORT), MyHandler)
print "%s:%d" % (get_ip(), PORT)
httpd.serve_forever()
示例#33
0
s5 = String.valueOf(['0', '1', '2', '3', 'a', 'b'], 1, 3)
assert s1 == s2 == s3 == s4 == s5, 'String.valueOf method with different arguments'

print 'call instance methods'
s = String('hello')
assert s.regionMatches(1, 1, 'ell', 0, 3), 'method call with boolean true'
assert s.regionMatches(0, 1, 'ell', 0, 3), 'method call with boolean false'
assert s.regionMatches(1, 'ell', 0, 3), 'method call no boolean'

assert s.regionMatches(1, 1, 'eLl', 0, 3), 'method call ignore case'
assert not s.regionMatches(1, 'eLl', 0, 3), 'should ignore case'

from java.awt import Dimension

print 'get/set fields'
d = Dimension(3,9)
assert d.width == 3 and d.height == 9, 'getting fields'
d.width = 42
assert d.width == 42 and d.height == 9, 'setting fields'

#Make sure non-existent fields fail
try:
    print d.foo
except AttributeError:
    pass
else:
    raise AssertionError, 'd.foo should throw type error'

print 'get/set bean properties'

from javax import swing