Script handlers are not stored inside the object, but you can use frame:GetScript("OnShow") to get the function. There's also the function frame:HookScript(script, func) which does exactly the same as hooksecurefunc only for scripts.
If you want to overwrite the old script-function instead of just hooking in it after, you can use SetScript of course
I wrote a simple function for some of my addons which use HookScript or SetScript based on whether the frame already has a script, maybe you'll find it useful
Code:
local function hookScript(self, script, func)
if(self:GetScript(script)) then
self:HookScript(script, func)
else
self:SetScript(script, func)
end
end