Skip to content

Instantly share code, notes, and snippets.

@hmkz
Forked from wokamoto/git-payload.php
Created April 18, 2014 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmkz/11031649 to your computer and use it in GitHub Desktop.
Save hmkz/11031649 to your computer and use it in GitHub Desktop.
<?php
define('UPDATE_WEBSITE_SH', '/path/to/update-website.sh');
if (!(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/GitHub Hookshot/i', $_SERVER['HTTP_USER_AGENT']))) {
die();
}
if (!file_exists(UPDATE_WEBSITE_SH)) {
die();
}
if ( !isset($_POST['payload']) ) {
die();
}
$payload = json_decode($_POST['payload']);
$dirname = dirname(__FILE__);
$output = exec( '/bin/sh ' . UPDATE_WEBSITE_SH . ' ' . $dirname );
echo $output . "\n";
@xeoncross
Copy link

I would really check the IP address before trusting something like this. It's a DOS dream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment