Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 27 Aug 2019, 00:36
vbSuperfan vbSuperfan is offline
 
Join Date: Jun 2019
Easiest way to patch your own hooks into the vBulletin codebase?

vBulletin tells me that it's completely impossible to modify the contents of posts displayed in the Mobile Suite mobile apps, either by hooks or class extension plugins for the vB5 back-end (which serves the contents to the mobile apps through the API requests that these apps make to it).

Based on this information, my only remaining alternative is to patch the vBulletin code myself, and the cleanest way I can think of is to insert my own hook point(s) into the vBulletin source code and then reference these from an extension/product, thus causing minimal patches of the vBulletin code itself, which can be repeated for future released versions of vBulletin as easily as possible.

My question is therefore:

What is the easiest way to patch your own hooks into the vBulletin codebase? Is there only some single line of code I can insert at the location in the code that I want to hook?

Is there perhaps even some examples available somewhere that I could take a look at in regards to this topic, that anyone knows of?
Reply With Quote
  #2  
Old 27 Aug 2019, 01:28
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
The vBulletin 5 documentation is pretty poor so you'll probably have to figure most things out yourself. In the code the only reference to invoking a hook seems to be function invoke($hook_name, $params) which can be called using (an example taken from the new login hook):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The available hooks and classes seems to be imported from the installed products which you can see at /core/vb/vb.php function getHooks. The invoke function can be found at /core/vb/utility/hook/live.php function invoke.

By default vBulletin 5 comes with a couple of packages/products that interact with these hooks so you can see what kind of code you can put inside of hooks and how the params are passed to the hooked function. One example can be found at /core/packages/googlelogin/hooks.php and the other files in that folder.

Hopefully that will help you out for now.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #3  
Old 27 Aug 2019, 22:45
vbSuperfan vbSuperfan is offline
 
Join Date: Jun 2019
Hello Dave, thanks a million for this information, a very useful starting point for looking into this deeper, which I will absolutely do!

Do you (or anyone else here) know which PHP script in vBulletin that the Mobile Suite mobile apps use for their API calls? That would be a very good starting point for me to begin tracing/reversing code in order to know where to best place my new custom hooks...

--------------- Added 27 Aug 2019 at 23:20 ---------------

Ok, a few moments of web server access log tracing and PHP code reversing later, it would seem that a good target for a custom hook would be the print_apioutput($data) function of the file /core/api.php.

I'll start gently and try to use the hook methodology listed above to insert a hook in it. If it won't work, I'll just patch the hell out of it locally for now, since I've got no time to lose in this matter.

I'll let you know how it goes!

PS.
I assume that it won't be possible to use the new fancy-schmancy subclassing extension system of vB5 to get direct access to this function directly from a "product" without any code PHP file patching having to be done at all? Seeing that:

1) This function (print_apioutput()) isn't even inside any object oriented code to begin with.

and

2) What are the odds of that working as advertised to begin with either way, right...?


Or would that actually be able to work somehow? Anyone knows, yes or no?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:15.

Layout Options | Width: Wide Color: