13o-bbr-bbq / machine_learning_security

Source code about machine learning and security.
1.98k stars 657 forks source link

int is not allowed for map key? #60

Open renzokushineshinemisairu opened 4 years ago

renzokushineshinemisairu commented 4 years ago

Hi.

Running in training mode, the following error occurs: Can you think of any reasons?

============================== Traceback (most recent call last): File "DeepExploit.py", line 2340, in com_exploit_list = env.get_exploit_list() File "DeepExploit.py", line 1084, in get_exploit_list module_info = self.client.get_module_info('exploit', exploit) File "DeepExploit.py", line 240, in get_module_info return self.call('module.info', [module_type, module_name]) File "DeepExploit.py", line 113, in call return msgpack.unpackb(resp.read()) File "msgpack/_unpacker.pyx", line 195, in msgpack._cmsgpack.unpackb ValueError: int is not allowed for map key

===============================

[condition]

I had some errors, so I modified the code:

  1. Followed this answer,「nmap result」read from xml.: https://github.com/13o-bbr-bbq/machine_learning_security/issues/42#issuecomment-561945583

nmap_result = '' #it's original: original row number = 888

after modify.

nmap_result = open(nmap_result_file, 'rb').read()

  1. 「nmup_result」 is decoded after concat ret.get(b'data').

nmap_result += ret.get(b'data').decode('utf-8') #it's original: original row number = 902

after modify.

nmap_result += ret.get(b'data') # nmap_result = nmap_result.decode('utf-8') #modify

Plese help...

cstayyab commented 4 years ago

Check the msgpack version using

pip3 freeze | grep msgpack

On my one system it is 0.6.2 and it is not giving error but on my other system msgpack version is 1.0.0 and it gives error. Downgrading to 0.6.2 should remove this error.

renzokushineshinemisairu commented 4 years ago

Check the msgpack version using

pip3 freeze | grep msgpack

On my one system it is 0.6.2 and it is not giving error but on my other system msgpack version is 1.0.0 and it gives error. Downgrading to 0.6.2 should remove this error.

Thanks for your answer. I resolved about the problem!

But, an other problem is happened. I executed the following code, the following error occurs:

<code: #it's original: original row number =2290> SESS.run(tf.global_variables_initializer()) # Initialize variable.

<result & error:> [+] Executing start: local_thread1 [+] Executing start: local_thread2 [+] Executing start: local_thread3 [+] Executing start: local_thread4 [+] Executing start: local_thread5 [+] Executing start: local_thread6 [+] Executing start: local_thread7 [+] Executing start: local_thread8 [+] Executing start: local_thread9 [+] Executing start: local_thread10 [+] Executing start: local_thread11 [+] Executing start: local_thread12 [+] Executing start: local_thread13 [+] Executing start: local_thread14 [+] Executing start: local_thread15 [+] Executing start: local_thread16 [+] Executing start: local_thread17 [+] Executing start: local_thread18 [+] Executing start: local_thread19 [+] Executing start: local_thread20 Exception in thread Thread-2: # Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "DeepExploit.py", line 2422, in job = lambda: worker.run(exploit_tree, target_tree, saver, env.save_file) File "DeepExploit.py", line 2170, in run self.environment.run(exploit_tree, target_tree) File "DeepExploit.py", line 2052, in run skip_flag, s, payload_list, target_list, target_info = self.env.reset_state(exploit_tree, target_tree) File "DeepExploit.py", line 1201, in reset_state self.normalization(ST_MODULE) File "DeepExploit.py", line 881, in normalization prompt_num = self.state[ST_MODULE] IndexError: list index out of range

...(* it occurs at all thread.)

=============================================

Please help because I don't know what is bad.

LinCla commented 3 years ago

使用 msgpack 版本检查

pip3 freeze | grep msgpack

在我的一个系统上, 它是 0.6.2, 它不给错误, 但我的另一个系统 msgpack 版本是 1.0.0, 它给出了错误。降级到 0.6.2 应删除此错误。

谢谢你的回答。我解决了这个问题!

How did you solve this problem, because I also encountered it; I look forward to your reply