While hacks have raised safety alarms, researchers said their experiment could protect against drug-resistant bacteria and save lives.