Simply, a weapon that can hit the pirates at a range farther than the maximum range of their weapons.
Using that criteria, a few strategically placed deck-mounted machine guns would be more than adequate. You’re on a stable firing platform, and you have the advantage of range. Furthermore, just one solid string of bullets would be decisive against many of the small craft today’s pirates use.
Finding weapons isn’t the problem, machine guns that would be suitable to this task are 50+ years old.
The problem is really, they’re worthless unless you know pirates are coming.
During the Age of Sail, merchant ships got taken by pirates because merchant ships couldn’t afford all the security measures necessary to deter pirates.
That tends to be true today, as well.
A traditional naval vessel in the Age of Sail was almost never taken by pirates because they had watches every hour of every day, and they were completely filled with armed men better trained and usually better equipped than the pirates.
To defeat pirates as a merchant vessel, your first line of defense is enough security personnel to keep a comprehensive watch. Freighters are big and low on staff. Many pirates get on board before the crew know it has happened because of this fact.
Even just adding five security guys to a large freighter would be a large % increase in labor cost for the vessel–and five may not even be enough to provide a comprehensive watch. They would also need to be people at least competently trained in using the deck guns. They would also probably need to be trained in using closer-range assault rifles or whatever small arms the ship decided to pack.
BUT, assuming you had a reasonable chance of spotting the pirates before they got close, then simple deck mounted machine guns could defeat almost any pirate, simply because you have a stable firing platform and several miles in which you can shoot them but they can’t shoot you.
