The provisions of the Section 11-23-1 shall be applicable to any action brought in a circuit court against a sheriff or other officer for the recovery of personal property taken by him under executions or attachment, or for the proceeds of property so taken and sold by him; and the defendant in any such action shall have the benefit of said provisions against the party in whose favor the execution or attachment issued by making affidavit that the property, for the recovery of which or its proceeds the action is brought, was taken under process, describing it; and in such case the judgment of the court shall be framed to effect justice between the parties according to their rights.