It isn't always clear what internal considerations drive NK's attention seeking behaviour, but its long game plan is beyond doubt:  getting the US out of the peninsula and reuniting the Koreas on terms favourable to itself.

By standing up to the Americans and drawing them into a slanging match, the DPRK may be playing a weak hand as well as it can.  But it's a risky game and much depends on how South Koreans respond.  It may well be that in any conflict involving Japan many South Koreans will side with their own kin rather than with the foreigners.