The abrupt resignation of CIA director David Petreaus has offered a few key lessons. Among them:

1) Even if you're America's top spy chief, it's hard to keep a secret these days.

2) You can't blame hackers for everything that gets out.

FBI agents, not cyber vigilantes, were able to uncover the affair that Petreaus was having with his biographer-turned-lover, Paula Broadwell, simply by tracking the anonymous e-mails she sent to another woman. Broadwell, a former military officer, had sent intimidating e-mails to Jill Kelley in May 2012, reportedly telling her to "back off" from an unnamed man, according to the Wall Street Journal.

It is unusual for the FBI to get sucked into a case of cyber harassment and love triangles, but reports say Kelley had a friend at the agency who she originally complained to. And according to the Journal, the FBI became concerned when they saw that the e-mails Broadwell were sending included private mails from Petraeus to Kelley -- leading them to suspect Broadwell might have hacked Petraeus' account.

Some time in the late summer 2012, agents traced the Gmail metadata of the anonymous e-mails back to hotels that Broadwell had stayed in when they were sent, before establishing they had come from her, and that she'd had an affair with the much-lauded general.

Petraeus and Broadwell, whose book All In: The Education of David Petraeus, eulogized Petreaus extensively, were thought to have been careful to avoid leaving any e-mail trails during their affair, law enforcement officials told the Associated Press.

Yet in these days of constant communication by mobile and desktop, it's almost impossible to leave zero trace of a digital footprint, even if you do send e-mails through an anonymous account.

Earlier this week it was suggested that hackers aligning themselves with Anonymous might have been responsible for discovering the e-mails revealing Petraeus' affair. This is because Broadwell's Yahoo! email address and encrypted password were among thousands that Antisec hackers stole from intelligence giant Stratfor, and published online in December 2011.

In fact, anyone could have decrypted Broadwell's password and tested it with other e-mail portals, to see if she had re-used it. Cyber security researcher Robert David Graham found the published file from the Stratfor hack and used password-cracking tool oclHashtcat to crack the password over the weekend. It took 17 hours before the tool revealed her password was "vsKLVg8L." Graham Googled the password and found nothing -- no hacker forums on which the password was being discussed and bragged about.

The opportunity for Broadwell to be found out had, potentially, been in the public domain for almost a year. "Potentially," because it is not clear if she used the password "vsKLVg8L" with any other email accounts. But if Broadwell had, anyone with a password-cracking tool might have been able to snoop on her e-mails and discover her dalliance with a four-star general.