The Impact of Artificial Intelligence on Security: a Dual Perspective