There are six main types of hackers: black hat, white hat, grey hat, green hat, red hat, and blue hat. Black hat hackers illegally crack systems with malicious intent, while white hat hackers identify and fix vulnerabilities with permission. Grey hat hackers may not have criminal intent but hack without consent. Red hat hackers defend networks and hunt attackers, while blue hat hackers perform security testing for companies. The main purposes of hacking are to steal information, damage systems, hamper access, extort money, or break compliance policies.