예제 #1
0
    def __init__(self):
        # Load custom icon
        self.icon_id = idaapi.load_custom_icon(data=MyChooserForm.icon_data)
        if self.icon_id == 0:
            raise RuntimeError("Failed to load icon data!")

        self.main_current_index = -1
        self.EChMain = MainChooserClass("MainChooser", self.icon_id)
        self.EChAux = AuxChooserClass("AuxChooser", self.icon_id)

        # Link the form to the EChooser
        self.EChMain.form = self
        self.EChAux.form = self

        Form.__init__(
            self, r"""STARTITEM 0
Form with choosers

    {FormChangeCb}
    Select an item in the main chooser:

    <Main chooser:{ctrlMainChooser}><Auxiliar chooser (multi):{ctrlAuxChooser}>


    <Selection:{ctrlSelectionEdit}>

""", {
                'ctrlSelectionEdit': Form.StringInput(),
                'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
                'ctrlMainChooser': Form.EmbeddedChooserControl(self.EChMain),
                'ctrlAuxChooser': Form.EmbeddedChooserControl(self.EChAux),
            })
예제 #2
0
    def __init__(self, api_db_folder):
        self.invert = False
        self.chosenValues = []
        self.apiDbChooser = ApiDbChooser("ApiDBs", api_db_folder, flags=Choose.CH_MULTI)
        Form.__init__(self, r"""STARTITEM {id:rNormal}
BUTTON YES* Run
BUTTON CANCEL Cancel
IDA ApiScout

{FormChangeCb}
Please select one or more API DBs from your apiscout/dbs folder:

<Available API DBs:{cApiDbChooser}>

or load a database from another location:

<#Select a file to open#:{iFileOpen}>

<##Ignore ASLR offsets:{rAslr}>{cGroup1}>
""", {
    'iAslrOffset': Form.NumericInput(tp=Form.FT_UINT64, value=0x0),
    'iFileOpen': Form.FileInput(swidth=40, open=True, value="*.*"),
    'cGroup1': Form.ChkGroupControl(("rAslr", "rNormal")),
    'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
    'cApiDbChooser' : Form.EmbeddedChooserControl(self.apiDbChooser)
})
예제 #3
0
    def __init__( self, title, chooser ):

        self.chooser = chooser
        template_instance = PLUGIN_CHOOSER_FORM_TEMPLATE % title
        Form.__init__(self, template_instance, {
            'Chooser' : Form.EmbeddedChooserControl(chooser)
        })
예제 #4
0
    def __init__(self, crawled_apis, from_addr=0, to_addr=0):
        self.invert = False
        self.chosenApis = []
        self.apiChooser = ApiChooser("Apis", crawled_apis, flags=Choose.CH_MULTI)
        Form.__init__(self, r"""STARTITEM {id:rNormal}
BUTTON YES* Annotate
BUTTON CANCEL Cancel
IDA ApiScout (Results)

{FormChangeCb}
ApiScout has found the following APIs (select to annotate, e.g. CTRL+A):

<APIs:{cApiChooser}>
{cApiInfo}

Filter APIs by Range -  
<##from  :{iAddrFrom}>
<##to    :{iAddrTo}>
Filter APIs by Grouping - require another API 
<##within:{iByteRange}> bytes
<##Apply Filter:{bApplyFilter}>
""", {
    'cApiInfo': Form.StringLabel("APIs (unfiltered)"),
    'bApplyFilter': Form.ButtonInput(self.OnButtonApplyFilter),
    'iAddrFrom': Form.NumericInput(tp=Form.FT_ADDR, value=from_addr),
    'iAddrTo': Form.NumericInput(tp=Form.FT_ADDR, value=to_addr),
    'iByteRange': Form.NumericInput(tp=Form.FT_UINT64, value=0x100),
    'cGroup1': Form.ChkGroupControl(("rFilter", "rNormal")),
    'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
    'cApiChooser' : Form.EmbeddedChooserControl(self.apiChooser)
})
예제 #5
0
    def __init__(self):
        self.invert = False
        self.EChooser = EmbeddedChooserClass("Title", flags=Choose.CH_MODAL)
        self.selected_id = 0
        self.s = ""
        self.fst = FuzzySearchThread()
        self.fst.refresh_list.connect(self.refresh_list)
        self.fst.finished.connect(self.finished)
        # self.EChooser = EmbeddedChooserClass("Title", flags=Choose.CH_CAN_REFRESH)

        # Portability fix from Python2 to Python3.
        try:
            self.cEChooser = super(
            ).cEChooser  #super() will raise exception in python2
        except:
            pass

        Form.__init__(
            self, r"""STARTITEM 
        IDA Fuzzy Search
        {FormChangeCb}
        <:{iStr1}>

        <Results:{cEChooser}>
""", {
                'iStr1': Form.StringInput(),
                'cEChooser': Form.EmbeddedChooserControl(self.EChooser),
                'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
            })
예제 #6
0
    def __init__(self, pomidor):

        self.pomidor = pomidor

        Form.__init__(self, 
r"""BUTTON YES* NONE
BUTTON NO NONE
BUTTON CANCEL NONE
IDA Pomidor
{FormChangeCb}
          {imgPomidor}  
<Pomidor:{iButtonPomidor}> <Short Break:{iButtonShortBreak}> <Long Break:{iButtonLongBreak}>
   {strTime}
<Pomidor Log:{cEChooser}>
""", {
                'imgPomidor'      : Form.StringLabel(""),
                'FormChangeCb'    : Form.FormChangeCb(self.OnFormChange),
                'cEChooser'       : Form.EmbeddedChooserControl(self.pomidor.pomidorView, swidth=50),

                'strTime'         : Form.StringLabel(""),

                'iButtonPomidor'   : Form.ButtonInput(self.OnButtonPomidor, swidth=16),
                'iButtonShortBreak': Form.ButtonInput(self.OnButtonShortBreak, swidth=16),
                'iButtonLongBreak' : Form.ButtonInput(self.OnButtonLongBreak, swidth=16),
            })

        self.Compile()
    def __init__(self, manager, disable_param=False):

        self.disable_param = disable_param

        self.all_funcs = IDAUtils.get_all_ida_funcs()
        self.funcList = FunctionListView("asm",
                                         flags=Choose.CH_MULTI,
                                         all_funcs=self.all_funcs)
        self.selected_funcs = []

        self.configuration = manager.configuration
        apps = self.configuration['apps'].keys()
        default_app = self.configuration['default-app']
        if self.configuration['default-app'] is not None:
            default_index = apps.index(default_app)
        else:
            default_index = 0
        self.selected_app_key = default_app

        self.threshold = self.configuration['default-threshold']
        self.topk = self.configuration['default-topk']
        self.avoidSameBinary = self.configuration['default-avoidSameBinary']

        Form.__init__(
            self, r"""BUTTON YES* Continue
BUTTON CANCEL Cancel
Kam1n0
{FormChangeCb}
Select Function:
<(Use ctrl/shift + click to select multiple functions):{fvChooser}>
<Select all functions:{chkSearchAll}><Skip library functions:{chkSkipLib}>{adSearchGroup}>
Configuration
<Threshold:{txtSim}>
<TopK     :{txtTopK}>
<Avoid Same Binary  :{chkSameBin}>{chkGroup}>
<App   :{dpServer}>
""", {
                'adSearchGroup':
                Form.ChkGroupControl(["chkSearchAll", "chkSkipLib"]),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtSim':
                Form.StringInput(
                    swidth=25, tp=Form.FT_ASCII, value=str(self.threshold)),
                'txtTopK':
                Form.StringInput(
                    swidth=25, tp=Form.FT_ASCII, value=str(self.topk)),
                'chkGroup':
                Form.ChkGroupControl(("chkSameBin", "")),
                'dpServer':
                Form.DropdownListControl(swidth=45,
                                         width=45,
                                         selval=default_index,
                                         items=apps,
                                         readonly=True),
                'fvChooser':
                Form.EmbeddedChooserControl(self.funcList)
            })
        self.Compile()
    def __init__(self, manager):
        self.cnn = manager.connector
        self.Kconf = manager.Kconf
        self.listView = ConnectionListView(manager)

        dpItems = self.Kconf['cnns'].keys()
        if self.Kconf['default-cnn'] is not None:
            defaultIndex = self.Kconf['cnns'].keys().index(
                self.Kconf['default-cnn'])

        else:
            defaultIndex = 0

        Form.__init__(
            self, r"""BUTTON YES* OK
BUTTON CANCEL NONE
Kam1n0 - Manage connections
{FormChangeCb}
Manage Connections:
<(Click to edit):{fvChooser}>
<Remove :{btnRemove}> Remove selected connection.
<Protocol :{txtProtocol}>
<Server   :{txtServer}>
<Port     :{txtPort}>
Login Info:
<User     :{txtUser}>
<Password :{txtPw}>
<Update / Add:{btnUpdate}>
<Default  :{dpCnn}>
<  >
""", {
                'fvChooser':
                Form.EmbeddedChooserControl(self.listView),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtServer':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtProtocol':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtPort':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtUser':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtPw':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'btnRemove':
                Form.ButtonInput(self.OnButtonRemove),
                'btnUpdate':
                Form.ButtonInput(self.OnButtonUpdate),
                'dpCnn':
                Form.DropdownListControl(swidth=45,
                                         width=45,
                                         selval=defaultIndex,
                                         items=dpItems,
                                         readonly=True)
            })
        self.Compile()
    def __init__(self, manager):
        global funcListG
        self.funcList = FunctionListView("asm", flags=Choose2.CH_MULTI)
        self.funcs = []

        self.cnn = manager.connector

        self.Kconf = manager.Kconf
        dpItems = self.Kconf['cnns'].keys()
        if self.Kconf['default-cnn'] is not None:
            defaultIndex = self.Kconf['cnns'].keys().index(
                self.Kconf['default-cnn'])

        else:
            defaultIndex = 0

        self.threshold = self.Kconf['default-threshold']
        self.topk = self.Kconf['default-topk']

        Form.__init__(
            self, r"""BUTTON YES* Search
BUTTON CANCEL Cancel
Kam1n0
{FormChangeCb}
Select Function to be searched
<(Use ctrl/shift + click to select multiple functions):{fvChooser}>
<Select all functions:{chkSearchAll}><Skip library functions:{chkSkipLib}>{adSearchGroup}>
Search configuration
<Threshold:{txtSim}>
<TopK     :{txtTopK}>
<Server   :{dpServer}>

""", {
                'adSearchGroup':
                Form.ChkGroupControl(["chkSearchAll", "chkSkipLib"]),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtSim':
                Form.StringInput(
                    swidth=25, tp=Form.FT_ASCII, value=str(self.threshold)),
                'txtTopK':
                Form.StringInput(
                    swidth=25, tp=Form.FT_ASCII, value=str(self.topk)),
                'dpServer':
                Form.DropdownListControl(swidth=45,
                                         width=45,
                                         selval=defaultIndex,
                                         items=dpItems,
                                         readonly=True),
                'fvChooser':
                Form.EmbeddedChooserControl(self.funcList)
            })
        self.Compile()
    def __init__(self, manager):
        self.allFuncs = [GetFunction(x) for x in GetFunctions()]
        self.funcList = FunctionListView("asm",
                                         allFuncs=self.allFuncs,
                                         flags=Choose2.CH_MULTI)
        self.funcs = []

        self.cnn = manager.connector
        self.Kconf = manager.Kconf
        dpItems = self.Kconf['cnns'].keys()
        if self.Kconf['default-cnn'] is not None:
            defaultIndex = self.Kconf['cnns'].keys().index(
                self.Kconf['default-cnn'])
        else:
            defaultIndex = 0

        Form.__init__(
            self, r"""BUTTON YES* Index
BUTTON CANCEL Cancel
Kam1n0
{FormChangeCb}
Select Function to be indexed
<(Use ctrl/shift + click to select multiple functions):{fvChooser}>
<Select all functions:{chkSearchAll}>
<Select all library functions:{chkOnlyLib}>
<Select all but not library functions:{chkSkipLib}>{adSearchGroup}>
Index configuration
<Server   :{dpServer}>
""", {
                'adSearchGroup':
                Form.ChkGroupControl(
                    ["chkSearchAll", "chkSkipLib", "chkOnlyLib"]),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtSim':
                Form.StringInput(swidth=25, tp=Form.FT_ASCII, value='0.5'),
                'dpServer':
                Form.DropdownListControl(swidth=45,
                                         width=45,
                                         selval=defaultIndex,
                                         items=dpItems,
                                         readonly=True),
                'fvChooser':
                Form.EmbeddedChooserControl(self.funcList)
            })
        self.Compile()
        self.activated = False
예제 #11
0
    def __init__(self, cnn, funcs):
        self.cnn = cnn
        self.actionView = ActionView(form=self, funcs=funcs, embedded=True)
        self.initialized = False
        Form.__init__(
            self, r"""BUTTON YES* OK
BUTTON NO NONE
BUTTON CANCEL NONE
Indexing job
{FormChangeCb}
<Index progress:{cEChooser}>
""", {
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'cEChooser':
                Form.EmbeddedChooserControl(self.actionView, swidth=0),
            })
        self.Compile()
예제 #12
0
    def __init__(self):
        self.invert = False
        self.EChooser = EmbeddedChooserClass("Title", flags=Choose.CH_MODAL)
        self.selected_id = 0
        self.s = ""
        self.fst = FuzzySearchThread()
        self.fst.refresh_list.connect(self.refresh_list)
        self.fst.finished.connect(self.finished)
        # self.EChooser = EmbeddedChooserClass("Title", flags=Choose.CH_CAN_REFRESH)
        Form.__init__(self, r"""STARTITEM 
        IDA Fuzzy Search
        {FormChangeCb}
        <:{iStr1}>

        <Results:{cEChooser}>
""", {
            'iStr1': Form.StringInput(),
            'cEChooser': Form.EmbeddedChooserControl(self.EChooser),
            'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
        })
    def __init__(self, cnn, funcs, threshold, topk):
        self.threshold = threshold
        self.topk = topk
        self.cnn = cnn
        self.actionView = ActionView(form=self, funcs=funcs, embedded=True)
        self.ErrorCode = OK
        self.Content = ""
        self.initialized = False
        Form.__init__(
            self, r"""BUTTON YES* OK
BUTTON NO NONE
BUTTON CANCEL NONE
Searching job
{FormChangeCb}
<Searching progress:{cEChooser}>
""", {
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'cEChooser':
                Form.EmbeddedChooserControl(self.actionView, swidth=0),
            })
        self.Compile()
예제 #14
0
    def __init__(self):
        self.invert = False
        self.EChooser = TestEmbeddedChooserClass("E1", flags=Choose2.CH_MULTI)
        Form.__init__(
            self, r"""STARTITEM {id:rNormal}
BUTTON YES* Yeah
BUTTON NO Nope
BUTTON CANCEL Nevermind
Form Test

{FormChangeCb}
This is a string: +{cStr1}+
This is an address: +{cAddr1}+

Escape\{control}
This is a string: '{cStr2}'
This is a number: {cVal1}

<#Hint1#Enter name:{iStr1}>
<#Hint2#Select color:{iColor1}>
Browse test
<#Select a file to open#Browse to open:{iFileOpen}>
<#Select a file to save#Browse to save:{iFileSave}>
<#Select dir#Browse for dir:{iDir}>
Type
<#Select type#Write a type:{iType}>
Numbers
<##Enter a selector value:{iSegment}>
<##Enter a raw hex:{iRawHex}>
<##Enter a character:{iChar}>
<##Enter an address:{iAddr}>
Button test
<##Button1:{iButton1}> <##Button2:{iButton2}>

Check boxes:
<Error output:{rError}>
<Normal output:{rNormal}>
<Warnings:{rWarnings}>{cGroup1}>

Radio boxes:
<Green:{rGreen}>
<Red:{rRed}>
<Blue:{rBlue}>{cGroup2}>
<Embedded chooser:{cEChooser}>
The end!
""", {
                'cStr1': Form.StringLabel("Hello"),
                'cStr2': Form.StringLabel("StringTest"),
                'cAddr1': Form.NumericLabel(0x401000, Form.FT_ADDR),
                'cVal1': Form.NumericLabel(99, Form.FT_HEX),
                'iStr1': Form.StringInput(),
                'iColor1': Form.ColorInput(),
                'iFileOpen': Form.FileInput(open=True),
                'iFileSave': Form.FileInput(save=True),
                'iDir': Form.DirInput(),
                'iType': Form.StringInput(tp=Form.FT_TYPE),
                'iSegment': Form.NumericInput(tp=Form.FT_SEG),
                'iRawHex': Form.NumericInput(tp=Form.FT_RAWHEX),
                'iAddr': Form.NumericInput(tp=Form.FT_ADDR),
                'iChar': Form.NumericInput(tp=Form.FT_CHAR),
                'iButton1': Form.ButtonInput(self.OnButton1),
                'iButton2': Form.ButtonInput(self.OnButton2),
                'cGroup1': Form.ChkGroupControl(
                    ("rNormal", "rError", "rWarnings")),
                'cGroup2': Form.RadGroupControl(("rRed", "rGreen", "rBlue")),
                'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
                'cEChooser': Form.EmbeddedChooserControl(self.EChooser)
            })
예제 #15
0
파일: ui.py 프로젝트: r0mpage/idarop
    def __init__(self, idaropengine, select_list=None):

        self.engine = idaropengine
        self.select_list = select_list
        self.segments = SegmentView(self.engine)

        Form.__init__(
            self, r"""BUTTON YES* Search
Search ROP gadgets

{FormChangeCb}<Segments:{cEChooser}>

<Bad Chars        :{strBadChars}>     
Unicode Table    <ANSI:{rUnicodeANSI}><OEM:{rUnicodeOEM}><UTF7:{rUnicodeUTF7}><UTF8:{rUnicodeUTF8}>{radUnicode}>

<Max gadget size  :{intMaxRopSize}>      
<Max gadget offset:{intMaxRopOffset}>       <Search for ROP gadgets:{cRopSearch}>
<Max RETN imm16   :{intMaxRetnImm}>         <Search for JOP gadgets:{cJopSearch}>
<Max gadgets      :{intMaxRops}>            <Search for SYS gadgets:{cSysSearch}>{gadgetGroup}>

Others settings:
<Allow conditional jumps:{cRopAllowJcc}> <Do not allow bad bytes:{cRopNoBadBytes}>{ropGroup}>
""", {
                'cEChooser':
                Form.EmbeddedChooserControl(self.segments, swidth=110),
                'ropGroup':
                Form.ChkGroupControl(('cRopAllowJcc', 'cRopNoBadBytes')),
                'gadgetGroup':
                Form.ChkGroupControl(
                    ('cRopSearch', 'cJopSearch', 'cSysSearch')),
                'intMaxRopSize':
                Form.NumericInput(swidth=4,
                                  tp=Form.FT_DEC,
                                  value=self.engine.rop.maxRopSize),
                'intMaxRopOffset':
                Form.NumericInput(swidth=4,
                                  tp=Form.FT_DEC,
                                  value=self.engine.rop.maxRopOffset),
                'intMaxRops':
                Form.NumericInput(
                    swidth=4, tp=Form.FT_DEC, value=self.engine.rop.maxRops),
                'intMaxRetnImm':
                Form.NumericInput(swidth=4,
                                  tp=Form.FT_HEX,
                                  value=self.engine.rop.maxRetnImm),
                'intMaxJopImm':
                Form.NumericInput(
                    swidth=4, tp=Form.FT_HEX, value=self.engine.rop.maxJopImm),
                'strBadChars':
                Form.StringInput(swidth=92, tp=Form.FT_ASCII),
                'radUnicode':
                Form.RadGroupControl(("rUnicodeANSI", "rUnicodeOEM",
                                      "rUnicodeUTF7", "rUnicodeUTF8")),
                'strBadMnems':
                Form.StringInput(
                    swidth=92,
                    tp=Form.FT_ASCII,
                    value=
                    "into, in, out, loop, loope, loopne, lock, rep, repe, repz, repne, repnz"
                ),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
            })

        self.Compile()