You may or may not need user/admin access to your victim's gun; it depends on what exactly you want to do via hacking.
Yes, the gun is probably slaved to a commlink, but either way you still need to know its Device Rating. Unfortunately there isn't something handy to go off of just yet... but if you have access to 5e I'd recommend re-using that. If you don't have 5e, I'll give you a rule of thumb:
DR1: Super basic stuff like Vending Machines, Traffic Lights, SoyKaf makers
DR2: most things sold for civilian use. Guns, Cars, more expensive electronics other than commlinks (stuff like washing machines, refrigerators, etc)
DR3: stuff sold for police/security use. Police issue cars, guns, drones, etc.
DR4: stuff sold for military use.
DR5+ Super high tech experimental stuff. Plot maguffins, that sort of thing.
(in making this post, I realize that I never noticed before that Device Rating uses DR and Defense Rating uses DR. Sigh.)
Unless/until you see something otherwise, you're probably safe assigning a Device Rating of 2 or 3 to a gun, depending on who it was built for. And if the gun's owner has a crappy commlink, the gun may actually be more secure just rolling Device Rating rather than being "protected" by a PAN.
If you want to just brick the gun:
Step 1: Grab Dice
Data Spike (pg. 181) is an illegal matrix action, so it uses the Cracking skill + Logic. You'll be opposed by Data Processing + Firewall. Of course, a gun has neither stat. Per the 6we hotfix (pg 6) you can substitute the mental attribute of the defending persona (if slaved to a commlink) or the device rating for missing values. A DR 2 gun will therefore roll 4 dice against you; a cop's gun will probably roll 6 dice against you. (note that because this is an illegal action, ALL the hits scored against you raise your Overwatch Score)
Step 2: Distribute Edge
Your Attack Rating is the sum of your Attack and Sleaze attributes. The Defense Rating is the sum of the gun's Data Processing + Firewall. You're comparing against what is probably a Defense Rating of 4 or 6. If you have more than a 4 Point advantage in AR, you get edge. If you for some reason have a sum of Attack and Sleaze being 0 or 1, then the cop gets edge. A civilian gun with a Defense Rating of 4 can't gain edge

Step 3: Roll dice.
If you're built to do hacking, you should end up with some number of net hits.
Step 4: Determine effect
The damage of a data spike is your Attack (not Attack Rating!) divided by 2 rounded up (see pg 181) plus your net hits. The gun resists this matrix damage by rolling Firewall (or Device Rating, in this case). Any unsoaked damage is applied to the gun's matrix condition monitor. Devices have a Matrix Condition Monitor equal to 8+1/2 Device Rating rounded up.