A method for extending automated penetration testing of a target network comprising, the steps of: a. computing, by an automated system, a scenario, wherein the step of computing the scenario comprises the steps of: i. translating a workspace having at least one target computer in the target network to a planning definition language; ii. translating penetration modules available in a penetration testing framework to a planning definition language; and iii. defining a goal in the target network and translating the goal into a planning definition language; b. building, by the automated system, a knowledge base with information regarding the target network, properties of hosts in the network, parameters and running history of modules in the penetration testing framework; and c. running, by the automated system, an attack plan solver module, wherein the attack plan solver module performs the steps of: i. running an attack planner using a new scenario as input, wherein the new scenario is an optimized scenario produced based on the scenario and the information in the knowledge base, to produce at least one attack plan that achieves the goal; and ii. executing actions defined in the at least one attack plan against the target network from the penetration testing framework. a. computing, by an automated system, a scenario, wherein the step of computing the scenario comprises the steps of: i. translating a workspace having at least one target computer in the target network to a planning definition language; ii. translating penetration modules available in a penetration testing framework to a planning definition language; and iii. defining a goal in the target network and translating the goal into a planning definition language; i. translating a workspace having at least one target computer in the target network to a planning definition language; ii. translating penetration modules available in a penetration testing framework to a planning definition language; and iii. defining a goal in the target network and translating the goal into a planning definition language; b. building, by the automated system, a knowledge base with information regarding the target network, properties of hosts in the network, parameters and running history of modules in the penetration testing framework; and c. running, by the automated system, an attack plan solver module, wherein the attack plan solver module performs the steps of: i. running an attack planner using a new scenario as input, wherein the new scenario is an optimized scenario produced based on the scenario and the information in the knowledge base, to produce at least one attack plan that achieves the goal; and ii. executing actions defined in the at least one attack plan against the target network from the penetration testing framework. i. running an attack planner using a new scenario as input, wherein the new scenario is an optimized scenario produced based on the scenario and the information in the knowledge base, to produce at least one attack plan that achieves the goal; and ii. executing actions defined in the at least one attack plan against the target network from the penetration testing framework. <EOS>