Linux trasparent proxy - Iptable rules

In this tutorial:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8080

How can I find port number in my system to replace those and what are the factors that decides the port numbers used in those iptable rules?

80 and 443 are the standard ports used in the browsers for almost all sites.
8080 is the default mitmproxy port, you can configure it passing -p argument.