Release Setting up Ida with Pyside and PyQt, it makes big difference.

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
Very impressive
How did you get the tollbag to run correct i get this error.
Code:
Error after launch plugin:
IDAPython: Error while calling Python callback
UI object has no attribute  "ui_hook"
Think its due to wrong version.
Look here https://github.com/kyrus/ida-translator/issues/1
when usesd with ida pro demo 6.4 there is no error.
 

computerline

New member
Ida Pro Expert
I had download idapython revision 362, replace idc.py rev 362 with idc.py rev 365 and fix some issue to compile with Array netnode, now I can run ida-translator but hot keys is not working, because IDA 6.1 don't support idaapi.add_hotkey(...).

I find some code to add hot keys to IDA, but I don't known how to Call class function with this code. This is my ida-translate fix:
Code:
# Line 579 ida-translator.py
# set hotkey
idaapi.CompileLine('static _keypress() { RunPythonStatement("translator.hotkeyPressed()");}')
AddHotkey("Ctrl+R", '_keypress')
#translator.hotkeyPressed()
'''
try:
    hotkey_ctx
    if idaapi.del_hotkey(hotkey_ctx):
        del hotkey_ctx
except:
    hotkey_ctx = idaapi.add_hotkey("Ctrl-R", translator.hotkeyPressed)
    if hotkey_ctx is None:
        del hotkey_ctx
'''
code above not work because it can't call : translator.hotkeyPressed()
So who known how to fix this ? or any idea to workaround ?
Thanks you !
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
This is my toolbag after fix

I must disable register_timer because it's not support int IDA 6.1
Toolbag still make IDA Crash when I close IDA (I can't figuare out)

Code:
Above error is by ui_hook is not a member of UI Class, so I add
 
self.ui_hook = None
Code:
self.ui_hook = False
works better
No Error when closing
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
LOL if you edit the idc.py
Code:
SIZE_MAX        = idaapi.SIZE_MAX
 
to
 
SIZE_MAX        = False
 
or
 
SIZE_MAX        =  idaapi.MAXADDR

You can use the newest revision :)
 

computerline

New member
Ida Pro Expert
LOL if you edit the idc.py
Code:
SIZE_MAX        = idaapi.SIZE_MAX
 
to
 
SIZE_MAX        = False

You can use the newest revision :)


I downloaded the latest revision, but while compiling, i get this error :

Code:
idaapi.cpp(6777) : error C3861: 'internal_get_sreg_base': identifier not found
idaapi.cpp(6812) : error C3861: 'read_dbg_memory': identifier not found
idaapi.cpp(6841) : error C3861: 'write_dbg_memory': identifier not found
idaapi.cpp(6888) : error C3861: 'get_dbg_memory_info': identifier not found
....................
How can you compile ? :)
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
I havent tried to compile it yet.
I editet the idc.py
then the latest idautil..py also works
Actuelly the idaapi also 1.5.2 version have ui hooks
but arrons toolbag was not made for that version at all
From python shell within ida

Code:
> import idaapi
> from idaapi import UI_Hooks
> help ("idaapi.UI_Hooks")
 
Python>help ("idaapi.UI_Hooks")
Help on class UI_Hooks in idaapi:
 
idaapi.UI_Hooks = class UI_Hooks(__builtin__.object)
|  Proxy of C++ UI_Hooks class
|
|  Methods defined here:
|
|  __del__ lambda self
|
|  __disown__(self)
|
|  __init__(self, *args)
|      __init__(self) -> UI_Hooks
|
|  __repr__ = _swig_repr(self)
|
|  get_ea_hint(self, *args)
|      get_ea_hint(self, ea_t arg0) -> PyObject
|
|  hook(self, *args)
|      hook(self) -> bool
|
|  postprocess(self, *args)
|      postprocess(self)
|
|  preprocess(self, *args)
|      preprocess(self, char arg0) -> int
|
|  saved(self, *args)
|      saved(self)
|
|  saving(self, *args)
|      saving(self)
|
|  term(self, *args)
|      term(self)
|
|  unhook(self, *args)
|      unhook(self) -> bool
|
|  ----------------------------------------------------------------------
|  Data descriptors defined here:
|
|  __dict__
|      dictionary for instance variables (if defined)
|
|  __weakref__
|      list of weak references to the object (if defined)
|
|  thisown
|      The membership flag
|
|  ----------------------------------------------------------------------
|  Data and other attributes defined here:
|
|  __swig_destroy__ = <built-in function delete_UI_Hooks>
|      delete_UI_Hooks(UI_Hooks self)

i uploaded my revision off ida *.py
 

Attachments

  • pythonlatest.rar
    200.3 KB · Views: 26

computerline

New member
Ida Pro Expert
And this is my ida-translator-fix
Code:
 https://anonfiles.com/file/0d35688a3935cd12a07219404612cd7c
Some code need to edit :D I still can't display unicode in comments
I figure out, don't need to register hot_key, we load it while we need translate :)
 

computerline

New member
Ida Pro Expert
This is my ida-translator full fix for IDA 6.1 (hot_key working)
Code:
https://anonfiles.com/file/767639486c7731df90bd990d2983aed6
Edit this line (324) to translate in another language
Code:
translator = Translator2(from_lang='auto', to_lang='vi')
Language Code
Code:
https://developers.google.com/translate/v2/using_rest?hl=ja
Hope it will be useful :)
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
can you make an small tut how to build Python.plw ( idapython-1.5.2_ida6.1_py2.7_win32.7z)
 

computerline

New member
Ida Pro Expert
As Revision 361 is the latest revision support for IDA 6.1, we need to download this revision.
1. Go to site : https://code.google.com/p/idapython/source/checkout
2. Copy download trunk link : svn checkout http://idapython.googlecode.com/svn/trunk/ and paste into Tortoise SVN, in the box Revision, I type 361 and click OK, this will download this revision to my computer.
3. We need set some Environments Variable on Windows to compile:
We need to use vcvars32 to Init VC Compiler, so I add C:\Program Files\Microsoft Visual Studio 10.0\VC\bin to my PATH environment
IDA=D:\RCE\IDA\\sdk\
IDADIR=D:\RCE\IDA\
IDASDK=D:\RCE\IDA\\sdk
INCLUDE=C:\Program Files\Microsoft Visual Studio 10.0\VC\include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;D:\RCE\IDA\include;C:\Qt\4.8.5\include;D:\RCE\IDA\\sdk\\include
INCLUDEPY=C:\Python27\include
LIB=C:\Program Files\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Python27\Lib;C:\Qt\4.8.5\lib

4. Start >> All Programs >> Visual Studio 10 >> Visual Studio Tools >> Visual Studio Commant Prompt
>cd /d C:\idapythonrv316
>build.py

:)
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
did you get the swig error also


Code:
swig -modern -python -c++ -w451 -shadow -D__GNUC__ -DNO_OBSOLETE_FUNCS -D__NT__  -Iswig -o idaapi.cpp  -IC:\idasdk61\include idaapi.i
 
Traceback (most recent call last):
  File "C:\build-1.5.2\build.py", line 506, in <module>
    main()
  File "C:\build-1.5.2\build.py", line 500, in main
    build_binary_package(ea64=False, nukeold=True)
  File "C:\build-1.5.2\build.py", line 409, in build_binary_package
    build_plugin(platform_string, IDA_SDK, plugin_name, ea64)
  File "C:\build-1.5.2\build.py", line 354, in build_plugin
    assert res == -1, "Failed to build the wrapper with SWIG"
AssertionError: Failed to build the wrapper with SWIG
Damn wierd first time the version 1.5 1 build good , then i tried 1.5 2
Went baxk to 1.5.1 then same error as 1.5 2 .
Is there any varibles for swig.thougt it wad only the binary that matters
 

computerline

New member
Ida Pro Expert
did you get the swig error also


Code:
swig -modern -python -c++ -w451 -shadow -D__GNUC__ -DNO_OBSOLETE_FUNCS -D__NT__  -Iswig -o idaapi.cpp  -IC:\idasdk61\include idaapi.i
 
Traceback (most recent call last):
  File "C:\build-1.5.2\build.py", line 506, in <module>
    main()
  File "C:\build-1.5.2\build.py", line 500, in main
    build_binary_package(ea64=False, nukeold=True)
  File "C:\build-1.5.2\build.py", line 409, in build_binary_package
    build_plugin(platform_string, IDA_SDK, plugin_name, ea64)
  File "C:\build-1.5.2\build.py", line 354, in build_plugin
    assert res == -1, "Failed to build the wrapper with SWIG"
AssertionError: Failed to build the wrapper with SWIG
Damn wierd first time the version 1.5 1 build good , then i tried 1.5 2
Went baxk to 1.5.1 then same error as 1.5 2 .
Is there any varibles for swig.thougt it wad only the binary that matters

Which idapython package you are using ? You can you "-v" option with swig to display swig error, some options you can references ! I don't edit any in idapython :)

Code:
http://www.swig.org/Doc1.1/HTML/SWIG.html
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
i think it must be some sort off environment varible or path that must be set, Do you have set any Swig ones ?

What package off swig do you use
 

Storm Shadow

Administrator
Staff member
Developer
Ida Pro Expert
Elite Cracker
okay i got some errors but revision 361 does build

Python:
c:\build-1.5.1>python build.py
swig -modern -python -c++ -w451 -shadow -D__GNUC__ -DNO_OBSOLETE_FUNCS -D__NT__
-Iswig -o idaapi.cpp  -IC:\idasdk61\include idaapi.i
SWIG(1) : Warning 125: Use of the include path to find the input file is depreca
ted and will not work with ccache. Please include the path when specifying the i
nput file.
cl /nologo /EHsc /Foidaapi.obj /c idaapi.cpp /I. /Iswig /IC:\Python27\include /I
C:\idasdk61\include  /DVER_MAJOR="1" /DVER_MINOR="5" /DVER_PATCH="2" /D__IDP__ /
DMAXSTR="1024" /DUSE_DANGEROUS_FUNCTIONS /DUSE_STANDARD_FILE_FUNCTIONS /DWIN32 /
D_USRDLL /D__NT__ /D__NT__ /DPLUGINFIX
idaapi.cpp
C:\idasdk61\include\pro.h(83) : warning C4005: 'USE_DANGEROUS_FUNCTIONS' : macro
redefinition
        command-line arguments :  see previous definition of 'USE_DANGEROUS_FUNC
TIONS'
C:\idasdk61\include\pro.h(84) : warning C4005: 'USE_STANDARD_FILE_FUNCTIONS' : m
acro redefinition
        command-line arguments :  see previous definition of 'USE_STANDARD_FILE_
FUNCTIONS'
idaapi.cpp(67889) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(67934) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(67999) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(68064) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(68109) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(70671) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(70788) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(70854) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(70949) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(71042) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(84397) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(87743) : warning C4804: '>' : unsafe use of type 'bool' in operation
idaapi.cpp(114083) : warning C4804: '>' : unsafe use of type 'bool' in operation
 
cl /nologo /EHsc /Fopython.obj /c python.cpp /I. /Iswig /IC:\Python27\include /I
C:\idasdk61\include  /DVER_MAJOR="1" /DVER_MINOR="5" /DVER_PATCH="2" /D__IDP__ /
DMAXSTR="1024" /DUSE_DANGEROUS_FUNCTIONS /DUSE_STANDARD_FILE_FUNCTIONS /DWIN32 /
D_USRDLL /D__NT__ /D__NT__ /DPLUGINFIX
python.cpp
C:\idasdk61\include\pro.h(83) : warning C4005: 'USE_DANGEROUS_FUNCTIONS' : macro
redefinition
        command-line arguments :  see previous definition of 'USE_DANGEROUS_FUNC
TIONS'
C:\idasdk61\include\pro.h(84) : warning C4005: 'USE_STANDARD_FILE_FUNCTIONS' : m
acro redefinition
        command-line arguments :  see previous definition of 'USE_STANDARD_FILE_
FUNCTIONS'
link /nologo /dll /export:PLUGIN /out:python.plw idaapi.obj python.obj /LIBPATH:
C:\Python27\libs /LIBPATH:C:\idasdk61\lib\x86_win_vc_32 python27.lib ida.lib
  Creating library python.lib and object python.exp
 
c:\build-1.5.1>
i rebuilded swig and added it to INCLUDE PATH

http://techbliss.org/threads/post-code-with-highlight-in-thread-almost-all-langueges.135/
 
Top