Skip to content

Instantly share code, notes, and snippets.

View mishudark's full-sized avatar
:octocat:
Rocking

mishudark mishudark

:octocat:
Rocking
View GitHub Profile
@mishudark
mishudark / compile.sh
Last active July 4, 2021 23:35
compile static git
make configure
./configure --prefix=/var/www/ CFLAGS="${CFLAGS} `pkg-config –static –libs libcurl`"
@mishudark
mishudark / get_templates.js
Created July 6, 2012 05:03
get mustache templates
var mustaches = {};
$(function(){
//store templates
var url, templates, m_name;
//get all template/mustache after 100 ms
setTimeout(function(){
templates = $('link[rel="template/mustache"]');
for(var i=0; i< templates.length; i++){
url = $(templates[i]).attr('href');
@mishudark
mishudark / csrf_onetime.patch
Created June 25, 2012 23:02
DRUPAL - csrf - one time usage
diff --git a/drupal/includes/common.inc b/drupal/includes/common.inc
index 8d15d1f..2d73f58 100644
--- a/drupal/includes/common.inc
+++ b/drupal/includes/common.inc
@@ -2605,8 +2605,21 @@ function drupal_get_private_key() {
* An additional value to base the token on.
*/
function drupal_get_token($value = '') {
+ global $user;
$private_key = drupal_get_private_key();
@mishudark
mishudark / file.inc.patch
Created June 25, 2012 18:14
DRUPAL - Upload - security by headers
diff --git a/drupal/includes/file.inc b/drupal/includes/file.inc
index 4bb670b..127374e 100644
--- a/drupal/includes/file.inc
+++ b/drupal/includes/file.inc
@@ -719,13 +719,383 @@ function file_validate_extensions($file, $extensions) {
$errors = array();
+ $regex = '/\.('. @ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
// Bypass validation for uid = 1.
@mishudark
mishudark / password_change.patch
Created June 25, 2012 14:17
Drupal password change no cookie
--- a/password_change.module
+++ b/password_change.module
@@ -10,6 +10,7 @@
* reset password session or not.
*/
function password_change_is_reset($is_reset = NULL) {
+ return false;
if (!isset($is_reset)) {
//return !empty($_SESSION['password_change_reset']);
return !empty($_COOKIE['password_change_reset']);
@mishudark
mishudark / 403_to_404.patch
Created June 25, 2012 04:39
Nginx Patch 403 to 404
--- ngx_http_core_module.c 2012-06-24 23:37:00.000000000 +0000
+++ ngx_http_core_module.c 2012-06-24 23:37:18.000000000 +0000
@@ -1394,7 +1394,7 @@
"directory index of \"%s\" is forbidden", path.data);
}
- ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN);
+ ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
return NGX_OK;
}
@mishudark
mishudark / json_toString.js
Created June 17, 2012 04:39
Convert Json to String
function json_toString(items,prefix){
prefix = prefix || 'data';
var plain = '';
for(var i in items) {
typeof items[i];
if(typeof items[i] === 'object'){
plain += json_toString(items[i], i);
}else if(items.hasOwnProperty(i)) {
plain += '&' + prefix;
plain += '['+i+']';
@mishudark
mishudark / deck.md
Created June 9, 2012 22:28 — forked from pthrasher/deck.md
GistDeck for Charlotte Python Meetup

Who am I?

Philip Thrasher

Web hacker at a private cyber security company.

What I Do

@mishudark
mishudark / reshisft.sh
Created May 27, 2012 22:15
redshift pachuca
redshift -l 19.4327:-99.1333 &
@mishudark
mishudark / high_autocomplete.js
Created May 22, 2012 05:31
Highlight jquery ui autocomplete
$(function(){
$( "#mytextinput" ).autocomplete({
source: function( request, response ){
$.ajax({
url: "/includes/autoComplete.php",
dataType: "json",
data: {
term : request.term,
country_id : $("#country_id").val(),