Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello. I am getting the following errors while executing the project. How can I fix this? I have set up everything according tp the readme file except etc configuration. I am using macos and pycharm. #19

Open
manasvicpatil opened this issue Apr 2, 2024 · 2 comments

Comments

@manasvicpatil
Copy link

Logical attack error:

AutoPentest-DRL: Compute attack path for logical network...
Generate attack graph using MulVAL...
Process attack graph into attack matrix...
Traceback (most recent call last):
File "/Users/manasvipatil/AutoPentest-DRL/DQN/./confirm_path.py", line 9, in
MAP = generateMapClass.sendMap
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/DQN/learn/generateMap.py", line 108, in sendMap
self.x = self.createMatrix()
^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/DQN/learn/generateMap.py", line 20, in createMatrix
self.csvfile = open('../mulval_result/VERTICES.CSV', 'r')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '../mulval_result/VERTICES.CSV'
/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/torch/init.py:696: UserWarning: torch.set_default_tensor_type() is deprecated as of PyTorch 2.1, please use torch.set_default_dtype() and torch.set_default_device() as alternatives. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/tensor/python_tensor.cpp:453.)
_C.set_default_tensor_type(t)
Traceback (most recent call last):
File "/Users/manasvipatil/AutoPentest-DRL/DQN/learn/./dqn_learn.py", line 32, in
env = gym.make('dqnenv-v0')
^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/gym/envs/registration.py", line 581, in make
env_creator = load(spec
.entry_point)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/gym/envs/registration.py", line 61, in load
mod = importlib.import_module(mod_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/Users/manasvipatil/AutoPentest-DRL/DQN/learn/env/environment.py", line 12, in
class dqnEnvironment(gym.Env):
File "/Users/manasvipatil/AutoPentest-DRL/DQN/learn/env/environment.py", line 14, in dqnEnvironment
MAP = np.loadtxt('../processdata/newmap.txt')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/numpy/lib/npyio.py", line 1373, in loadtxt
arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/numpy/lib/npyio.py", line 992, in _read
fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/numpy/lib/_datasource.py", line 193, in open
return ds.open(path, mode, encoding=encoding, newline=newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manasvipatil/AutoPentest-DRL/venv/lib/python3.12/site-packages/numpy/lib/_datasource.py", line 533, in open
raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: ../processdata/newmap.txt not found.

Real attack error:

################################################################################
AutoPentest-DRL: Automated Penetration Testing Using Deep Reinforcement Learning
################################################################################
AutoPentest-DRL: Operation mode: Attack on real network
AutoPentest-DRL: Target topology: MulVAL_P/real_topology_1.P

AutoPentest-DRL: Get vulnerabilities in target network using Nmap...
Run Nmap on target 'webServer' (192.168.56.105)...
Password:
Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-02 15:01 IST
Pre-scan script results:
| broadcast-avahi-dos:
| Discovered hosts:
| 224.0.0.251
| After NULL UDP avahi packet DoS (CVE-2011-1002).
|_ Hosts are all up (not vulnerable).
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 37.41 seconds
ERROR: Host appears to be down
ERROR: Nmap encountered a problem
AutoPentest-DRL: Nmap scanning failed => abort

@manasvicpatil
Copy link
Author

Also I would like to request that you mention the versions of respective libraries in the requirements.txt file

@manasvicpatil
Copy link
Author

I would like to add an update. I changed the path addresses in some of the lines and now I am getting the following error for logical attack:

AutoPentest-DRL: Compute attack path for logical network...
Traceback (most recent call last):
File "/Users/manasvipatil/AutoPentest-DRL/AutoPentest-DRL.py", line 251, in
start_function(model)
File "/Users/manasvipatil/AutoPentest-DRL/AutoPentest-DRL.py", line 225, in start_function
startTrainCode('logical_attack')
File "/Users/manasvipatil/AutoPentest-DRL/AutoPentest-DRL.py", line 160, in startTrainCode
template = env.get_template(LOGICAL_ATTACK_TOPOLOGY)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/jinja2/environment.py", line 997, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/jinja2/environment.py", line 958, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/jinja2/loaders.py", line 125, in load
source, filename, uptodate = self.get_source(environment, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/lib/python3.11/site-packages/jinja2/loaders.py", line 214, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: /Users/manasvipatil/AutoPentest-DRL/MulVAL_P/logical_topology_1.P

The error for real attack hasn't changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant