Crookshanks had befriended Sirius' black dog form and had accompanied him to the Shrieking Shack which is when Sirius had to touch a specific knot on the bottom of the willow to make it stop writhing. Crookshanks had recognized this knot and used it when Hermione and Harry were attacked by the Whomping Willow.