Skip to content

Instantly share code, notes, and snippets.

View Methimpact's full-sized avatar

methimpact Methimpact

View GitHub Profile
@mumrah
mumrah / websocketserver.py
Created August 7, 2010 17:01
Simple WebSockets in Python
import time
import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
from threading import Thread
import signal
@e000
e000 / donotuse.py
Created June 13, 2011 23:30
How to NEVER use lambdas.
##########################################################
# How to NEVER use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda constru-#
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] #
# by: e000 (13/6/11) #
##########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much anonymous "one line" functions
@mumrah
mumrah / aggregate.awk
Created September 28, 2011 15:51
Use associative arrays to aggregate data with Awk
BEGIN {
FS=",";
OFS=",";
}
{
COUNTS[$1] += 1;
TOTALS[$1] += $2;
}
@mumrah
mumrah / http.awk
Created September 30, 2011 20:33
Incomplete HTTP server in Awk
BEGIN {
RS = ORS = "\r\n"
HttpService = "/inet/tcp/8000/0/0"
while(1) {
_NR = 0
while((HttpService |& getline) > 0) {
_NR += 1
handle_header($0)
}
close(HttpService)
@bussiere
bussiere / feneter.py
Created March 13, 2012 22:19
generate feneter in hacker style rulez
# todo :
# Pouvoir doubler les bords ou le haut ex : **
# Parser le html pour prendre que le affiché ex <a href="">titi</a> ne prendre que titi.
# ou encore recupérer la taille d'un formulaire.
# prevoir un systeme de ligne ou colonne aussi.
# Bussiere
string = ["totosdjfsdfsdfdsfsdfsdfsdfsdfsdft","titigsgsgsgsgsgsgs","tata"]
texte = """Qui n’a jamais eu besoin d’un coup de main, et aucune idée d’où trouver de l’aide ?
@revolunet
revolunet / xor.py
Created April 18, 2012 09:14
Simple python XOR encrypt/decrypt
#
# NB : this is not secure
# from http://code.activestate.com/recipes/266586-simple-xor-keyword-encryption/
# added base64 encoding for simple querystring :)
#
def xor_crypt_string(data, key='awesomepassword', encode=False, decode=False):
from itertools import izip, cycle
import base64
if decode:
@rich20bb
rich20bb / PythonSimpleWebsocket
Created December 2, 2012 20:10
Simple websocket server in Python. Echos back whatever is received. Works with Chome, Firefox 16, IE 10.
import time
import struct
import socket
import hashlib
import base64
import sys
from select import select
import re
import logging
from threading import Thread
@gregorynicholas
gregorynicholas / .bash_profile
Created January 8, 2013 23:44
autocomplete functionality for python library command line interfaces (CLI): Fabric & Paver.
#!/usr/bin/env bash
. paver_autocomplete
. fabric_autocomplete
@securitytube
securitytube / ssid-sniffer-scapy-python.py
Created April 2, 2013 12:49
WLAN SSID Sniffer in Python using Scapy
#!/usr/bin/env python
from scapy.all import *
ap_list = []
def PacketHandler(pkt) :
if pkt.haslayer(Dot11) :
if pkt.type == 0 and pkt.subtype == 8 :