Skip to content

Instantly share code, notes, and snippets.

View josuebrunel's full-sized avatar

Josue Kouka josuebrunel

View GitHub Profile
import cgi
def parse_form_data(formdata):
fp = cgi.StringIO(formdata)
env = cgi.os.environ
env['REQUEST_METHOD'] = 'POST'
data = cgi.FieldStorage(fp, environ=env)
return data
import cgi
def parse_form_data(formdata):
fp = cgi.StringIO(formdata)
env = cgi.os.environ
env['REQUEST_METHOD'] = 'POST'
data = cgi.FieldStorage(fp, environ=env)
return data
@josuebrunel
josuebrunel / README
Created December 13, 2017 13:20
SpeweSQLiteORM
Stupid python sqlite ORM
from dateutil.parser import parse as dateutil_parse
from lxml import etree, objectify as xobject
def is_clean(element):
if not element.getchildren() and element.text is None:
return False
return all(is_clean(child) for child in element.iterchildren())
[u'ERROR: TypeError: undefined is not a function (evaluating \'$( "#datepicker" ).datepicker({\r\n\t\tshowOn: "button",\r\n\t\tbuttonImage: "images/calendrier.png",\r\n\t\tbuttonImageOnly: true\r\n\t})\')', u'TRACE:', u' -> https://portail-famille-meyzieu.test.entrouvert.org/meyzieu/js/plugins/teamnet/teamnet.js: 11', u' -> https://portail-famille-meyzieu.test.entrouvert.org/meyzieu/js/jquery/jquery.min.js: 29 (in function "i")', u' -> https://portail-famille-meyzieu.test.entrouvert.org/meyzieu/js/jquery/jquery.min.js: 29 (in function "fireWith")', u' -> https://portail-famille-meyzieu.test.entrouvert.org/meyzieu/js/jquery/jquery.min.js: 29 (in function "ready")', u' -> https://portail-famille-meyzieu.test.entrouvert.org/meyzieu/js/jquery/jquery.min.js: 29 (in function "K")']
def cp_file(infile, outfile):
with open(outfile, 'wb') as fo:
fd = open(infile, 'rb')
for line in fd.readlines():
fo.write('%s' % line)

Logged Requests

logged_requests is a simple wrapper around the requests.Session object. It captures input and output data of a requests.Session object.

Installation

{
"url": "http://idp.debian.local/login/",
"page": "http://idp.debian.local/manage/users/",
"username_id": "#id_username",
"username_value": "root",
"password_id": "#id_password",
"password_value": "root"
}
ExtFilterDefine fixtext mode=output intype=text/html \
cmd="/bin/sed -e '\$a<script type=\"text/javascript\" src=\"/_mandaye/static/mandaye.js\"></script>'"
{"cookies": [], "address": "https://google.com"}