Skip to content

Commit

Permalink
总结了下hook思想
Browse files Browse the repository at this point in the history
  • Loading branch information
Estom committed Jan 7, 2024
1 parent d89c5de commit 96a49a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 设计模式/1.8 整体局部思想.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@
* 如果框架没有预留钩子可以使用破坏性的方式实现一些细节的定义。如java的反射和字节码注入等。

Hook 原意是指钩子,它表示的就是在某个函数的上下文做自定义的处理来实现我们想要的黑科技。

![1704639766373](image/1.8整体局部思想/1704639766373.png)

![1704639706282](image/1.8整体局部思想/1704639706282.png)

Hooks就像一些外来的钩子,在源代码之间钩取(窃听)一些信息,当它捕捉到自己感兴趣的事发生,就拦截下来,让自己的代码执行一下,处理一下这个信息,然后再放出去继续之前的进程。这样就可以在不用改变源代码的情况下,做一些别的事情,比方说监控、分析和一些恶意的事。

> 参考文献:https://www.cnblogs.com/ArsenalfanInECNU/p/12871887.html
>
> https://zh.wikipedia.org/wiki/%E9%92%A9%E5%AD%90%E7%BC%96%E7%A8%8B
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 96a49a3

Please sign in to comment.