junxzm1990 / x86-sok

124 stars 20 forks source link

ghidraBB.py can not execute correctly under jython 2.1.7,I want to know your env. #11

Closed cL0und closed 2 years ago

cL0und commented 2 years ago

Hi, junxzm1990 when I used ghidraBB.py to generate result,the py gave me some error info like this. FEA169EE56C8B673A6D36321C1173FDC But I do have this dependency installed. image Then I found the similar problem on stackflow which suggests me using command touch __init__.py under dependency dir.

It worked, however, a new problem had arisen. image

I also found a similar problem on a github issue of protobuf,whereas I could not get more useful information which can make me fix it.

The follow is my env: python 2.7.17

pip list asn1crypto (0.24.0) capstone (4.0.2) cryptography (2.1.4) enum34 (1.1.6) idna (2.6) ipaddress (1.0.17) keyring (10.6.0) keyrings.alt (3.0) pip (9.0.1) protobuf (3.17.2) pycrypto (2.6.1) pyelftools (0.27) pygobject (3.26.1) pyxdg (0.25) SecretStorage (2.3.1) setuptools (39.0.1) six (1.11.0) wheel (0.30.0)

ghidra_10.0.3_PUBLIC with jython 2.1.7

my cmdline: cd ~/x86-sok-master/disassemblers/ghidra && /root/ghidra_10.0.3_PUBLIC/support/analyzeHeadless ~ test_project -scriptPATH $PWD -postScript ghidraBB.py -deleteProject -import ~/test/test_switch

And,I want to know your env.

Thanks.

bin2415 commented 2 years ago

Hello, @cL0und. The env of Ghidra is jython. I wrote a blog to show how to import external package in jython.

cL0und commented 2 years ago

Hello, @cL0und. The env of Ghidra is jython. I wrote a blog to show how to import external package in jython.

Thanks for your reply.But ghidraBB.py has certainly processed this step,in other words I should not config it once again, so I think error is not here.I guess this may be a version problem, therefore I want to know the version information in your experimental environment.

bin2415 commented 2 years ago

The version of python is 2.7 and the version of ghidra is 9.0.4.

Could you try to rebuilt blocks_pb2.py by using your own protoc. The protobuf file is here.

cL0und commented 2 years ago

Sorry I don't know clearly what the "rebuilt blocks_pb2.py" means.BTW could you please give me your protobuf version?Thanks very much!

bin2415 commented 2 years ago

The protobuf version is 3.12.1.

The blocks_pb2.py is generated by protoc. Please do the following to generate new blocks_pb2.py:

protoc --python_out=$PWD --proto_path=../../protobuf_def/ blocks.proto
cL0und commented 2 years ago

The protobuf version is 3.12.1.

The blocks_pb2.py is generated by protoc. Please do the following to generate new blocks_pb2.py:

protoc --python_out=$PWD --proto_path=../../protobuf_def/ blocks.proto

Thx,I will try it tomorrow. Good Night :)

cL0und commented 2 years ago

Hi,I found the problem is that jython don't support lone surrogates. Finally I change a little source code of protobuf to skip the unimportant step and it didn't throw error again.But it's still weird that you didn't meet the problem in your env. Anyway, thanks for your help.