How Hackers Exploit IoT Devices and How to Defend Against Attacks