HOW TO set a javaSCRIPT on MODEM?

Hello I wanted to set a java script on my modem and i thought that i can make a proxy server and then connect my modem to my proxy server. I mean i want to set a js miner to my miner to mine crypto from my users (like coffe miners)(i been tried MITMf on kali linux but it always needs an online system .
best option that i have is connecting modem to a proxy server.
Is that possible ? Has anyone tried it yet?