Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Having anal sex with men was the hideous practice of the people of the Prophet Lot (Alaihi al-Salaam). As for pressing thighs together to get enjoyment and to ejaculate sperm is called masturbation which is forbidden according to the majority of Muslim scholars.
Allah knows best.