| 1 | #!/usr/bin/env python |
|---|
| 2 | # Copyright (C) 2005 Insecure.Com LLC. |
|---|
| 3 | # Authors: |
|---|
| 4 | # Luis Antonio Bastiao Silva <luis.kop@gmail.com> |
|---|
| 5 | # |
|---|
| 6 | # This program is free software; you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by |
|---|
| 8 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This program is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | # GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License |
|---|
| 17 | # along with this program; if not, write to the Free Software |
|---|
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | |
|---|
| 20 | import gtk |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | ui = """ |
|---|
| 30 | <toolbar> |
|---|
| 31 | <toolitem action='Option checkbox'/> |
|---|
| 32 | <toolitem action='Option checkbox icon'/> |
|---|
| 33 | <toolitem action='Option entry'/> |
|---|
| 34 | <toolitem action='Open Scan'/> |
|---|
| 35 | <separator/> |
|---|
| 36 | <toolitem action='Report a bug'/> |
|---|
| 37 | <toolitem action='Show Help'/> |
|---|
| 38 | </toolbar> |
|---|
| 39 | """ |
|---|
| 40 | |
|---|
| 41 | class Toolbar(gtk.Toolbar): |
|---|
| 42 | """ |
|---|
| 43 | toolbar contains icons to be added to editor |
|---|
| 44 | """ |
|---|
| 45 | |
|---|
| 46 | def __init__(self): |
|---|
| 47 | """ |
|---|
| 48 | load the initial icons of toolbar |
|---|
| 49 | """ |
|---|
| 50 | #gtk.Toolbar().__init__(self) |
|---|
| 51 | |
|---|
| 52 | #self.set_orientation(gtk.ORIENTATION_HORIZONTAL) |
|---|
| 53 | #self.set_style(gtk.TOOLBAR_BOTH) |
|---|
| 54 | #self.set_border_width(5) |
|---|
| 55 | ui_manager = gtk.UIManager() |
|---|
| 56 | self = ui_manager.get_widget('/toolbar') |
|---|
| 57 | main_actions = [ \ |
|---|
| 58 | # Top level |
|---|
| 59 | ('Scan', None, _('Sc_an'), None), |
|---|
| 60 | |
|---|
| 61 | ('Wizard', |
|---|
| 62 | gtk.STOCK_CONVERT, |
|---|
| 63 | _('_Command Wizard'), |
|---|
| 64 | '<Control>i', |
|---|
| 65 | _('Open nmap command constructor wizard'), |
|---|
| 66 | self._help), |
|---|
| 67 | |
|---|
| 68 | ('Save Scan', |
|---|
| 69 | gtk.STOCK_SAVE, |
|---|
| 70 | _('_Save Scan'), |
|---|
| 71 | None, |
|---|
| 72 | _('Save current scan results'), |
|---|
| 73 | self._help), |
|---|
| 74 | |
|---|
| 75 | ('Open Scan', |
|---|
| 76 | gtk.STOCK_OPEN, |
|---|
| 77 | _('_Open Scan'), |
|---|
| 78 | None, |
|---|
| 79 | _('Open the results of a previous scan'), |
|---|
| 80 | self._help), |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | ('Tools', None, _('_Tools'), None), |
|---|
| 84 | |
|---|
| 85 | ('New Scan', |
|---|
| 86 | gtk.STOCK_NEW, |
|---|
| 87 | _('_New Scan'), |
|---|
| 88 | "<Control>T", |
|---|
| 89 | _('Create a new Scan Tab'), |
|---|
| 90 | self._help), |
|---|
| 91 | |
|---|
| 92 | ('Close Scan', |
|---|
| 93 | gtk.STOCK_CLOSE, |
|---|
| 94 | _('Close Scan'), |
|---|
| 95 | "<Control>w", |
|---|
| 96 | _('Close current scan tab'), |
|---|
| 97 | self._help), |
|---|
| 98 | |
|---|
| 99 | ('New Profile', |
|---|
| 100 | gtk.STOCK_JUSTIFY_LEFT, |
|---|
| 101 | _('New _Profile'), |
|---|
| 102 | '<Control>p', |
|---|
| 103 | _('Create a new scan profile'), |
|---|
| 104 | self._help), |
|---|
| 105 | |
|---|
| 106 | ('Search Scan', |
|---|
| 107 | gtk.STOCK_FIND, |
|---|
| 108 | _('Search Scan Results'), |
|---|
| 109 | '<Control>f', |
|---|
| 110 | _('Search for a scan result'), |
|---|
| 111 | self._help), |
|---|
| 112 | |
|---|
| 113 | ('Edit Profile', |
|---|
| 114 | gtk.STOCK_PROPERTIES, |
|---|
| 115 | _('_Edit Selected Profile'), |
|---|
| 116 | '<Control>e', |
|---|
| 117 | _('Edit selected scan profile'), |
|---|
| 118 | self._help), |
|---|
| 119 | |
|---|
| 120 | ('New Profile with Selected', |
|---|
| 121 | gtk.STOCK_PROPERTIES, |
|---|
| 122 | _('New P_rofile with Selected'), |
|---|
| 123 | '<Control>r', |
|---|
| 124 | _('Use the selected scan profile to create another'), |
|---|
| 125 | self._help), |
|---|
| 126 | |
|---|
| 127 | ('Quit', |
|---|
| 128 | gtk.STOCK_QUIT, |
|---|
| 129 | _('_Quit'), |
|---|
| 130 | None, |
|---|
| 131 | _('Quit this application'), |
|---|
| 132 | self._help), |
|---|
| 133 | |
|---|
| 134 | ] |
|---|
| 135 | main_accel_group = gtk.AccelGroup() |
|---|
| 136 | |
|---|
| 137 | main_action_group = gtk.ActionGroup('MainActionGroup') |
|---|
| 138 | main_action_group.add_actions(main_actions) |
|---|
| 139 | |
|---|
| 140 | for action in main_action_group.list_actions(): |
|---|
| 141 | action.set_accel_group(main_accel_group) |
|---|
| 142 | action.connect_accelerator() |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | ui_manager.insert_action_group(main_action_group, 0) |
|---|
| 146 | ui_manager.add_ui_from_string(ui) |
|---|
| 147 | def _help(self): |
|---|
| 148 | #help |
|---|
| 149 | msg = "err" |
|---|
| 150 | |
|---|
| 151 | |
|---|