Defence contractors, energy companies and investment banks saw profits soar as war and uncertainty upended markets.