예제 #1
0
    def asNodeJSRequest(self, event):
        headers = self.headersDict()
        formatted_headers = '\n    '.join(
            ["'" + i + "': '" + headers.get(i) + "'," for i in headers])
        payload = self.payload.replace("\n", "").replace("\t", "")
        to_copy = '''var request = require('request');
var options = {{
  'method': '{method}',
  'url': '{url}',
  'headers': {{
    {headers}
  }},
  body: JSON.stringify({payload})

}};
request(options, function (error, response) {{
  if (error) throw new Error(error);
  console.log(response.body);
}});
'''.format(url=self.url,
           payload=payload,
           method=self.method,
           headers=formatted_headers)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #2
0
 def paintComponent(self, g2d):
     self.super__paintComponent(g2d)
     g2d.drawImage(self.surface, 0, 0, None)
     try:
         Toolkit.getDefaultToolkit().sync()
     except:
         pass
예제 #3
0
    def getSentUrl(self, event):
        subs = set()
        for selectedMessage in self.contextMenuInvocation.getSelectedMessages(
        ):
            if (selectedMessage.getHttpService() != None):
                try:
                    url = self.scannerInstance._helpers.analyzeRequest(
                        selectedMessage.getHttpService(),
                        selectedMessage.getRequest()).getUrl()

                    subDomain = urlparse(url.toString()).hostname
                    subs.add(subDomain)
                except:
                    self.scannerInstance._callbacks.issueAlert(
                        "Cannot get URL from the currently selected message " +
                        str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
            else:
                self.scannerInstance._callbacks.issueAlert(
                    "The selected request is null.")

        subs = sorted(subs)
        clipboardContent = ""
        for s in subs:
            clipboardContent = clipboardContent + s + "\n"

        if clipboardContent != "":
            clipboardContent = clipboardContent[:-1]  # remove last \n
            Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
                StringSelection(clipboardContent), None)
예제 #4
0
    def done(self):
        try:
            self.get()  #raise exception if abnormal completion
            awtToolkit.getDefaultToolkit().beep()

            RM = RoiManager()
            rm = RM.getRoiManager()
            self.super__setProgress(100) #
            rm.runCommand(self.imp,"Show All without labels")

            ### We save a temporary RoiSet
            temp_roi_path = gvars['tempFile']
            rm.runCommand("Save", temp_roi_path)
            print "Temp ROIs Saved"

            # We change visibility from frame2 to frame3 once the labelToRoi finishes loading rois
            frame3.setVisible(True)
            frame2.setVisible(False)

            # Enable frame3 buttons in GUI after loading
            f2_btn_original.setEnabled( 1 )
            f2_btn_label.setEnabled( 1 )
            f2_btn_prev.setEnabled( 1 )
            f2_btn_next.setEnabled( 1 )

        except ExecutionException, e:
            raise SystemExit, e.getCause()
예제 #5
0
    def asJQueryAjax(self, event):
        headers = self.headersDict()
        formatted_headers = '\n    '.join(
            ["\"" + i + "\": \"" + headers.get(i) + "\"," for i in headers])
        payload = self.payload.replace("\n", "").replace("\t", "")
        to_copy = '''var settings = {{
  "url": "{url}",
  "method": "{method}",
  "timeout": 0,
  "headers": {{
    {headers}
  }},
  "data": JSON.stringify({payload})
}};

$.ajax(settings).done(function (response) {{
  console.log(response);
}});
'''.format(url=self.url,
           payload=payload,
           method=self.method,
           headers=formatted_headers)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #6
0
    def asPerl(self, event):
        headers = self.headersDict()
        cookies = headers.get('Cookie')
        if cookies:
            cookies = cookies.split('; ')
            cookies = dict(item.split('=') for item in cookies)
            headers.pop('Cookie')
            path = "/"
            parts = self.url.split('://', 1)
            if ':' in parts[1]:
                url = parts[0] + '://' + parts[1].split(':', 1)[0]
            else:
                url = parts[0] + '://' + parts[1].split('/', 1)[0]

            cookies = '\n'.join([
                "$cookies->set_cookie(0,\"" + key + "\", \"" +
                cookies.get(key) + "\", \"" + path + "\", \"" + url + "\");"
                for key in cookies
            ])

        formatted_headers = '\n'.join([
            "$req->header(\"" + i + "\" => \"" + headers.get(i) + "\");"
            for i in headers
        ])
        payload = self.payload.replace("\n",
                                       "").replace("\t",
                                                   "").replace('"', '\\"')
        to_copy = '''use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Cookies;

my $url = URI->new("{url}");

my $cookies = HTTP::Cookies->new();
{cookies}

my $ua = LWP::UserAgent->new();
$ua->cookie_jar($cookies);

my $req = {method} $url;
{headers}
$req->content("{payload}");
my $resp = $ua->request($req);

print "Status code : ".$resp->code."\\n";
print "Response body : ".$resp->content."\\n";

'''.format(url=self.url,
           payload=payload,
           method=self.method,
           headers=formatted_headers,
           cookies=cookies)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #7
0
    def copyToClipboard(self, data, sleep=False):
        if sleep is True:
            time.sleep(1.5)

        data = self.helpers.bytesToString(data)
        systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        systemSelection = Toolkit.getDefaultToolkit().getSystemSelection()
        transferText = StringSelection(data)
        systemClipboard.setContents(transferText, None)
        systemSelection.setContents(transferText, None)
예제 #8
0
    def done(self):
        try:
            self.get()  #raise exception if abnormal completion
            awtToolkit.getDefaultToolkit().beep()

            if gvars["total label files"] > 0:
                JOptionPane.showMessageDialog(None, "Processing complete. Files saved to:\n%s" % gvars['path_multiple_image_directory'])
            else:
                JOptionPane.showMessageDialog(None, "No label images were found")
        except ExecutionException, e:
            raise SystemExit, e.getCause()
예제 #9
0
    def drawObjects(self, g):
        
        g.drawImage(self.apple, self.apple_x, self.apple_y, self)

        for z in range(self.dots):
            if (z == 0):
                g.drawImage(self.head, x[z], y[z], self)
            else:
                g.drawImage(self.ball, x[z], y[z], self)

        Toolkit.getDefaultToolkit().sync()
        g.dispose()
예제 #10
0
파일: sqldude.py 프로젝트: faffi/scripts
	def menuItemClicked(self, caption, messageInfo):
		msg = messageInfo[0]
		request = ''.join(map(chr, (msg.getRequest())))
		headers, body = request.split('\r\n\r\n')
		headers = dict(item.split(': ') for item in headers.split('\r\n')[1:])
		payload = ('python sqlmap.py -u "%s" --cookie="%s"' % (msg.getUrl(), headers['Cookie']))
		if body is not None and len(body) > 0: #query string is in body
			payload = '%s --data="%s"' % (payload, body)
		s = StringSelection(payload)
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard
		print(payload) #print string
		return
예제 #11
0
    def copyToClipboard(self, data, sleep=False):
        if sleep is True:
            time.sleep(1.5)

        # Fix line endings of the headers
        data = self.helpers.bytesToString(data).replace('\r\n', '\n')

        systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        systemSelection = Toolkit.getDefaultToolkit().getSystemSelection()
        transferText = StringSelection(data)
        systemClipboard.setContents(transferText, None)
        systemSelection.setContents(transferText, None)
예제 #12
0
    def drawObjects(self, g):

        g.drawImage(self.apple, self.apple_x, self.apple_y, self)

        for z in range(self.dots):
            if (z == 0):
                g.drawImage(self.head, x[z], y[z], self)
            else:
                g.drawImage(self.ball, x[z], y[z], self)

        Toolkit.getDefaultToolkit().sync()
        g.dispose()
예제 #13
0
    def asCURL(self, event):
        headers = self.headersDict()
        formatted_headers = ' \\\n'.join(
            ["--header '" + i + ": " + headers.get(i) + "'" for i in headers])
        to_copy = "curl -i -s -k --location --request {method} '{url}' \\\n{headers} \\\n--data-raw '{payload}'".format(
            method=self.method,
            url=self.url,
            headers=formatted_headers,
            payload=self.payload)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #14
0
    def asWget(self, event):
        headers = self.headersDict()
        formatted_headers = ' \\\n'.join(
            ["--header '" + i + ": " + headers.get(i) + "'" for i in headers])
        payload = self.payload.replace('"', '\\"')
        to_copy = '''wget --no-check-certificate --quiet \\\n--method {method} --timeout=0 \\\n--body-data '{payload}' \\\n{headers} \\\n{url}'''.format(
            url=self.url,
            payload=payload,
            method=self.method,
            headers=formatted_headers)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #15
0
파일: curlit.py 프로젝트: 0x24bin/BurpSuite
	def _build(self):
		#Grab first selected message, bail if none

		iRequestInfo = self._helpers.analyzeRequest(self.ctxMenuInvocation.getSelectedMessages()[0])
		self.body = ''.join(map(chr, self.ctxMenuInvocation.getSelectedMessages()[0].getRequest())).split('\r\n\r\n')[1]
		if iRequestInfo is None:
			return 
		
		#Build payload - add your static flags here, like -s or -i
		payload = ('curl -isk ') # % (msg.getUrl()))
		#Turn all headers into dictionary, remove BLACKLISTed ones
		headers = dict(item.split(': ') for item in iRequestInfo.getHeaders()[1:])
		headers = dict( (k,v) for k, v in headers.iteritems() if k not in self.BLACKLIST )
		#print('Whitelisted Headers:\n\t' + '\n\t'.join(headers))

		#om nom cookies
		cookies = [c for c in iRequestInfo.getParameters() if c.getType() == IParameter.PARAM_COOKIE]
		#print('Found Cookies:\n\t' + '\n\t'.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies]))


		#print('DEBUG: Dumping All Parms')
		#for p in iRequestInfo.getParameters(): print ('\t%s : %s - %d' % (p.getName(), p.getValue(), p.getType()))

		#Set other command line args
		self.OPTS['-X'] = iRequestInfo.getMethod() 
		self.OPTS['-b'] = '; '.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies])

		#Add all the headers to the payload
		for k,v in headers.iteritems(): payload += '-H \'%s: %s\' \\\n' % (k, v)

		#Invoke handlers to handle content type
		#print('content type: ' + str(iRequestInfo.getContentType()))
		reqType = iRequestInfo.getContentType()
		#print("Content Type Found: %d" % reqType)
		if reqType in self.fMap:
			#print('Invoking %s' % self.fMap[reqType].func_name)
			self.fMap[reqType](iRequestInfo)

		#Add all the OPTS to the payload
		for k,v, in self.OPTS.iteritems(): payload += ('%s \'%s\' \\\n' % (k, v))

		#Append URL to end of payload
		payload += '"%s"' % iRequestInfo.getUrl().toString()
		#Nasty - invocation of some java code to get the string on the clipboard
		s = StringSelection(payload)
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard
		print(payload) #print string

		self.OPTS = {}
예제 #16
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)
예제 #17
0
 def copySelected(self):
     selected = self.getSelectedElements(True)
     if len(selected) > 0:
         cb.callbacks.printOutput("Copied to clipboard:")
         cb.callbacks.printOutput(selected)
         clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
         clipboard.setContents(StringSelection(selected), None)
예제 #18
0
    def pasteHelper(self):
        # import string
        # ugly work to get the text from the clipboard
        toolkit = Toolkit.getDefaultToolkit()
        clipboardContents = toolkit.getSystemClipboard().getContents(self)
        flavor = clipboardContents.getTransferDataFlavors()

        # flavor is an array of types of representations of data
        # we must find a string representation
        i = 0
        j = None
        for a in flavor:
            if clipboardContents.getTransferData(flavor[i]).__class__ == PyString:
                j = i
            i += 1

        if not j is None:
            clipboardText = clipboardContents.getTransferData(flavor[j])
            # split to remove anything after the newline, if it's multiline

            removeNewline = string.split(clipboardText, "\n")
            self.textToPaste = removeNewline[0]
        else:
            self.textToPaste = ""
            print "\a"
예제 #19
0
파일: NammuView.py 프로젝트: oracc/nammu
    def __init__(self, controller):
        # Give reference to controller to delegate action response
        self.controller = controller

        # All window components apart from the menu will go in the JFrame's
        # content pane
        self.setLayout(BorderLayout())

        # Get key bindings configuration from settings
        key_strokes = self.controller.config['keystrokes']

        # Configure key bindings for undo/redo
        # First decide when key bindings can be triggered:
        condition = JComponent.WHEN_IN_FOCUSED_WINDOW

        # InputMap maps key strokes to actions in string format (e.g. 'undo')
        # ActionMap maps string actions (e.g. 'undo') with a custom
        # AbstractAction subclass.
        pane = self.getContentPane()
        for action, key in key_strokes.iteritems():
            key_stroke = KeyStroke.getKeyStroke(
                        getattr(KeyEvent, key),
                        Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
            pane.getInputMap(condition).put(key_stroke, action)
            pane.getActionMap().put(action, KeyStrokeAction(self, action))
예제 #20
0
파일: ashdi.py 프로젝트: sjp38/ash
def getScreenPanel():
    global mainScreen
    global scrPanel
    if not scrPanel:
        mainScreen = JButton()
        cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB)
        blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor")
        mainScreen.setCursor(blankCursor)
        mainScreen.setPreferredSize(
                Dimension(700, 700))
        image = BufferedImage(700, 700, BufferedImage.TYPE_INT_ARGB)
        g = image.createGraphics()
        g.setColor(Color.BLACK)
        g.fillRect(0, 0, 700, 700)
        g.setColor(Color.WHITE)
        g.setFont(Font("Serif", Font.BOLD, 20))
        g.drawString("Move your mouse here to controlfocused device.", 50, 30)
        mainScreenImg = image
        mainScreen.setIcon(swing.ImageIcon(image))

        mouseListener = ScrMouseListener()
        mainScreen.addMouseListener(mouseListener)
        mainScreen.addMouseMotionListener(mouseListener)
        mainScreen.addMouseWheelListener(mouseListener)

        mainScreen.setFocusable(True)
        keyListener = ScrKeyListener()
        mainScreen.addKeyListener(keyListener)


        scrPanel = JPanel()
        scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS))
        scrPanel.add(mainScreen)
        scrPanel.setFocusable(True)
    return scrPanel
예제 #21
0
 def btnCopyToClipboard_click(self, event):
     if self.lastPoint == None:
         return
     s = "%s %s" % (self.txtX.getText(), self.txtY.getText())
     ss = StringSelection(s)
     clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard()
     clpbrd.setContents(ss, None)
예제 #22
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_00',
            bounds = ( x, y, w, h ),
            defaultCloseOperation = JFrame.EXIT_ON_CLOSE
        )
        #-----------------------------------------------------------------------
        # Internal frames require us to use a JDesktopPane()
        #-----------------------------------------------------------------------
        desktop = JDesktopPane()

        frame.setContentPane( desktop )
        frame.setVisible( 1 )
예제 #23
0
파일: gen_uuid.py 프로젝트: f0cker/gen-uuid
    def genUUID(self, event):
        """
        Generate the UUID string

        Parameters
        ----------
        version: int
            UUID version to use
        """
        version = 4
        if version == 1:
            genuuid = uuid.uuid1()
        elif version == 2:
            genuuid = uuid.uuid2()
        elif version == 3:
            genuuid = uuid.uuid3()
        elif version == 4:
            genuuid = uuid.uuid4()
        elif version == 5:
            genuuid = uuid.uuid5()
        else:
            genuuid = None
        #print(dir(self.copy_to_clipboard))
        #return genuuid.hex
        #self.stdout.println(genuuid.hex)
        clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        clipboard.setContents(StringSelection(str(genuuid)), None)
        print('Generated UUI: {}'.format(genuuid))
예제 #24
0
 def run(self):
     #-----------------------------------------------------------------------
     # First, we determine the size & location of the application frame
     #-----------------------------------------------------------------------
     screenSize = Toolkit.getDefaultToolkit().getScreenSize()
     w = screenSize.width >> 1  # 1/2 screen width
     h = screenSize.height >> 1  # 1/2 screen height
     x = (screenSize.width - w) >> 1
     y = (screenSize.height - h) >> 1
     frame = JFrame(
         'iFrameEvents2',
         bounds=(x, y, w, h),  # location & size
         defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
     #-----------------------------------------------------------------------
     # Next, we create, and add the menubar
     #-----------------------------------------------------------------------
     frame.setJMenuBar(self.menuBar())
     #-----------------------------------------------------------------------
     # Then, we replace the frame ContentPane with a JDesktopPane instance
     # for all of the inner frames, and populate it with our eventLogger
     # inner frame instance.
     #-----------------------------------------------------------------------
     self.desktop = desktop = JDesktopPane()
     self.logger = eventLogger()
     desktop.add(self.logger, 0, 0)
     frame.setContentPane(desktop)
     #-----------------------------------------------------------------------
     # Initialize the number of inner frames created
     #-----------------------------------------------------------------------
     self.iFrameCount = 0
     frame.setVisible(1)
예제 #25
0
def popup_translate(control, query, src, dst, message, selection, text, context, invoker, from_clipboard):

    editor = False

    result, result_src = translate(query, src, dst)
    cb.callbacks.printOutput('[%s] %s --> [%s] %s' % (result_src, query.decode(
        'utf-8', 'strict'), dst, result.decode('utf-8', 'strict')))

    if (context == invoker.CONTEXT_MESSAGE_EDITOR_REQUEST or
            context == invoker.CONTEXT_MESSAGE_EDITOR_RESPONSE
        ) and from_clipboard == False:
        editor = True
        buttons = ['Replace Original', 'Copy to Clipboard', 'OK']
    else:
        buttons = ['Copy to Clipboard', 'OK']
    label = JLabel('<html>%s to %s:<br><br><b>%s</b><br><br><img border=0 src="file:///%s/color-short.png"></html>' %
                   (result_src, dst, result.decode('utf-8', 'strict'), get_script_dir()))

    label.addMouseListener(mouseAdapter())

    popup_result = JOptionPane.showOptionDialog(control, label, '%s' % (
        BurpExtender.extension_name), 0, JOptionPane.PLAIN_MESSAGE, None, buttons, None)
    if (editor is True and popup_result == 1) or (editor is False and popup_result == 0):
        clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        clipboard.setContents(StringSelection(result), None)
    elif (editor is True and popup_result == 0):
        if context == invoker.CONTEXT_MESSAGE_EDITOR_REQUEST:
            setter = message.setRequest
        else:
            setter = message.setResponse
        setter(cb.helpers.stringToBytes(
            text[:selection[0]] + result + text[selection[1]:]))
예제 #26
0
    def pasteHelper(self):
        #import string
        #ugly work to get the text from the clipboard
        toolkit = Toolkit.getDefaultToolkit()
        clipboardContents = toolkit.getSystemClipboard().getContents(self)
        flavor = clipboardContents.getTransferDataFlavors()



        #flavor is an array of types of representations of data
        #we must find a string representation
        i = 0
        j = None
        for a in flavor:
            if clipboardContents.getTransferData(flavor[i]).__class__ == PyString:
                j = i
            i += 1

        if not j is None:
            clipboardText = clipboardContents.getTransferData(flavor[j])
            #split to remove anything after the newline, if it's multiline

            removeNewline = string.split(clipboardText, '\n')
            self.textToPaste = removeNewline[0]
        else:
            self.textToPaste = ''
            print '\a'
예제 #27
0
 def DPwCopy(self, e):
     rows = self._jDTable.getSelectedRows().tolist()
     if len(rows) == 0:
         swing.JOptionPane.showMessageDialog(
             self._jScanPanel,
             "You have to select one in order to open URL", "Error",
             swing.JOptionPane.ERROR_MESSAGE, None)
         return
     elif len(rows) > 1:
         swing.JOptionPane.showMessageDialog(
             self._jScanPanel, "You have to select only one item", "Error",
             swing.JOptionPane.ERROR_MESSAGE, None)
         return
     else:
         Ids = self._jDTabledata.getIds()
         com = Ids[rows[0]]
         tmplist = self._jDTabledata.getValue(com)
         Pw = tmplist[3]
         toolkit = Toolkit.getDefaultToolkit()
         clipboard = toolkit.getSystemClipboard()
         clipboard.setContents(StringSelection(Pw), None)
         swing.JOptionPane.showMessageDialog(
             self.panel,
             "Password is copied to clipboard, Use Ctrl+V into the password form",
             "Success", swing.JOptionPane.INFORMATION_MESSAGE, None)
예제 #28
0
 def actionPerformed(self, e):
     stringSelection = StringSelection(
         str(
             self._extender._helpers.analyzeRequest(
                 self._extender._currentlyDisplayedItem).getUrl()))
     clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard()
     clpbrd.setContents(stringSelection, None)
예제 #29
0
    def __init__(self, controller):
        # Give reference to controller to delegate action response
        self.controller = controller

        # All window components apart from the menu will go in the JFrame's
        # content pane
        self.setLayout(BorderLayout())

        # Get key bindings configuration from settings
        key_strokes = self.controller.config['keystrokes']

        # Configure key bindings for undo/redo
        # First decide when key bindings can be triggered:
        condition = JComponent.WHEN_IN_FOCUSED_WINDOW

        # InputMap maps key strokes to actions in string format (e.g. 'undo')
        # ActionMap maps string actions (e.g. 'undo') with a custom
        # AbstractAction subclass.
        pane = self.getContentPane()
        for action, key in key_strokes.iteritems():
            key_stroke = KeyStroke.getKeyStroke(
                getattr(KeyEvent, key),
                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
            pane.getInputMap(condition).put(key_stroke, action)
            pane.getActionMap().put(action, KeyStrokeAction(self, action))
예제 #30
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)
예제 #31
0
    def asGO(self, event):
        headers = self.headersDict()
        formatted_headers = '\n  '.join([
            "req.Header.Add(\"" + i + "\", \"" + headers.get(i) + "\")"
            for i in headers
        ])
        payload = self.payload.replace("\n",
                                       "").replace("\t",
                                                   "").replace('"', '\\"')
        to_copy = '''package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {{

  url := "{url}"
  method := "{method}"

  payload := strings.NewReader("{payload}")

  client := &http.Client {{
  }}
  req, err := http.NewRequest(method, url, payload)

  if err != nil {{
    fmt.Println(err)
  }}
  {headers}

  res, err := client.Do(req)
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)

  fmt.Println(string(body))
}}'''.format(url=self.url,
             payload=payload,
             method=self.method,
             headers=formatted_headers)  # noqa

        # Copy to clipboard
        s = StringSelection(to_copy)
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s)
예제 #32
0
 def startListening(self):        
     class PhysicalEventListener(AWTEventListener):
         def eventDispatched(listenerSelf, event):
             catchAll(self.handleEvent, event)
     
     self.eventListener = PhysicalEventListener()
     eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, self.eventListener, eventMask)
예제 #33
0
파일: uxtst.py 프로젝트: egroise/uxtest
def _screenshot(name):
    name = name.replace("<","-").replace(">","-").replace(":","-").replace("|","-").replace("*","-").replace("\"","-").replace("/","-").replace("\\","-")
    from java.awt import Toolkit,Robot,Rectangle
    from javax.imageio import ImageIO
    from java.io import File  
    screenRect = Rectangle(Toolkit.getDefaultToolkit().getScreenSize())
    capture = Robot().createScreenCapture(screenRect)
    ImageIO.write(capture, "png", File(_UXTST_OUTPUT_PATH_ + name+".png"))
예제 #34
0
 def toClipboardButtonAction(self, event):
     self.extender.generatePayloads()
     result = '\n'.join(self.extender.tamperedPayloads)
     result = StringSelection(result)
     clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard()
     clpbrd.setContents(result, None)
     self.showMessage('{} url encoded payload copied to clipboard'.format(
         len(self.extender.tamperedPayloads)))
예제 #35
0
 def connectRecord(self, method):               
     class EventListener(AWTEventListener):
         def eventDispatched(listenerSelf, event):
             catchAll(self.handleEvent, event, method)
 
     eventListener = EventListener()
     eventMask = AWTEvent.WINDOW_EVENT_MASK
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, eventListener, eventMask)
예제 #36
0
파일: util.py 프로젝트: karlmicha/rguils
def getClipboardText():
    """Returns the clipboard contents. Returns None if the clipboard does not
       contain text.
    """
    contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(None)
    if contents.isDataFlavorSupported(DataFlavor.stringFlavor):
        return str(contents.getTransferData(DataFlavor.stringFlavor))
    return None
예제 #37
0
파일: pane.py 프로젝트: HenryStevens/jes
def getContentToPaste(forComponent):
    clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
    clipContents = clipboard.getContents(forComponent)

    for flavor in clipContents.getTransferDataFlavors():
        if DataFlavor.stringFlavor.equals(flavor):
            return clipContents.getTransferData(flavor)

    return None
예제 #38
0
    def actionpaste(self, msg):
        clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        transferable = clipboard.getContents(self)
        pasted_text = transferable.getTransferData(DataFlavor.stringFlavor)

        # input checking in addelements and addelement will filter
        # trim whitespace, filter blank lines, etc

        self.target.addelements(pasted_text, True)
예제 #39
0
 def getClipboardText(self):
     clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
     contents = clipboard.getContents(None)
     gotText = (contents != None) and contents.isDataFlavorSupported(DataFlavor.stringFlavor)
     
     if gotText:
         return contents.getTransferData(DataFlavor.stringFlavor)
     else:
         return None
예제 #40
0
 def center(self, frame):
     screenSize = Toolkit.getDefaultToolkit().getScreenSize()
     frameSize = frame.getSize()
     frameSize.width = min(frameSize.width, screenSize.width >> 1)
     frameSize.height = min(frameSize.height, screenSize.height >> 1)
     if frameSize != frame.getSize():
         frame.setSize(frameSize)
     frame.setLocation((screenSize.width - frameSize.width) >> 1,
                       (screenSize.height - frameSize.height) >> 1)
예제 #41
0
    def get_clipboard_text(self):

        clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
        clipboard_text = None
        clipboard_contents = clipboard.getContents(self)
        if clipboard_contents.isDataFlavorSupported(DataFlavor.stringFlavor):
            clipboard_text = clipboard_contents.getTransferData(
                DataFlavor.stringFlavor)
        return clipboard_text
예제 #42
0
def centerDialog(dialog):
    """
		Centers a dialog on screen
	"""
    from java.awt import Toolkit
    ssize = Toolkit.getDefaultToolkit().getScreenSize()
    size = dialog.size
    dialog.setLocation((ssize.width-size.width)/2, \
     (ssize.height-size.height)/2)
예제 #43
0
 def editTextComponent(self, newValue, row, column):
     self.widget.runKeyword("typeIntoTableCell", row, column, newValue)
     # The above will press the Enter key and never release it, see
     # http://code.google.com/p/robotframework-swinglibrary/issues/detail?id=197
     # We work around this by releasing it ourselves...
     releaseEvent = KeyEvent(self.widget.widget,
                             KeyEvent.KEY_RELEASED, System.currentTimeMillis(),
                             0, KeyEvent.VK_ENTER)
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent, releaseEvent)
예제 #44
0
def main():
    load('bookshelf.conf')
    if config('LOCALE') is not None and config('LOCALE') != '':
        Locale.setDefault(Locale(config('LOCALE')))
    from window import BookshelfView
    from logic import Bookshelf
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    view = BookshelfView(Bookshelf())
    screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    view.setLocation(screenSize.width/5,  screenSize.height/5)
    view.setVisible(1)
예제 #45
0
    def pasteAction(self, event=None):
        if self.inLastLine():
            clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
            clipboard.getContents(self.textpane)
            contents = clipboard.getData(DataFlavor.stringFlavor)

            lines = contents.splitlines()
            for i, line in enumerate(lines):
                self.insertText(line)
                if i < len(lines) - 1:
                    self.enterAction()
예제 #46
0
 def connectRecord(self, method):               
     if isinstance(self.widget.widget, swing.JComponent) and self.widget.getComponentPopupMenu():
         class EventListener(AWTEventListener):
             def eventDispatched(listenerSelf, event):
                 catchAll(self.handleEvent, event, method)
 
         eventListener = EventListener()
         eventMask = AWTEvent.MOUSE_EVENT_MASK
         util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, eventListener, eventMask)
     else:
         SignalEvent.connectRecord(self, method)
예제 #47
0
    def paste(self, event=None):
        # if getText was smarter, this method would be unnecessary
        if self.inLastLine():
            clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
            clipboard.getContents(self.text_pane)
            contents = clipboard.getData(DataFlavor.stringFlavor)

            lines = contents.split("\n")
            for line in lines:
                self.insertText(line)
                if len(lines) > 1:
                    self.enter()
예제 #48
0
파일: window.py 프로젝트: doctorOb/bashED
    def __init__(self):

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());


        size = Dimension(800, 800)
        self.setPreferredSize(size)

        screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        self.setLocation(screenSize.getSize().width/2 - size.width/2, 100)
        self.setTitle("bashED Terminal HQ EXTREME");

        self.setUndecorated(True)
        self.getRootPane().setOpaque(False)
        #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
        self.setBackground(Color(0,128,0, 198))


        #j = JDesktopPane()
        #j.setOpaque(False)
        self.setLayout(None)

        self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage())




        mp = MainPanel()
        self.add(mp)
        mp.setBounds(0, 0, size.width, size.height)


        imageTest = ImageIcon('bin/gui/media/' + "image.png")
        imageTestLabel = JLabel(imageTest)
        self.add(imageTestLabel)
        imageTestLabel.setBounds(0, 0, size.width, size.height)
        #self.getContentPane().add(mp)

        #self.getContentPane().add(JLabel("Iglo"))

        bb = BorderFactory.createLineBorder(Color.BLACK, 5)
        bw1 = BorderFactory.createLineBorder(Color.WHITE, 1)
        bw2 = BorderFactory.createLineBorder(Color.WHITE, 1)

        mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2) ))


        #make the window viewable
        self.defaultCloseOperation=JFrame.EXIT_ON_CLOSE
        self.pack()
        self.setVisible(True)
예제 #49
0
파일: mouse.py 프로젝트: jggatc/pyj2d
 def set_cursor(self, *cursor):
     """
     Set mouse cursor.
     Alternative arguments:
     * JVM system cursor or cursor object
     * image or surface, hotspot (x,y), and optional name
     * size, hotspot, data, mask, and optional name
     Refer to pyj2d.cursors for details.
     """
     args = len(cursor)
     if len(cursor) == 1:
         if isinstance(cursor[0], int):
             self._cursor = Cursor(cursor[0])
         else:
             self._cursor = cursor[0]
     elif args in (2,3):
         image = cursor[0]
         hotspot = Point(*cursor[1])
         if args == 2:
             name = 'Custom Cursor'
         else:
             name = cursor[2]
         self._cursor = Toolkit.getDefaultToolkit().createCustomCursor(image, hotspot, name)
     elif args in (4,5):
         size = cursor[0]
         hotspot = Point(*cursor[1])
         data = cursor[2]
         mask = cursor[3]
         if args == 4:
             name = 'Custom Cursor'
         else:
             name = cursor[4]
         surface = cursors.create_cursor(size, data, mask)
         self._cursor = Toolkit.getDefaultToolkit().createCustomCursor(surface, hotspot, name)
     else:
         self._cursor = Cursor(Cursor.DEFAULT_CURSOR)
     if self._cursorVisible:
         env.jframe.getContentPane().setCursor(self._cursor)
예제 #50
0
파일: sqldude.py 프로젝트: faffi/sqldude
	def _build(self):
		#Grab first selected message, bail if none
		iRequestInfo = self._helpers.analyzeRequest(self.ctxMenuInvocation.getSelectedMessages()[0])
		if iRequestInfo is None:
			print('Request info object is null, bailing')
			return 

		#print(len(iRequestInfo.getParameters()))
		#for i in iRequestInfo.getParameters():
		#		print(i.getName())
		#print('cookies: ' + ''.join(cookies))
		#parms = [i for i in iRequestInfo.getParameters() if i.getType() == IParameter.PARAM_BODY]
		parms = filter(lambda x: x.getType() == IParameter.PARAM_BODY, iRequestInfo.getParameters())
		cookies = filter(lambda x: x.getType() == IParameter.PARAM_COOKIE, iRequestInfo.getParameters())
		#print('parms ' + ''.join(parms))
		payload = 'sqlmap -u \'%s\' --cookies=\'%s\'' % (iRequestInfo.getUrl(), ';'.join([('%s=%s' % (c.getName(),c.getValue())) for c in cookies ]) ) 
		if len(parms) > 0:
				p = ['%s=%s' % (p.getName(), p.getValue()) for p in parms]
				payload = '%s --data=\'%s\'' % (payload, '&'.join(p))
		#print('Found Cookies:\n\t' + '\n\t'.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies]))
		s = StringSelection(payload)                                                                                                                                                                                                        
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard            
		print(payload)
예제 #51
0
    def listenForComponents(self):
        class NewComponentListener(AWTEventListener):
            def eventDispatched(listenerSelf, event):#@NoSelf
                # Primarily to make coverage work, it doesn't get enabled in threads made by Java
                if hasattr(threading, "_trace_hook") and threading._trace_hook:
                    sys.settrace(threading._trace_hook)
    
                if event.getID() == ComponentEvent.COMPONENT_SHOWN:
                    storytext.guishared.catchAll(self.handleNewComponent, event.getSource())
                elif event.getID() == ContainerEvent.COMPONENT_ADDED:
                    storytext.guishared.catchAll(self.handleNewComponent, event.getChild())

        eventMask = AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.CONTAINER_EVENT_MASK
        util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, NewComponentListener(), eventMask)
 def startListening(self):
     eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK | AWTEvent.COMPONENT_EVENT_MASK
     # Should be commented out if we need to listen to these events:
     #| AWTEvent.WINDOW_EVENT_MASK | AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.ACTION_EVENT_MASK
     #| AWTEvent.ITEM_EVENT_MASK | AWTEvent.INPUT_METHOD_EVENT_MASk
     
     class AllEventListener(AWTEventListener):
         def eventDispatched(listenerSelf, event):
             # Primarily to make coverage work, it doesn't get enabled in threads made by Java
             if hasattr(threading, "_trace_hook") and threading._trace_hook:
                 sys.settrace(threading._trace_hook)
             self.handleEvent(event)
     
     self.eventListener = AllEventListener()
     util.runOnEventDispatchThread(Toolkit.getDefaultToolkit().addAWTEventListener, self.eventListener, eventMask)
예제 #53
0
    def save_screenshot_to(self, path):
        """Saves a screenshot to the specified file.

        The directory holding the file must exist or an exception is raised.
        """
        path = os.path.abspath(path.replace('/', os.sep))
        if not os.path.exists(os.path.dirname(path)):
            raise RuntimeError("Directory '%s' where to save the screenshot does "
                            "not exist" % os.path.dirname(path))
        screensize = Toolkit.getDefaultToolkit().getScreenSize()
        rectangle = Rectangle(0, 0, screensize.width, screensize.height)
        image = Robot().createScreenCapture(rectangle)
        ImageIO.write(image, "jpg", File(path))
        print "Screenshot saved to '%s'" % path
        return path
예제 #54
0
파일: NuView.py 프로젝트: Devanshi26/visad
  def __init__(self, title, display, panel):
    from java.awt import Toolkit
    from javax.swing import JFrame
    self.display = display

    frame = JFrame(title, windowClosing=self.desty)
    frame.getContentPane().add(panel)
    frame.pack()
    frame.invalidate()

    fSize = frame.getSize()
    screensize = Toolkit.getDefaultToolkit().getScreenSize()
    frame.setLocation((screensize.width - fSize.width)/2,
                      (screensize.height - fSize.height)/2)
    frame.setVisible(1)
예제 #55
0
def getContentPane():
    global contentPane
    global REMAP_WIDTH
    global REMAP_HEIGHT
    global MARGIN
    if not contentPane:
        global mainScreen
        global mainScreenImg
        mainScreen = JLabel()

        cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB)
        blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor")
        mainScreen.setCursor(blankCursor)
        mainScreen.setPreferredSize(
                Dimension(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN))
        mainScreen.setText("main screen!")
        image = BufferedImage(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN
                , BufferedImage.TYPE_INT_ARGB)
        g = image.createGraphics()
        g.setColor(Color.BLACK)
        g.fillRect(0, 0, REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN)
        g.setColor(Color.WHITE)
        g.setFont(Font("Serif", Font.BOLD, 20))
        g.drawString("Cursor will display on your device.", 50, 30)
        mainScreenImg = image
        mainScreen.setIcon(swing.ImageIcon(image))

        mouseListener = ScrMouseListener()
        mainScreen.addMouseListener(mouseListener)
        mainScreen.addMouseMotionListener(mouseListener)
        mainScreen.addMouseWheelListener(mouseListener)

        keyListener = ScrKeyListener()
        mainScreen.addKeyListener(keyListener)
        
        mainScreen.setFocusable(True)

        scrPanel = JPanel()
        scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS))
        scrPanel.add(mainScreen)


        contentPane = JPanel()
        contentPane.setLayout(BorderLayout())
        contentPane.add(scrPanel, BorderLayout.WEST)
#        contentPAne.add(controlPanel(). BorderLayout.EAST)

    return contentPane
예제 #56
0
	def keyPressed(self):
		if key == 27:
			self.manager.remove_instances([PlayfieldState, ScoreState, TimerState,
				ChallengeState])
			titles = self.manager.get_instances([TitleScreenState])
			assert len(titles) == 1, "wrong number of title screen states"
			titles[0].fade_in()
			self.manager.remove_state(self)
		elif key == ord('c'):
			modestrs = {'90sec': 'in ninety seconds', '4min': 'in four minutes',
				'challenge': 'with only 50 letters'}
			modestr = modestrs.get(self.mode, '')
			from hashlib import md5
			shorthash = md5(str(self.score)+self.mode).hexdigest()[:6]
			from java.awt.datatransfer import StringSelection
			from java.awt import Toolkit
			clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
			clipboard.setContents(StringSelection("I just scored %d points %s on Characterror! http://characterror.com/?%s" % (self.score, modestr, shorthash)), None)
예제 #57
0
 def addSS(self,event):
     clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
     try:
         image = clipboard.getData(DataFlavor.imageFlavor)
     except:
         self.popup("Clipboard not contains image")
         return
     vulnPath = self.projPath.getText() + "/" + self.clearStr(self.vulnName.getText())
     if not os.path.exists(vulnPath):
         os.makedirs(vulnPath)
     name = self.clearStr(self.vulnName.getText()) + str(random.randint(1, 99999))+".jpg"
     fileName = self.projPath.getText()+"/"+ self.clearStr(self.vulnName.getText()) + "/" + name
     file = File(fileName)
     bufferedImage = BufferedImage(image.getWidth(None), image.getHeight(None), BufferedImage.TYPE_INT_RGB);
     g = bufferedImage.createGraphics();
     g.drawImage(image, 0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), Color.WHITE, None);
     ImageIO.write(bufferedImage, "jpg", file)
     self.addVuln(self)
     self.ssList.setSelectedValue(name,True)
예제 #58
0
 def _clipboard_init(self):
     if not Interface._clipboard:
         try:
             from gtk import Clipboard
             Interface._clipboard = Clipboard()
             Interface._clipboard_type = 'gtk'
         except ImportError:
             try:
                 from Tkinter import Tk
                 Interface._clipboard = Tk()
                 Interface._clipboard.withdraw()
                 Interface._clipboard_type = 'tk'
             except ImportError:
                 try:
                     global StringSelection, DataFlavor, UnsupportedFlavorException, IOException, IllegalStateException
                     from java.awt.datatransfer import StringSelection, DataFlavor
                     from java.awt.datatransfer import UnsupportedFlavorException
                     from java.io import IOException
                     from java.lang import IllegalStateException
                     from java.awt import Toolkit
                     Interface._clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
                     Interface._clipboard_type = 'jtk'
                 except ImportError:
                     try:
                         engine.display.textbox_init()
                         Interface._clipboard = engine.display.textarea
                         Interface._clipboard_type = 'js'
                     except AttributeError:
                         Interface._clipboard = None
                         Interface._clipboard_type = None
     if Interface._clipboard_type == 'gtk':
         self.get_clipboard = self._get_clipboard_gtk
         self.set_clipboard = self._set_clipboard_gtk
     elif Interface._clipboard_type == 'tk':
         self.get_clipboard = self._get_clipboard_tk
         self.set_clipboard = self._set_clipboard_tk
     elif Interface._clipboard_type == 'jtk':
         self.get_clipboard = self._get_clipboard_jtk
         self.set_clipboard = self._set_clipboard_jtk
     elif Interface._clipboard_type == 'js':
         self.get_clipboard = self._get_clipboard_js
         self.set_clipboard = self._set_clipboard_js
예제 #59
0
    def __initKeyMap(self):
        os_name = System.getProperty("os.name")
        if os_name.startswith("Win"):
            exit_key = KeyEvent.VK_Z
            interrupt_key = KeyEvent.VK_PAUSE # BREAK
        else:
            exit_key = KeyEvent.VK_D
            interrupt_key = KeyEvent.VK_C

        keyBindings = [
            (KeyEvent.VK_ENTER, 0, "jython.enter", self.enter),
            (KeyEvent.VK_DELETE, 0, "jython.delete", self.delete),
            (KeyEvent.VK_HOME, 0, "jython.home", self.home),
            (KeyEvent.VK_LEFT, InputEvent.META_DOWN_MASK, "jython.home", self.home),
            (KeyEvent.VK_UP, 0, "jython.up", self.history.historyUp),
            (KeyEvent.VK_DOWN, 0, "jython.down", self.history.historyDown),
            (KeyEvent.VK_PERIOD, 0, "jython.showPopup", self.showPopup),
            (KeyEvent.VK_ESCAPE, 0, "jython.hide", self.hide),

            ('(', 0, "jython.showTip", self.showTip),
            (')', 0, "jython.hideTip", self.hideTip),
            (exit_key, InputEvent.CTRL_MASK, "jython.exit", self.quit),
            (KeyEvent.VK_SPACE, InputEvent.CTRL_MASK, "jython.showPopup", self.showPopup),
            (KeyEvent.VK_SPACE, 0, "jython.space", self.spaceTyped),

            # explicitly set paste since we're overriding functionality
            (KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), "jython.paste", self.paste),

            # Mac/Emacs keystrokes
            (KeyEvent.VK_A, InputEvent.CTRL_MASK, "jython.home", self.home),
            (KeyEvent.VK_E, InputEvent.CTRL_MASK, "jython.end", self.end),
            (KeyEvent.VK_K, InputEvent.CTRL_MASK, "jython.killToEndLine", self.killToEndLine),
            (KeyEvent.VK_Y, InputEvent.CTRL_MASK, "jython.paste", self.paste),
            
            (interrupt_key, InputEvent.CTRL_MASK, "jython.keyboardInterrupt", self.keyboardInterrupt),
            ]

        keymap = JTextComponent.addKeymap("jython", self.text_pane.keymap)
        for (key, modifier, name, function) in keyBindings:
            keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(key, modifier), ActionDelegator(name, function))
        self.text_pane.keymap = keymap