(Wikipedia) Most octopuses release a reservoir of dark inky dye, which might serve as a smoke screen and/or be noxious disabling the predator’s chemosensory organs. Other species can release ink mixed with mucus. This drawing shows a "ventral view of the viscera of Chtenopteryx sicula, showing the absence of a visceral photophore and the presence of the accessory nidamental gland."
Fast Answer: What does an octopus do when a predator threatens it?
Delicious Reddit

FEBRUARY 04, 2008
April Holladay, HappyNews Columnist

What does an octopus do when a predator threatens it?
Brittany, Orange, New South Wales, Australia
A: It depends on the octopus. The extremely toxic blue-ringed octopus displays his brilliant blue rings to warn a predator off.
"Many octopus have a pair of 'eye spots' that they can flash", says Roy Caldwell, professor of integrative biology at the University of California, Berkeley. This may startle predators just as the eyespots on a moth do.
Most octopuses release a reservoir of dark inky dye, which might serve as a smoke screen and/or be noxious disabling the predator’s chemosensory organs. Other species can release ink mixed with mucus. This forms a brown or black glob that hangs in the water and looks somewhat like the octopus. Often, as the octopus releases the deceptive glob, it changes color (usually to white) and gets away. The predator attacks the glob and gets nothing more than a mouth full of bad tasting ink.
Octopuses also can change their skin coloration to go unnoticed.
Several octopus species drop their arms off their body when attacked. "The wiggling autotomized arms will even lock onto the predator with its suckers," Caldwell says. "This is usually sufficiently distracting to allow the octopus to escape." Re-growing lost arms is a snap for an octopus.