AI and Cyber security: Mitigating Threats and Enhancing Defenses