Remove scanner logic from ajax file and place it in it's own class

This makes it easy to create new interfaces for the scanner such as a backgroundjob or cli script

cc @MTGap @karlitschek @DeepDiver1975 @bartv2