ghidra + gdbghidra?

Тема в разделе "WASM.RESEARCH", создана пользователем addedie, 30 мар 2020.

  1. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    как установить gdbghidra для Ghidra последней версии?
    --- Сообщение объединено, 30 мар 2020 ---
    вот такая ошибка у меня
    Код (DOS):
    1.                                                                                      
    2. admix@buben:/opt/gdbghidra-master$ gradle
    3. Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true                                                                                                                                                        
    4.  
    5. > Task :compileJava
    6. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:32: error: cannot find symbol                                                                                                                                  
    7. import ghidra.app.util.MemoryBlockUtil;                                                                                                                                                                                              
    8.                       ^                                                                                                                                                                                                            
    9.   symbol:   class MemoryBlockUtil                                                                                                                                                                                                    
    10.   location: package ghidra.app.util                                                                                                                                                                                                  
    11. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:33: error: cannot find symbol                                                                                                                                  
    12. import ghidra.app.util.importer.MemoryConflictHandler;                                                                                                                                                                              
    13.                                ^                                                                                                                                                                                                    
    14.   symbol:   class MemoryConflictHandler                                                                                                                                                                                              
    15.   location: package ghidra.app.util.importer                                                                                                                                                                                        
    16. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:99: error: cannot find symbol                                                                                                                                  
    17.                 MemoryConflictHandler memoryConflictHandler = MemoryConflictHandler.ALWAYS_OVERWRITE;                                                                                                                                
    18.                 ^                                                                                                                                                                                                                  
    19.   symbol:   class MemoryConflictHandler                                                                                                                                                                                              
    20.   location: class MemoryEvent                                                                                                                                                                                                        
    21. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:99: error: cannot find symbol                                                                                                                                  
    22.                 MemoryConflictHandler memoryConflictHandler = MemoryConflictHandler.ALWAYS_OVERWRITE;                                                                                                                                
    23.                                                               ^
    24.   symbol:   variable MemoryConflictHandler
    25.   location: class MemoryEvent
    26. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:100: error: cannot find symbol
    27.                 MemoryBlockUtil mbu = new MemoryBlockUtil( currentProgram, memoryConflictHandler );
    28.                 ^
    29.   symbol:   class MemoryBlockUtil
    30.   location: class MemoryEvent
    31. /opt/gdbghidra-master/src/main/java/gdbghidra/events/MemoryEvent.java:100: error: cannot find symbol
    32.                 MemoryBlockUtil mbu = new MemoryBlockUtil( currentProgram, memoryConflictHandler );
    33.                                           ^
    34.   symbol:   class MemoryBlockUtil
    35.   location: class MemoryEvent
    36. Note: Some input files use unchecked or unsafe operations.
    37. Note: Recompile with -Xlint:unchecked for details.
    38. 6 errors
    39.  
    40. > Task :compileJava FAILED
    41.  
    42. FAILURE: Build failed with an exception.
    43.  
    44. * What went wrong:
    45. Execution failed for task ':compileJava'.
    46. > Compilation failed; see the compiler error output for details.
    47.  
    48. * Try:
    49. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    50.  
    51. * Get more help at https://help.gradle.org
    52.  
    53. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    54. Use '--warning-mode all' to show the individual deprecation warnings.
    55. See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
    56.  
    57. BUILD FAILED in 3s
    58. 1 actionable task: 1 executed
    плагины из архива неподхватываются гидро ругается на версии
     
    Последнее редактирование: 30 мар 2020
  2. f13nd

    f13nd Well-Known Member

    Публикаций:
    0
    Регистрация:
    22 июн 2009
    Сообщения:
    1.954
    А что ты пытаешься собирать градлом, если:
    ?

    gdb_ghidra_bridge_client.py - тупо гейт-скрипт, связывающийся с плугином для гидры.
    ghidra_9.0.4_PUBLIC_20190526_gdbghidra.zip - плугин для гидры (уже компильнутый, надо только установить). Кстати под актуальную версию 9.1 нет.

    ЗЫ: а понял. Вот, веселись.
    --- Сообщение объединено, 30 мар 2020 ---
    Вобщем по-варварски надругавшись над классом Events/MemoryEvent.java собрал эту вундервафлю для 9.1.2 На будущее - в GhidraDev плугине для еклипса есть gradle wrapper (когда градл ты себе не устанавливаешь, конпелируешь на чужом сервере), с ним все становится проще.
     

    Вложения:

    Последнее редактирование: 30 мар 2020
  3. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    Код (DOS):
    1. admix@buben:~/learn$ gdb ./a.out
    2. GNU gdb (Debian 9.1-2) 9.1
    3. Copyright (C) 2020 Free Software Foundation, Inc.                                                                                                                                                                                        
    4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    5. This is free software: you are free to change and redistribute it.
    6. There is NO WARRANTY, to the extent permitted by law.
    7. Type "show copying" and "show warranty" for details.
    8. This GDB was configured as "x86_64-linux-gnu".
    9. Type "show configuration" for configuration details.
    10. For bug reporting instructions, please see:
    11. <http://www.gnu.org/software/gdb/bugs/>.
    12. Find the GDB manual and other documentation resources online at:
    13.     <http://www.gnu.org/software/gdb/documentation/>.
    14.  
    15. For help, type "help".
    16. Type "apropos word" to search for commands related to "word"...
    17. /home/admix/.gdbinit:1: Error in sourced command file:
    18. ~/gdb_ghidra_bridge_client.py:25: Error in sourced command file:
    19. Undefined command: "from".  Try "help".
    20. Reading symbols from ./a.out...
    21. (No debugging symbols found in ./a.out)
    22. (gdb) ghidrabridge 127.0.0.1:2305
    23. Undefined command: "ghidrabridge".  Try "help".
    24. (gdb)
    25.  
    вот такая фигня
     
  4. f13nd

    f13nd Well-Known Member

    Публикаций:
    0
    Регистрация:
    22 июн 2009
    Сообщения:
    1.954
     
  5. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    вот так уже лучше но неработает

    Код (DOS):
    1. admix@buben:~/learn$ sudo gdb ./a.out
    2. GNU gdb (Debian 9.1-2) 9.1
    3. Copyright (C) 2020 Free Software Foundation, Inc.                                                                
    4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    5. This is free software: you are free to change and redistribute it.
    6. There is NO WARRANTY, to the extent permitted by law.
    7. Type "show copying" and "show warranty" for details.
    8. This GDB was configured as "x86_64-linux-gnu".
    9. Type "show configuration" for configuration details.
    10. For bug reporting instructions, please see:
    11. <http://www.gnu.org/software/gdb/bugs/>.
    12. Find the GDB manual and other documentation resources online at:
    13.     <http://www.gnu.org/software/gdb/documentation/>.
    14.  
    15. For help, type "help".
    16. Type "apropos word" to search for commands related to "word"...
    17. Reading symbols from ./a.out...
    18. (No debugging symbols found in ./a.out)
    19. (gdb) ghidrabridge 127.0.0.1:2305
    20. Undefined command: "ghidrabridge".  Try "help".
    21. (gdb) quit
    22.  
    --- Сообщение объединено, 31 мар 2020 ---
    это я сделал f13nd
     
  6. f13nd

    f13nd Well-Known Member

    Публикаций:
    0
    Регистрация:
    22 июн 2009
    Сообщения:
    1.954
    Ну видно же по логу, что гдб не знает такой команды. Значит питоноплугин, регистрирующий ее, не загрузился.
     
  7. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    сори я под судо запускал а там же своя папка , вобщем я прописал щас вот такой вывод
    Код (DOS):
    1. admix@buben:~/learn$ sudo gdb ./a.out
    2. GNU gdb (Debian 9.1-2) 9.1
    3. Copyright (C) 2020 Free Software Foundation, Inc.                                                                
    4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    5. This is free software: you are free to change and redistribute it.
    6. There is NO WARRANTY, to the extent permitted by law.
    7. Type "show copying" and "show warranty" for details.
    8. This GDB was configured as "x86_64-linux-gnu".
    9. Type "show configuration" for configuration details.
    10. For bug reporting instructions, please see:
    11. <http://www.gnu.org/software/gdb/bugs/>.
    12. Find the GDB manual and other documentation resources online at:
    13.     <http://www.gnu.org/software/gdb/documentation/>.
    14.  
    15. For help, type "help".
    16. Type "apropos word" to search for commands related to "word"...
    17. [GDBGHIDRA] found architecture 'i386'
    18.  
    19. [GDBGHIDRA] found endianess 'little'
    20.  
    21. [Errno 111] В соединении отказано
    22. Traceback (most recent call last):
    23.   File "/home/admix/gdb_ghidra_bridge_client.py", line 66, in send_message
    24.     self.connect()
    25.   File "/home/admix/gdb_ghidra_bridge_client.py", line 55, in connect
    26.     self._socket.connect((self._ghidra_ip, self._ghidra_port))
    27. ConnectionRefusedError: [Errno 111] В соединении отказано
    28.  
    29. During handling of the above exception, another exception occurred:
    30.  
    31. Traceback (most recent call last):
    32.   File "/home/admix/gdb_ghidra_bridge_client.py", line 386, in <module>
    33.     GhidraBridgeCommand()
    34.   File "/home/admix/gdb_ghidra_bridge_client.py", line 251, in __init__
    35.     self._ghidra_bridge.send_message( GhidraMessages.hello(GDBUtils.get_arch(), GDBUtils.get_endian(), self._gdb_ip, self._gdb_port) )
    36.   File "/home/admix/gdb_ghidra_bridge_client.py", line 73, in send_message
    37.     self.connect()
    38.   File "/home/admix/gdb_ghidra_bridge_client.py", line 55, in connect
    39.     self._socket.connect((self._ghidra_ip, self._ghidra_port))
    40. ConnectionRefusedError: [Errno 111] В соединении отказано
    41. Reading symbols from ./a.out...
    42. (No debugging symbols found in ./a.out)
    43. (gdb)
    44.  
     
  8. f13nd

    f13nd Well-Known Member

    Публикаций:
    0
    Регистрация:
    22 июн 2009
    Сообщения:
    1.954
    Ну написано же по-русски аж: _socket.connect() - в соединении отказано.
     
  9. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    [​IMG]

    [​IMG]

    [​IMG]

    как теперь заюзать это все? есть мануал гденибудь...?а то я к иде привык....
     
  10. f13nd

    f13nd Well-Known Member

    Публикаций:
    0
    Регистрация:
    22 июн 2009
    Сообщения:
    1.954
    Скрипту становится плохо при установке соединения сокет-апями. Погугли что-нибудь про настройку привилегий или фраервола в линуксе, я точно ни бельмеса в этом не понимаю.
     
  11. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    Код (DOS):
    1.  
    2. admix@buben:~/learn$ sudo gdb ./a.out
    3. GNU gdb (Debian 9.1-2) 9.1
    4. Copyright (C) 2020 Free Software Foundation, Inc.  
    5. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    6. This is free software: you are free to change and redistribute it.
    7. There is NO WARRANTY, to the extent permitted by law.
    8. Type "show copying" and "show warranty" for details.
    9. This GDB was configured as "x86_64-linux-gnu".
    10. Type "show configuration" for configuration details.
    11. For bug reporting instructions, please see:
    12. <http://www.gnu.org/software/gdb/bugs/>.
    13. Find the GDB manual and other documentation resources online at:
    14.   <http://www.gnu.org/software/gdb/documentation/>.
    15.  
    16. For help, type "help".
    17. Type "apropos word" to search for commands related to "word"...
    18. [GDBGHIDRA] found architecture 'i386'
    19.  
    20. [GDBGHIDRA] found endianess 'little'
    21.  
    22. Reading symbols from ./a.out...
    23. (No debugging symbols found in ./a.out)
    24. (gdb) help
    25. List of classes of commands:
    26.  
    27. aliases -- Aliases of other commands.
    28. breakpoints -- Making program stop at certain points.
    29. data -- Examining data.
    30. files -- Specifying and examining files.
    31. internals -- Maintenance commands.
    32. obscure -- Obscure features.
    33. running -- Running the program.
    34. stack -- Examining the stack.
    35. status -- Status inquiries.
    36. support -- Support facilities.
    37. tracepoints -- Tracing of program execution without stopping the program.
    38. user-defined -- User-defined commands.
    39.  
    40. Type "help" followed by a class name for a list of commands in that class.
    41. Type "help all" for the list of all commands.
    42. Type "help" followed by command name for full documentation.
    43. Type "apropos word" to search for commands related to "word".
    44. Type "apropos -v word" for full documentation of commands related to "word".
    45. Command name abbreviations are allowed if unambiguous.
    46. (gdb) ghidrabridge 127.0.0.1:2305
    47. ghidrabridge: using ip: 127.0.0.1 port: 2305
    48.  
    49. (gdb)
    50.  
    такс приконектился вроде че терь делать пока хз
    --- Сообщение объединено, 31 мар 2020 ---
    все оказалось проще пареной репы, всем спасибо
     
  12. addedie

    addedie New Member

    Публикаций:
    0
    Регистрация:
    14 авг 2019
    Сообщения:
    25
    чет я недогнал как трассировать программу
    [​IMG]

    [​IMG]