An early warning system against malicious activities for smart grid communications