Spectral analysis of wave localization and diffusion in random media