コード例 #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()
コード例 #2
0
    def on_combobox_device_select(self, event):
        self.clear_all_textctrl()
        select_index = self.combobox_devices.GetSelection()
        if select_index == wx.NOT_FOUND:
            return
        device_name = self.combobox_devices.GetItems()[select_index].encode(
            'utf-8')
        SelectItem.set_selected_device_name(device_name)
        device_name = DeviceTool.getprop_ro_product_name()
        device_os_version = DeviceTool.getprop_ro_build_version_release()
        self.statictext_device_name.SetLabel('Name: {}'.format(
            device_name[0]).strip())
        self.statictext_device_os_version.SetLabel('OS Version: {}'.format(
            device_os_version[0]).strip())

        pub.sendMessage('re_select_device')
コード例 #3
0
ファイル: device_panel.py プロジェクト: 5l1v3r1/Toolgy
 def on_get_device_info(self, event):
     self.clear_all_textctrl()
     shell = 'adb -s {} shell getprop'.format(SelectItem.get_selected_device_name())
     self.textctrl_shell.SetValue(shell)
     out, err = ShellTool.run(shell)
     self.textctrl_output.SetValue(out)
     self.textctrl_output.AppendText('\n')
     self.textctrl_output.AppendText(err)
コード例 #4
0
ファイル: all_packages_panel.py プロジェクト: 5l1v3r1/Toolgy
    def on_select_third_packages(self, event):
        self.checkbox_all_packages.SetValue(False)
        self.checkbox_system_packages.SetValue(False)
        self.checkbox_third_part_packages.SetValue(True)

        if len(SelectItem.list_all_packages) == 0:
            self.init_packages_list()
        self.refresh_listctrl(SelectItem.get_third_part_packages_list())
コード例 #5
0
ファイル: component_tool.py プロジェクト: 5l1v3r1/Toolgy
    def start_activity(quick_attack_panel):
        quick_attack_panel.textctrl_hint.SetValue('''-n package_name/.component
-a action Action
--es key stringValue String
--ez key booleanValue Boolean
--ei key intValue int
--el key longValue long
--ef key floatValue float

$ adb shell am start -n package_name/.component
$ adb shell am start -n package_name/.component -a Action
$ adb shell am start -n package_name/.component --es str_arg_key "str_arg_value"'''
                                                  )
        quick_attack_panel.textctrl_shell.SetValue(
            'adb -s {} shell am start -n {}/'.format(
                SelectItem.get_selected_device_name(),
                SelectItem.get_selected_package_name()))
コード例 #6
0
ファイル: general_tool.py プロジェクト: 5l1v3r1/Toolgy
 def get_top_activity(device_panel):
     device_build_version = DeviceTool.getprop_ro_build_version_release()
     shell = ''
     if device_build_version[0].startswith("7"):
         shell = 'adb -s {} shell dumpsys activity | grep "mFocusedActivity"' \
             .format(SelectItem.get_selected_device_name())
     elif device_build_version[0].startswith("8"):
         shell = 'adb -s {} shell dumpsys activity activities | grep "mResumedActivity"' \
             .format(SelectItem.get_selected_device_name())
     elif device_build_version[0].startswith("9"):
         shell = 'adb -s {} shell dumpsys activity activities | grep "mResumedActivity"' \
             .format(SelectItem.get_selected_device_name())
     elif device_build_version[0].startswith("10"):
         shell = 'adb -s {} shell dumpsys activity activities | grep "mResumedActivity"' \
             .format(SelectItem.get_selected_device_name())
     device_panel.textctrl_shell.SetValue(shell)
     out, err = ShellTool.run(shell)
     device_panel.textctrl_output.SetValue(out)
     device_panel.textctrl_output.AppendText('\n')
     device_panel.textctrl_output.AppendText(err)
コード例 #7
0
 def refresh_devices_list(self):
     self.clear_all_textctrl()
     out, err = ShellTool.run("adb devices")
     devices = out.split('\n')
     self.devices_list = []
     for device in devices:
         if len(device) > 0 and '\tdevice' in device:
             self.devices_list.append(device.replace('\tdevice', ''))
     self.combobox_devices.SetItems(self.devices_list)
     if len(self.devices_list) > 0:
         self.combobox_devices.SetValue(self.devices_list[0])
         SelectItem.set_selected_device_name(self.devices_list[0])
         device_name = DeviceTool.getprop_ro_product_name()
         device_os_version = DeviceTool.getprop_ro_build_version_release()
         self.statictext_device_name.SetLabel('Name: {}'.format(
             device_name[0]).strip())
         self.statictext_device_os_version.SetLabel('OS Version: {}'.format(
             device_os_version[0]).strip())
         pub.sendMessage('re_select_device')
     else:
         SelectItem.set_selected_device_name('')
         device_name = '          '
         device_os_version = '          '
         self.statictext_device_name.SetLabel(
             'Name: {}'.format(device_name))
         self.statictext_device_os_version.SetLabel(
             'OS Version: {}'.format(device_os_version))
         SelectItem.clear_all()
         pub.sendMessage('no_device')
コード例 #8
0
ファイル: all_packages_panel.py プロジェクト: 5l1v3r1/Toolgy
    def init_packages_list(self):
        out, err = DeviceTool.get_all_packages_with_filepath()
        packages = out.split('\n')
        SelectItem.set_all_packages_list(packages)
        temp_system_packages = []
        temp_third_part_packages = []
        for package in packages:
            if 'package:/system/' in package or 'package:/vendor/' in package or 'package:/product/overlay' in package:
                temp_system_packages.append(package.replace('==/base.apk', ''))
            else:
                temp_third_part_packages.append(
                    package.replace('==/base.apk', ''))

        SelectItem.set_system_packages_list(temp_system_packages)
        SelectItem.set_third_part_packages_list(temp_third_part_packages)
コード例 #9
0
ファイル: all_packages_panel.py プロジェクト: 5l1v3r1/Toolgy
 def on_list_box_item_click(self, event):
     print(event.GetIndex(), self.listCtrl_packages[event.GetIndex()])
     SelectItem.set_selected_package_name(
         self.listCtrl_packages[event.GetIndex()])
コード例 #10
0
ファイル: device_tool.py プロジェクト: 5l1v3r1/Toolgy
 def get_all_packages_with_filepath():
     return ShellTool.run("adb -s {} shell pm list packages -f".format(SelectItem.get_selected_device_name()))
コード例 #11
0
ファイル: device_tool.py プロジェクト: 5l1v3r1/Toolgy
 def getprop_ro_build_version_release():
     return ShellTool.run(
         "adb -s {} shell getprop ro.build.version.release".format(SelectItem.get_selected_device_name()))
コード例 #12
0
ファイル: device_tool.py プロジェクト: 5l1v3r1/Toolgy
 def getprop_ro_product_name():
     return ShellTool.run("adb -s {} shell getprop ro.product.name".format(SelectItem.get_selected_device_name()))
コード例 #13
0
 def uninstall_app(device_panel):
     device_name = SelectItem.get_selected_device_name()
     uninstall_app_package = SelectItem.get_selected_package_name()
     shell = 'adb -s {} uninstall {}'.format(device_name,
                                             uninstall_app_package)
     device_panel.textctrl_shell.SetValue(shell)
コード例 #14
0
 def init_shell_env():
     os.environ['PATH'] = SelectItem.get_adb_path(
     ) + ':' + os.environ['PATH']
     ShellTool.env.update(os.environ)
コード例 #15
0
ファイル: all_packages_panel.py プロジェクト: 5l1v3r1/Toolgy
 def re_select_device(self):
     self.init_packages_list()
     self.checkbox_all_packages.SetValue(False)
     self.checkbox_system_packages.SetValue(False)
     self.checkbox_third_part_packages.SetValue(True)
     self.refresh_listctrl(SelectItem.get_third_part_packages_list())
コード例 #16
0
ファイル: all_packages_panel.py プロジェクト: 5l1v3r1/Toolgy
    def __init__(self, parent):
        super(AllPackagesPanel, self).__init__(parent=parent,
                                               style=wx.BORDER_NONE)
        # self.SetBackgroundColour(wx.GREEN)
        self.boxSizer = wx.BoxSizer(wx.VERTICAL)
        self.listCtrl_packages = []
        self.listCtrl_filepaths = []

        # 过滤器
        self.filter_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.checkbox_all_packages = wx.CheckBox(self, label='All App')
        self.checkbox_system_packages = wx.CheckBox(self, label='System App')
        self.checkbox_third_part_packages = wx.CheckBox(self,
                                                        label='Third Part App')
        self.refresh_button = wx.Button(self, label='Refresh App List')

        self.filter_boxsizer.Add(self.checkbox_all_packages,
                                 flag=wx.EXPAND | wx.ALL,
                                 border=10)
        self.filter_boxsizer.Add(self.checkbox_system_packages,
                                 flag=wx.EXPAND | wx.ALL,
                                 border=10)
        self.filter_boxsizer.Add(self.checkbox_third_part_packages,
                                 flag=wx.EXPAND | wx.ALL,
                                 border=10)
        self.filter_boxsizer.Add(self.refresh_button,
                                 flag=wx.EXPAND | wx.ALL,
                                 border=10)
        self.Bind(wx.EVT_CHECKBOX, self.on_select_all_packages,
                  self.checkbox_all_packages)
        self.Bind(wx.EVT_CHECKBOX, self.on_select_system_packages,
                  self.checkbox_system_packages)
        self.Bind(wx.EVT_CHECKBOX, self.on_select_third_packages,
                  self.checkbox_third_part_packages)
        self.Bind(wx.EVT_BUTTON, self.on_refresh_packages_info,
                  self.refresh_button)
        self.boxSizer.Add(self.filter_boxsizer)

        # ListCtrl版本
        self.listCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
        self.listCtrl.SetBackgroundColour('#90EE90')
        self.listCtrl.InsertColumn(0, 'Num', wx.LIST_FORMAT_CENTER, width=50)
        self.listCtrl.InsertColumn(1,
                                   'Package Name',
                                   wx.LIST_FORMAT_LEFT,
                                   width=250)
        self.listCtrl.InsertColumn(2,
                                   'APK Path',
                                   wx.LIST_FORMAT_LEFT,
                                   width=500)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_list_box_item_click,
                  self.listCtrl)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED,
                  self.on_list_box_item_double_click, self.listCtrl)
        self.boxSizer.Add(self.listCtrl, flag=wx.EXPAND, proportion=1)

        self.SetSizer(self.boxSizer)

        if SelectItem.get_selected_device_name() != '':
            self.init_packages_list()
            self.checkbox_third_part_packages.SetValue(True)
            self.refresh_listctrl(SelectItem.get_third_part_packages_list())

        pub.subscribe(self.re_select_device, 're_select_device')
        pub.subscribe(self.no_device, 'no_device')
コード例 #17
0
ファイル: component_tool.py プロジェクト: 5l1v3r1/Toolgy
 def send_broadcast(buttons_panel):
     buttons_panel.textctrl_hint.SetValue('')
     buttons_panel.textctrl_shell.SetValue(
         'adb -s {} shell am broadcast -a '.format(
             SelectItem.get_selected_device_name()))
コード例 #18
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()