beefproject / beef

The Browser Exploitation Framework Project
https://beefproject.com
9.84k stars 2.18k forks source link

Augment AssetHandler.instance.bind to allow asset caching #1245

Open bcoles opened 8 years ago

bcoles commented 8 years ago

Currently BeEF::Core::NetworkStack::Handlers::AssetHandler has no caching capabilities.

From a brief look over the code base it appears as though every instance of this function is used to mount a static resource. (The IPEC junk calculator may be an exception).

In the short term, setting a default expiry time of one hour (for example) would be a simple change. Developers could opt out of caching using a new Boolean false argument to BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind if needed.

An even quicker and lazier option would be to duplicate the bind method solely for the purposes of implementing a new method like bind_cachable.

Eventually, calls to BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind should be able to specify HTTP headers to return (ie, Expires) or set an expiration date in a parameter.

@antisnatchor thoughts?

antisnatchor commented 8 years ago

Good points @bcoles , I shall have a look at it and fix it soon (max during this weekend) ;-)

bcoles commented 8 years ago

Added BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind_cached as a temporary workaround in 4e741a067b141dc833d4a513af5335113ea82e85

DeezyE commented 2 years ago

@bcoles your workaround seems like a valid solution and has functioned well for 5 years. Any issue with me closing this?

bcoles commented 2 years ago

@bcoles your workaround seems like a valid solution and has functioned well for 5 years. Any issue with me closing this?

The temporary workaround is a lazy hack.

DeezyE commented 2 years ago

You're too harsh :)