Skip to content

Instantly share code, notes, and snippets.

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
from json import dumps
from sys import argv
if len(argv) < 2:
print 'Usage:\n\t%s <your.pcap>' % (argv[0])
exit(0)
# /etc/nginx/sites-available/example.com
server {
listen 80;
server_name www.example.com;
return 301 http://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
<?php
// in response to: http://www.reddit.com/r/PHP/comments/1dknt8/is_there_any_vulnerabilities_in_this_method_ci/
# Option 1 - Use CodeIgniter's built in DB sanitization.
$user_id = $this->db->escape($this->input->post('user_id'));
$query = $this->db->query("SELECT name FROM users WHERE user_id = ?", array($user_id));
# Option 2 - user_id will ALWAYS be an integer, force it. Any strings will return 0, which is safe to pass.
$user_id = (int)$this->input->post('user_id');
$query = $this->db->query("SELECT name FROM users WHERE user_id = ?", array($user_id));
<?php
// in response to: http://www.reddit.com/r/PHPhelp/comments/1d7jsr/retrieving_dynamically_generated_values_from_a/
# NOTE: I wouldn't recommend keeping all of this in 1 file. For simplicity sake though, I will.
if(isset($_POST['ajax']) && $_POST['ajax'] == 'db_data')
{
$test_mode = true;
/* this variable is just included so you can easily swap between a query
* and the provided array. (for easy testing)
<?php
// In response to: http://www.reddit.com/r/PHPhelp/comments/1ddwod/im_a_total_noob_here_is_my_problem_i_am_required/
$val = array(
array("Time", "10AM ", "11AM", "12AM","1PM"),
array("Pigs Kilt","100","200"),
array("Pigs Rubbed","300","400"),
);
echo "<table>".
@haykuro
haykuro / irc_bot.py
Created April 24, 2015 22:56
Written by Steve Birstok
# Actively under development
import random
import re
import socket
import string
import sys
HOST = PORT = NICK = None
@haykuro
haykuro / chase_transactions
Created February 10, 2015 15:25
Get the sum total of X transactions from the Chase.com Online Account History page.
// chase_transactions.js
var transactions_to_get = 2;
var stopNum = 9+(6*(transactions_to_get-1));
$sum = 0;
for($i=9;$i<=stopNum;$i+=6) {
$foo = parseFloat($($("#DDATransactionDetails_DDAPrepaidTrnxDetailsGrid").find('td').get($i)).text().trim().replace('$', ''));
if (!isNaN($foo)) $sum += $foo;
}
alert("$"+$sum);
@haykuro
haykuro / close_appcelerator_tabs.js
Created February 4, 2015 15:40
A JS bookmark that closes all tabs from the Appcelerator.com Docs page
/**
* Add as a bookmark.
* Open all the tabs you want, and click the bookmark to close them!
*/
javascript:if(document.domain==='docs.appcelerator.com'){var closes=document.getElementsByClassName('close');if(closes.length>0)for(i in closes)if(!isNaN(parseInt(i)))closes[i].click();}
if [ "$(curl "reddit.com/api/username_available.json?user=$1" -L -s)" = "true" ]; then
echo "The username $1 is available on reddit.";
else
echo "The username $1 is NOT available on reddit.";
echo "Profile: http://reddit.com/u/$1";
fi
@haykuro
haykuro / get_ultra_slugs.php
Last active August 29, 2015 14:06
Gets all the page slugs from the Ultra Music Festival website
<?php
if (isset($_GET['get_the_data'])) {
exit(file_get_contents(hex2bin('687474703a2f2f7777772e756c7472616d75736963666573746976616c2e636f6d2f64622f312e302f6f626a656374732f66696e643f63726974657269613d7b253232736974655f69642532323a2532323534303235303263656439616163333930333637323137612532327d')));
}
?>
<html>
<head>
<meta charset="UTF-8">
<title>Get Slugs from ULTRA</title>
</head>