3

PHP代码审计环境搭建

 2 years ago
source link: https://zh1x1an.github.io/2019/11/17/PHP%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP代码审计环境搭建

创建时间:2019-11-17 23:46
字数:393 阅读:20 评论:0

mac mamp + xdebug

install required libraries

brew install openldap libiconv

apache2

sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

brew install httpd
sudo brew services start httpd

Multiple Versions PHP

brew tap exolnet/homebrew-deprecated
brew install [email protected]
brew install [email protected]
brew install [email protected]
brew install [email protected]
brew install [email protected]

PHP Switcher Script (sphp)

curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw > /usr/local/bin/sphp
chmod +x /usr/local/bin/sphp

example:

Switching to [email protected]
Switching your shell
Unlinking /usr/local/Cellar/[email protected]/5.6.40... 319 symlinks removed
Unlinking /usr/local/Cellar/[email protected]/7.0.33... 0 symlinks removed
Unlinking /usr/local/Cellar/[email protected]/7.1.32_1... 0 symlinks removed
Unlinking /usr/local/Cellar/[email protected]/7.2.23... 0 symlinks removed
Unlinking /usr/local/Cellar/php/7.3.10... 208 symlinks removed
Linking /usr/local/Cellar/[email protected]/7.1.32_1... 25 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
You will need sudo power from now on
Switching your apache conf
Restarting apache

PHP 7.1.32 (cli) (built: Oct  6 2019 20:44:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.32, Copyright (c) 1999-2018, by Zend Technologies

All done!

切换为 php 5.6 :

xdebug

pecl install xdebug

随后在 vscode 或者 phpstorm 中配置 xdebug 即可。

vscode 安装 xdebug :

比较简单,直接安装 vscode 插件 phpdebug 即可,也不需要特别多的配置。

phpstorm 安装 xdebug :

相对复杂一点:

然后就可以开始尽情的代码审计了。
没有断点,不用动态调试的代码审计,等于白给。


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论

0


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK