“By hook or by crook” means to accomplish something by any means, fair or foul.
Today a crook is a thief who uses deception, and to hook something means to steal it.
That particular definition comes from the thirteenth century, when hooks used for shepherding were also used by peasants to bend branches when stealing firewood or fruit from the royal forest.
And since their deceit was called “crooked” after the shape of their hooks, these thieves became known as crooks.