Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fate0/xmark

A PHP7 extension that can hook most functions/classes and parts of opcodes
https://github.com/fate0/xmark

extension hook php7

Last synced: about 1 month ago
JSON representation

A PHP7 extension that can hook most functions/classes and parts of opcodes

Awesome Lists containing this project

README

        

# xmark

[![Build Status](https://travis-ci.org/fate0/xmark.svg?branch=master)](https://travis-ci.org/fate0/xmark)
[![AppVeyor Status](https://ci.appveyor.com/api/projects/status/github/fate0/xmark?branch=master&svg=true)](https://ci.appveyor.com/project/fate0/xmark/)
![GitHub](https://img.shields.io/github/license/fate0/xmark.svg)

[中文文档](https://github.com/fate0/xmark/blob/master/README.zh-CN.md)

## Table of Contents

* [Introduction](#introduction)
* [Installation](#installation)
* [Example](#example)
* [API](#api)
* [OPCODE](#opcode)
* [PHP configuration](#php-configuration)
* [Note](#note)
* [Ref](#ref)

### Introduction

xmark is a PHP7 extension that provides the following features:

* It can mark string variables
* It can hook most functions/classes
* It can Hook parts of the opcodes

### Installation

* linux:

```
phpize
./configure
make
```

* windows

[download](https://github.com/fate0/xmark/releases)

### Example

example:
``` php
hi();
```

when `array_map` is called, `zend_get_executed_scope` will look up the last use function in the call stack and then
determine if the user function has permission to call the callback. so it may cause the the call to `array_map` to fail.
the same problem occurs in other internal functions that accept callback parameter.

in summary, if a function depends on or will change the scope of the caller,
then you should carefully determine whether the function can still be hooked.

### Ref

* [taint](https://github.com/laruence/taint)