You're not suffering from a porn and masturbation addiction.
You're suffering from procrastination.
And from a lack of asking yourself "What else?" and acting on the result of that question. What else can I do right now? If it's something better, do that.
When you've got your hand on your penis ask yourself what else could you be doing right now. If the answer is doing some homework or revision, do that.
When you're doing homework ask yourself what else you could be doing. If it's starting or running an ethical business, do that. Or if it's getting skills that will help you earn loads of money, do that.
If you're hungry and you're watching porn, or studying, or working, or doing a training course go get something to eat.
If you're buying and eating junk food, what else could you buy and eat? Go and buy that instead.
What else?
What else?
What else?...