There are six ways Trojans generally capture passwords (numbers are hexadecimal):
1) INTERRUPT 9. This is a hardware interrupt which occurs every time you hit a key. The Trojan waits for an INT 9, then interrogates the keyboard to discover which key was pressed, saves the key, then returns normal control.
2) INTERRUPT 16. This is an operating system call which deals with the keyboard. Every time an application program needs a key, it calls this software interrupt. A Trojan piggybacks onto the INT 16 and saves the keys every time the program asks for them.
3) INTERRUPT 21. Similar to INT 16, much more widely known, but less elegant. Once again, a Trojan will piggyback INT 21.
4) INTERRUPT 15. Similar to INT 16, but called from INT 9. A Trojan will again piggyback to this BIOS function in order to capture passwords.
5) Hardware polling. A quirky and unreliable method, one which NetSafe authors have not encountered in any available Trojan yet, but one which the NetSafe product nonetheless counters. This method simply polls the keyboard many times a second, and records any new keys you press as it notices you pressing them. If you type too fast, it will miss some.
6) RAM-buffer snooping. A Trojan can copy the DOS keyboard type-ahead buffer from the system area (also called segment 40

or from the executable-programs memory regularly to disk.
Once the password is captured, the Trojan will usually either save it in RAM, or on a local or network disk (in a hidden file in a hidden directory), or even in CMOS. A purpose-written Trojan can be programmed to download passwords via modem or onto the internet, or broadcast them to some other place for remote retrieval.