First, it is explicitly stated that electronics don't work in areas with a lot of magic around. It helps explain why the wizards don't have the best of both worlds. Most of the gadgets Muggles would use in combat, from radios to nightvision, and even some weapons, would be rendered useless simply by there being so much magic around.
Second, it's implied in the books and outright shown in the movies that magic can manipulate Muggle devices, and Muggles themselves; Tom the bartender at the Leaky Cauldron silences a car alarm with a wave of his wand and some unknown nonverbal spell. If Alohomora can unlock a door that isn't magically sealed, then Locomotor could manipulate the action of a weapon, to jam it, make it backfire, or even stop the bullet in midair and redirect it to the shooter. Protego is a shield against most minor magical and physical attack, probably including bullets. Obliviate is not a slow spell to cast, even verbally. Neither is Stupefy or Sectumsempra. All three can render a Muggle combatant completely unable or unwilling to fight. Disillusionment can render a person invisible to all but the closest observer; Dumbledore can cast such a good one it rivals an invisibility cloak, and yes, wizards have those too. The Unforgivables could turn Muggle gunmen against each other or have them writhing on the ground in unspeakable agony, and yes, even kill them outright. If you think a Special Forces team would have any chance assaulting Hogwarts, you're sorely underestimating the weapons and defenses available to even a lone wizard; no wizard would even bother going toe-to-toe with a Muggle assailant.
Third, remember Muggles think magic is a complete fantasy. That's magic's greatest power against Muggles; we don't believe it. It's not explained in the prelude to Book 6 exactly how the Death Eaters destroy the bridge; in the movie of course it's a spectacle, but even then the Muggles might just have seen puffs of black smoke. Discounting magic as impossible, the Muggles would have instead come up with any other explanation they could, however implausible, because any other explanation would have been more plausible than to say it was "magic".