Fortress

In a dystopian 2017, ex-army officer John Henry Brennick and his wife Karen are attempting to cross the CanadaâUnited States border to Vancouver to have a second child. Strict one-child policies forbid a second pregnancy, even after their firstborn has died, so Karen wears a magnetic vest to trick the security scanners. A guard notices and raises the alarm.
Brennick is caught, believing Karen to have escaped, and sentenced to 31 years at the Fortress, a private maximum security prison run by the Men-Tel Corporation. To maintain discipline all inmates are implanted with "Intestinators" which induce severe pain or death as a form of physical control and mental conditioning. The prison is co-run by Director Poe, who oversees Zed-10, a computer that monitors day-to-day activities. The prison is located underground, in the middle of the desert, inside a deep pit that can only be crossed by a retractable bridge, while the prisoners are kept in overcrowded cells secured by laser walls.
John is imprisoned with inmates Abraham, a model prisoner who works as Poe's manservant and is awaiting parole; D-Day, a machine and demolitions expert; Nino Gomez and Stiggs, who tries to extort John. John learns his wife has been captured and is held in another level with his unborn child who, being illegal, is now officially owned by Men-Tel and will be confiscated at birth.
Stiggs has a friend, Maddox, who intimidates John and the two are involved in a brawl which culminates with Maddox being shot by a security turret. John manages to grab Maddox's Intestinator and gives it to D-Day before he is taken away to be subjected to a mind-wipe procedure as punishment.
Poe, infatuated with Karen, tells her that if she lives with him he will treat John well and release him from the mind-wipe chamber. She accepts to help John. Poe is revealed to be a cyborg, powerfully enhanced by Men-Tel cybernetics. Four months later, a heavily pregnant Karen manages to use her access to the prison computer in Poe's quarters to help John by restoring him from his mind-wiped state. Karen steals a holographic map and gives it to Abraham to give to John. D-Day dismantles Maddox's Intestinator and uses a magnetic component to pull out the others' Intestinators.
During their next work shift John's group puts their Intestinators in an air-duct and stage a brawl, causing Zed to trigger the devices and blow the duct open to prepare their escape. Poe promptly flushes the duct with steam and sends in "Strike Clones", networked cyborgs armed with flamethrowers and machine guns. Stiggs surrenders and gets shot dead, but the rest of the group kill a Strike Clone, steal its weapon and use it to kill the remaining clones.
Zed alerts Poe of Karen's actions. He reveals to her that her child, like all MenTel-owned babies, will be extracted in a fatal Caesarean to be made a cyborg. Abraham and Karen resist, but are powerless against the cyborg Poe and Abraham dies of strangulation.
Hijacking one of the gun turrets and using it as an elevator, John's group travels to Zed's control room. John takes Poe hostage and orders him to release Karen. Poe gives the order, but Zed refuses the command while stating that MenTel does not engage in any negotiations during hostage situations and a gun turret blasts Poe, blowing him to pieces and leaving John's group with no leverage. Once brought over to the core computer, D-Day hacks into Zed and accesses a powerful virus confiscated at the start of his sentence. D-Day manages to activate the virus after being shot and incapacited, causing a complete systems crash and all automated security to fail. John and Gomez rescue Karen, hijack a truck, and escape to Mexico where Karen enters labor in an abandoned barn and gives birth to her and John's child.

Question: Who shots Maddox?
Answer: security turret.