Skip to content

Instantly share code, notes, and snippets.

@wheresalice
wheresalice / eject.rb
Created April 17, 2010 17:01
This should theoretically eject most cash drawers, but needs testing with actual hardware
@printer = "/dev/lp0"
File.open(@printer, "w") do |f|
f.print("#{27.chr}#{112.chr}#{0.chr}#{50.chr}#{250.chr}") # Citizen or Bixolon or IBM or Ithaca or Nexa or Olivetti or Pos-X or Posiflex or Samsung
f.print("#{7.chr}") # Citizen or IBM or Start or Westrex
f.print("#{27.chr}#{112.chr}#{48.chr}#{55.chr}#{121.chr}") # Bixolon or Epson or Samsung
f.print("#{27.chr}#{112.chr}#{0.chr}#{100.chr}#{250.chr}") # TEC or Toshiba or Unisys
f.print("#{27.chr}#{112.chr}#{0.chr}#{48.chr}#{251.chr}") # Axiohm or Fujitsu
f.print("#{27.chr}#{112.chr}#{0.chr}#{25.chr}#{250.chr}") # Epson or Samsung
f.print("#{27.chr}#{112.chr}#{0.chr}#{64.chr}#{240.chr}") # Epson or Samsung
f.print("#{27.chr}#{112.chr}#{1.chr}#{50.chr}#{250.chr}") # Citizen (Drawer 2)
@wheresalice
wheresalice / gist:369822
Created April 17, 2010 21:49
Mass delete Tumblr posts
# http://lds.li/post/232870067/bulk-deleting-tumblr-posts
require 'rubygems'
require 'open-uri'
require 'mechanize'
require 'pp'
site_dashboard_url = 'http://www.tumblr.com/tumblelog/lstoll'
email = 'lstoll@lstoll.net'
password = 'xxxxxx'
@wheresalice
wheresalice / gist:374546
Created April 21, 2010 23:09
Fixes a bug in hexa-range and adds support for hexa-rand in wfuzz
diff -uNp --unidirectional-new-file /pentest/web/wfuzz/CHANGELOG wfuzz/CHANGELOG
--- /pentest/web/wfuzz/CHANGELOG 1970-01-01 01:00:00.000000000 +0100
+++ wfuzz/CHANGELOG 2010-04-22 00:04:00.000000000 +0100
@@ -0,0 +1,3 @@
+== 22 April 2010 kaerast <kaerast@computergentle.com> ==
+ * Added hexa-rand which fuzzes random hex values within a given range rather than consecutive values
+ * Fixed hexa-range to not send out an extraneous % sign
Binary files /pentest/web/wfuzz/dictio.pyc and wfuzz/dictio.pyc differ
Binary files /pentest/web/wfuzz/encoders.pyc and wfuzz/encoders.pyc differ
diff -uNp --unidirectional-new-file /pentest/web/wfuzz/payloads.py wfuzz/payloads.py
@wheresalice
wheresalice / aegir_modules.rb
Created April 23, 2010 10:06
Shows all modules available across all Aegir platforms. Doesn't test if they're in use or not
require 'find'
modules = []
Find.find('/var/aegir/platforms') { |file| modules << File.basename(file) if File.basename(file) =~ /\.module$/ }
puts modules.sort.uniq
@wheresalice
wheresalice / ed.rb
Created June 4, 2010 12:20
Ruby function to calculate an Eddington number
def eddington(rides)
eds = []
rides.each{ |ride|
if (rides.select{ |i| i==ride}.length) >= ride
eds.push ride
end
}
eds.sort[-1]
end
@wheresalice
wheresalice / gist:446055
Created June 20, 2010 19:52
script for vbackup to support cfbackup so we can copy backup files to rackspace
#!/bin/bash
#
# This file is part of vbackup.
#
# vbackup is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# vbackup is distributed in the hope that it will be useful,
<pre>
<?php
$foo = array();
$foo['country'] = "united Kindom";
$foo['street'] = "";
$foo['state'] = "ENG";
print_r( $foo);
$bar = array();
$bar['country'] = "Danmark";
$bar['street'] = "";
@wheresalice
wheresalice / gist:490373
Created July 26, 2010 10:01
Switch a Drupal site to syslog logging with level user_6
/var/aegir/drush/drush.php disable dblog && /var/aegir/drush/drush.php enable syslog
echo 1 | /var/aegir/drush/drush.php variable set syslog_facility 176
@wheresalice
wheresalice / cf_traversal.rb
Created August 15, 2010 17:31
Metasplot module for CVE 2010-2861 (my first msf module, please comment)
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
require 'socket'
@wheresalice
wheresalice / city_sunshine.rb
Created October 17, 2010 16:16
Takes a ranked list of cities and calculates hours of sunshine per year for each one. It's pretty rough and ready.
# city_sunshine.rb
#
# Copyright 2010 kaerast <kaerast@alice-laptop>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,