guest network black list script

I need to build a script to watch users on the guest network and if they are on for such a extended time (ex 54 hrs) or during certain hours (ex 3 am to 7am) that it will write them to a black list and block them on the caps man via that list.

Emro Batmok Ot Meok

Vary nice lol.
I’m not looking for someone be to build me be a script just some direction of things I need to research and things I might not have considered.