crond-jaist / AutoPentest-DRL

AutoPentest-DRL: Automated Penetration Testing Using Deep Reinforcement Learning
BSD 3-Clause "New" or "Revised" License
331 stars 82 forks source link

OSError: ../processdata/newmap.txt not found. #13

Closed ch1nhpd closed 1 year ago

ch1nhpd commented 1 year ago

Hi, Can someone help me please? I encountered the following problem:

python3 ./AutoPentest-DRL.py logical_attack_gen

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

AutoPentest-DRL: Create random topology using topology-generator... Saved topology in 'Topology_generator/topology-generator/top_info_1.json'.

AutoPentest-DRL: Convert random topology to MulVAL topology... Use topology generation template in 'MulVAL_P/topo_gen_template.P'... Saved MulVAL topology template in 'MulVAL_P/topology_template.P'.

AutoPentest-DRL: Load vulnerability information... Open preprocessed server data... Vulnerability information loaded.

AutoPentest-DRL: Populate topology with vulnerabilities... Saved logical topology in 'MulVAL_P/topology_generated.P'.

AutoPentest-DRL: Compute attack path for generated logical network... Generate attack graph using MulVAL... Process attack graph into attack matrix... Traceback (most recent call last): File "./confirm_path.py", line 9, in MAP = generateMapClass.sendMap File "./learn/generateMap.py", line 110, in sendMap self.x = self.createMatrix() File "./learn/generateMap.py", line 24, in createMatrix self.arcsCsvData = self.arcscsv.readlines() io.UnsupportedOperation: not readable Traceback (most recent call last): File "./dqn_learn.py", line 32, in env = gym.make('dqnenv-v0') File "/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py", line 581, in make envcreator = load(spec.entry_point) File "/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py", line 61, in load mod = importlib.import_module(mod_name) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/home/ch1nhpd/AutoPentest-DRL/DQN/learn/env/environment.py", line 12, in class dqnEnvironment(gym.Env): File "/home/ch1nhpd/AutoPentest-DRL/DQN/learn/env/environment.py", line 14, in dqnEnvironment MAP = np.loadtxt('../processdata/newmap.txt') File "/usr/local/lib/python3.7/dist-packages/numpy/lib/npyio.py", line 1067, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/usr/local/lib/python3.7/dist-packages/numpy/lib/_datasource.py", line 193, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/usr/local/lib/python3.7/dist-packages/numpy/lib/_datasource.py", line 533, in open raise IOError("%s not found." % path) OSError: ../processdata/newmap.txt not found.

crond-jaist commented 1 year ago

Hi, I note that you are using the program using a randomly generated topology. Could you confirm first if the program works with the example (fixed) topology provided? As for using random topologies, sometime the generated result may not be compatible in terms of having a valid attack solution, so you may want to try running the program several times, as it will hopefully work in the end. But to be honest I haven't used it much with random topologies, and the developer has left our group, so I cannot help you much. Best wishes, Razvan

crond-jaist commented 1 year ago

I'll close this issue since there was no additional feedback in a couple of months.