13o-bbr-bbq / machine_learning_security

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

Issue with Deep Exploit #34

Open geniusKoder opened 5 years ago

geniusKoder commented 5 years ago

Everything runs smoothly but I hit this error at almost the end. Any idea if this is a bug?

Traceback (most recent call last):
  File "DeepExploit.py", line 2309, in <module>
    saver.restore(SESS, env.save_file)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/saver.py", line 1268, in restore
    + compat.as_text(save_path))
ValueError: The passed save_path is not a valid checkpoint: /root/machine_learning_security/DeepExploit/trained_data/DeepExploit.ckpt
geniusKoder commented 5 years ago

Ok I somehow managed to get it working, exploits are successful but no report is generated at the end of it

geniusKoder commented 5 years ago

From what I see, it seems to be prematurely shutting down. Would love to work on a fix with admin. Thank you!

[*] Start time: 2019/05/05 07:07:48
[*] Port scanning: 192.168.234.2 [Elapsed time: 0 s]
[*] Executing keep_alive..
[*] End time  : 2019/05/05 07:07:55
[+] Get port list from nmap_result_192.168.234.2.xml.
[!] No open port.
[!] Shutdown Deep Exploit...
wan721 commented 5 years ago

Hi, I have the same problem. The result from Metasploit is generated correctly, i can see that the nmapresult.xml file contains some open ports. But somehow DeepExploit can't seem to locate that file (or it's not downloading that xml file correctly and therefore couldn't find it?). I can see that the demo video starts from nmap had already been performed and skipped the nmap stage entirely. I tried to manually copy the result xml file to the same directory that ran DeepExploit.py to no avail. Couldn't this be a known issue and require fixing? Thank you.

seanrclayton commented 5 years ago

So my code is a workaround. Not going to do a pull request. Here is how i got it to work. in def get_port_list i added

def get_port_list(self, nmap_result_file, rhost):

      cool = open(nmap_result_file).read()
      ....

then changed the bs variable to: bs = BeautifulSoup(cool, 'lxml')

Pluto0310 commented 5 years ago

So my code is a workaround. Not going to do a pull request. Here is how i got it to work. in def get_port_list i added

def get_port_list(self, nmap_result_file, rhost):

      cool = open(nmap_result_file).read()
      ....

then changed the bs variable to: bs = BeautifulSoup(cool, 'lxml')

and i got this error Traceback (most recent call last): File "DeepExploit.py", line 2230, in com_port_list, proto_list, info_list = env.get_port_list(nmap_result, env.rhost) File "DeepExploit.py", line 938, in get_port_list info_list[idx])) IndexError: list index out of range How can i fix this problem
thank you

skyghost66 commented 5 years ago

Hello I have the same issue and I add change in the code like @seanrclayton said but I get the same error! @seanrclayton can you please share your code from that function how it's look like, I really appreciate thank you!

tarihub commented 4 years ago

@Pluto0310 I may found out the reason. Looking care of the nmap output xml file, we will see that none all of the <port ...></port> field include <service>.

Let's see DeepExploit.py #L922, if some port exclude <service>, the info_list would not append an element. So we would get the tip of "IndexError: list index out of range"

the solve way is add three lines before here as follow:

else:
    info_list.append('unknown')

after modify it, it likes:

                for obj_child in port.contents:
                    if obj_child.name == 'service':
                        temp_info = ''
                        if 'product' in obj_child.attrs:
                            temp_info += obj_child.attrs['product'] + ' '
                        if 'version' in obj_child.attrs:
                            temp_info += obj_child.attrs['version'] + ' '
                        if 'extrainfo' in obj_child.attrs:
                            temp_info += obj_child.attrs['extrainfo']
                        if temp_info != '':
                            info_list.append(temp_info)
                        else:
                            info_list.append('unknown')
                        break
                else:
                    info_list.append('unknown')
                # Display getting port information.
                self.util.print_message(const.OK, 'Getting {}/{} info: {}'.format(str(port.attrs['portid']),
                                                                                  port.attrs['protocol'],
                                                                                  info_list[idx]))

After modified: image

antdzek commented 3 years ago

@TARI0510 that works for me, thanks!

tarihub commented 3 years ago

@TARI0510 that works for me, thanks!

It's great to help you~

XUPillar commented 2 years ago

微信截图_20220305120354 how to solve this problem