Esempio n. 1
0
 def on_menu_adb_path(self, event):
     dialog = wx.TextEntryDialog(
         self, 'Example: "yourpath/android-sdk-macosx/platform-tools/"',
         'Set Your Adb Path', '')
     if dialog.ShowModal() == wx.ID_OK:
         new_adb_path = dialog.GetValue()
         tree = ET.parse("./config.xml")
         root = tree.getroot()
         # "/Users/wnagzihxa1n/Library/Android/android-sdk-macosx/platform-tools"
         root[0].text = new_adb_path
         tree.write("./config.xml")
         SelectItem.set_adb_path(new_adb_path)
         ShellTool.init_shell_env()
Esempio n. 2
0
    def __init__(self, parent):
        super(QuickAttackPanel, self).__init__(parent=parent,
                                               style=wx.BORDER_NONE)
        self.boxsizer_main = wx.BoxSizer(wx.VERTICAL)

        # device operation
        self.staticboxsizer_devices = wx.StaticBoxSizer(
            wx.StaticBox(self, label='Device Operation'))
        self.boxsizer_devices = wx.BoxSizer(wx.HORIZONTAL)
        self.statictext_device_name = wx.StaticText(self,
                                                    -1,
                                                    label='Name:          ')
        self.statictext_device_os_version = wx.StaticText(
            self, -1, label='OS Version:          ')
        self.boxsizer_devices.Add(self.statictext_device_name,
                                  flag=wx.CENTER | wx.ALL,
                                  border=0)
        self.boxsizer_devices.AddSpacer(10)
        self.boxsizer_devices.Add(self.statictext_device_os_version,
                                  flag=wx.CENTER | wx.ALL,
                                  border=0)
        self.boxsizer_devices.AddSpacer(10)
        self.devices_list = []
        self.combobox_devices = wx.ComboBox(self, choices=self.devices_list)
        # self.combobox_devices.SetBackgroundColour(wx.WHITE)
        self.button_refresh_devices = wx.Button(self,
                                                label='Refresh Device List')
        self.boxsizer_devices.Add(self.combobox_devices,
                                  flag=wx.EXPAND | wx.ALL,
                                  border=0)
        self.boxsizer_devices.AddSpacer(10)
        self.boxsizer_devices.Add(self.button_refresh_devices,
                                  flag=wx.EXPAND | wx.ALL,
                                  border=0)
        self.Bind(wx.EVT_COMBOBOX, self.on_combobox_device_select,
                  self.combobox_devices)
        self.Bind(wx.EVT_BUTTON, self.on_refresh_devices_list,
                  self.button_refresh_devices)
        self.staticboxsizer_devices.Add(self.boxsizer_devices)

        # component operation
        self.staticboxsizer_component = wx.StaticBoxSizer(
            wx.StaticBox(self, label='Quick Attack'))
        self.boxsizer_component = wx.BoxSizer(wx.HORIZONTAL)
        self.button_activity = wx.Button(self, label='Start Activity')
        self.button_service = wx.Button(self, label='Start Service')
        self.button_broadcast = wx.Button(self, label='Send Broadcast')
        self.boxsizer_component.Add(self.button_activity,
                                    flag=wx.EXPAND | wx.ALL,
                                    border=0)
        self.boxsizer_component.AddSpacer(10)
        self.boxsizer_component.Add(self.button_service,
                                    flag=wx.EXPAND | wx.ALL,
                                    border=0)
        self.boxsizer_component.AddSpacer(10)
        self.boxsizer_component.Add(self.button_broadcast,
                                    flag=wx.EXPAND | wx.ALL,
                                    border=0)
        self.boxsizer_component.AddSpacer(10)
        self.Bind(wx.EVT_BUTTON, self.on_start_activity, self.button_activity)
        self.Bind(wx.EVT_BUTTON, self.on_start_service, self.button_service)
        self.Bind(wx.EVT_BUTTON, self.on_send_broadcast, self.button_broadcast)
        self.staticboxsizer_component.Add(self.boxsizer_component)

        # Add all staticboxsizers to boxsizer_main
        self.boxsizer_main.Add(self.staticboxsizer_devices,
                               flag=wx.EXPAND | wx.ALL,
                               border=0)
        self.boxsizer_main.Add(self.staticboxsizer_component,
                               flag=wx.EXPAND | wx.ALL,
                               border=0)

        # command param hint
        self.textctrl_hint = wx.TextCtrl(self,
                                         style=wx.TE_MULTILINE
                                         | wx.TE_READONLY)
        self.textctrl_hint.SetBackgroundColour(wx.WHITE)
        self.boxsizer_main.Add(self.textctrl_hint,
                               flag=wx.EXPAND | wx.ALL,
                               proportion=1,
                               border=5)

        # command editor
        self.boxsizer_command = wx.BoxSizer(wx.HORIZONTAL)
        self.textctrl_shell = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.shell_exec_button = wx.Button(self, label="Execute")
        self.boxsizer_command.Add(self.textctrl_shell,
                                  flag=wx.EXPAND | wx.ALL,
                                  proportion=1,
                                  border=5)
        self.boxsizer_command.Add(self.shell_exec_button,
                                  flag=wx.EXPAND | wx.ALL,
                                  border=5)
        self.boxsizer_main.Add(self.boxsizer_command,
                               flag=wx.EXPAND | wx.ALL,
                               proportion=1)
        self.Bind(wx.EVT_BUTTON, self.on_command_exec, self.shell_exec_button)

        # command execute output
        self.textctrl_output = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.textctrl_output.SetBackgroundColour(wx.WHITE)
        self.boxsizer_main.Add(self.textctrl_output,
                               flag=wx.EXPAND | wx.ALL,
                               proportion=1,
                               border=5)

        self.SetSizer(self.boxsizer_main)

        tree = ET.parse("./config.xml")
        adb_path = tree.getroot()[0].text.strip()
        SelectItem.set_adb_path(adb_path)

        ShellTool.init_shell_env()

        # refresh device list while starting Toolgy
        self.refresh_devices_list()