To design secure systems. And to automate defenses using computer programs.
Hacking tools can be controlled by programs, and defend internet infrastructure.
Important part is design and realization of Hacking Tools, then using scripts to execute complex Maneuvers in The Internet.
It is both Art & Science to experiment in this way, to learn by trying (and to suffer consequences of mistakes).
Mathematics is also part of this, for it's basic for Cryptography.
During peacetime, more resources (computing power and more) can be allocated to solving Mathematical problems (Computing Time and other resources can be sold for commercial purpose. Solving of common problems can be automated by writing programs, so Mathematicians can work on more ambitious tasks, including adding more requirements to computing system. Then for example economists can pay for quick solution of their problems. It's cheap to use automated tools).