The software first brute forces an icloud username / password, then tricks icloud into thinking your device is the target device and finally performs a full restore to your device.
This software is supposed to be for law enforcement, but can be bought and downloaded by anyone. There are also illegal copies to be found.

The Police Tool That Pervs Use to Steal Nude Pics From Apple’s iCloud | Threat Level | WIRED.