It shall be unlawful for any person to rescue or attempt to rescue any person from the custody of any village officer. No person shall aid, abet or encourage the rescue or escape from prison of any person legally committed thereto or shall supply, or attempt to supply, any such person with any weapon or intoxicating liquors or with any implement or means of escape while in prison or in the legal custody of any village officer.