What are the steps involved in hacking a server or network?

This is more of an ethical hacking question; the steps involved in hacking a server or network are:

  1. Reconnaissance: In this phase, all the evidence and information on the target are gathered.
  2. Scanning: Here, you take the gathered information and apply various tools and techniques to collect more in-depth information on the targets.
  3. Gain access: In this phase, accurate attacks are leveled against the targets enumerated in the second phase.
  4. Maintain access: Here, hackers ensure that they have a way back into the compromised system.
  5. Cover tracks: Finally, attackers try to conceal their success and avoid detection by security professionals.