Skip to content

Instantly share code, notes, and snippets.

View MKorostoff's full-sized avatar

Matt Korostoff MKorostoff

View GitHub Profile
<?php
namespace Drupal\todo\Plugin\rest\resource;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Psr\Log\LoggerInterface;
@MKorostoff
MKorostoff / deobfuscation.php
Created July 26, 2016 03:01
My attempt to de-obfuscate a PHP exploit file discovered on a hacked server.
<?php
/**
* First, we're going to establish an alphabet. We're never going to write code like:
*
* $foo = 'abc'
*
* Because it would be too easy to read. Instead, were' going to write code like:
*
* $alphabet = 'abcdefghijklmnopqrstuvwxyz';
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://YOUR_URL_HERE.COM");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
UID PID PPID C STIME TTY STAT TIME CMD
root 2 0 0 10:34 ? S 0:00 [kthreadd]
root 3 2 0 10:34 ? S 0:00 \_ [ksoftirqd/0]
root 4 2 0 10:34 ? S 0:00 \_ [kworker/0:0]
root 5 2 0 10:34 ? S< 0:00 \_ [kworker/0:0H]
root 6 2 0 10:34 ? S 0:00 \_ [kworker/u30:0]
root 7 2 0 10:34 ? S 0:00 \_ [rcu_sched]
root 8 2 0 10:34 ? S 0:00 \_ [rcuos/0]
root 9 2 0 10:34 ? R 0:00 \_ [rcuos/1]
root 10 2 0 10:34 ? S 0:00 \_ [rcuos/2]
//Hide all schedule items by default
div.schedule-item {
display: none;
}
//After javascript has had a chance to act, reveal the schedule items
body.timezone-est div.schedule-item {
display: block;
}

#Main Menu main Every page here is a static menu callback, not a node. This menu cannot be changed by admin

  • Schedule /node
  • Watch /node
  • Medals Race /node
  • Results /node
  • Rio Feed /node
  • Team USA /node
  • Athletes /node
<?php
use Behat\Behat\Context\SnippetAcceptingContext;
use Drupal\DrupalExtension\Context\RawDrupalContext;
class LoadTimeContext extends RawDrupalContext implements SnippetAcceptingContext {
/**
* @Then /^time to first byte should be less than "([^"]*)" seconds$/
*/
public function timeToFirstByteShouldBeLessThanSeconds($max_seconds)
{
$session = $this->getSession();
<?php
/**
* @Given /^I send a request to google page speed for "([^"]*)" with "([^"]*)" strategy$/
*/
public function iSendARequestToGooglePageSpeedForWithStrategy($path, $strategy) {
if ($path === 'the homepage') {
$url = $this->getMinkParameter('base_url');
}
<?php
function azure_demo_menu() {
$items = array();
$items['azure-demo'] = array(
'title' => 'Azure Demo',
'description' => 'Azure demo.',
'page callback' => 'drupal_get_form',
'page arguments' => array('azure_demo_form'),
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
xdebug.remote_host=localhost
;xdebug.profiler_enable_trigger=1
;xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128