Skip to content

Instantly share code, notes, and snippets.

View bdrewery's full-sized avatar

Bryan Drewery bdrewery

  • Seattle, Washington
View GitHub Profile
@bdrewery
bdrewery / socksfile
Created February 3, 2010 16:50
wraith socksfile
-dcc
type SERVER
addr 1209280125
sock 6
port 6667
nick (server)
host ca.us.irc.xzibition.com
+dcc
-sock
sock 6 0
@bdrewery
bdrewery / gist:402616
Created May 16, 2010 03:22
Subst api mockup
String String::subst(HashTable<String, String> hashes) const {
String newStr(*this);
Array<String> keys(hashes.keys());
Array<String> values(hashes.values());
for (size_t i = 0; i < keys.length(); ++i) {
const String key(keys[i]), value(values[i]);
//::printf("%s -> %s\n", key.c_str(), value.c_str());
newStr = newStr.sub(key, value);
}
return newStr;
/**************************************************************************************************/
/* */
/* Estella Mystagic */
/* */
/**************************************************************************************************/
// albino squirrel v2.1 freebsd 8.x (http://www.mystagic.com/albino_squirrel.png)
// syscall hooks on chmod,fchmod,lchmod,fchmodat to prevent modifing sticky,setgid,setuid on
// files/links or directories while in securelevel one or higher.
//
// sysctl mibs:
@bdrewery
bdrewery / wraith with TCL coming
Created August 16, 2010 02:34
Wraith TCL PoC
TCL is being loaded dynamically - so the binary size won't blow up due to this. Also planning on python, perl, php, ruby, javascript. Hopefully all of those will play along well.
> grep -n Tcl_Eval src/main.c
792: Tcl_Eval(interp, "puts \"[subst -nocommands {[info nameofexecutable] [info tclversion] [info library]}]:\"");
793: Tcl_Eval(interp, "puts \"[info nameofexecutable] [info tclversion] [info library]\"");
> make
...
> ldd wraith
@bdrewery
bdrewery / TCL Unit tests
Created August 23, 2010 02:44
C++ Scripting API example
ScriptInterpTCL tcl_script;
tcl_script.init();
String x("54321");
tcl_script.linkVar("x", x);
// Test Getting var from C++
CPPUNIT_ASSERT_STRING_EQUAL(x, tcl_script.eval("set x"));
x = "test 1 2 3 4 5 ";
@bdrewery
bdrewery / Makefile
Created September 18, 2010 22:48
hello world kmod
KMOD = hello_world
SRCS = hello_world.c
.include <bsd.kmod.mk>
@bdrewery
bdrewery / ident.rb
Created February 23, 2011 18:03
Ident client (RFC 1413)
#! /usr/bin/env ruby
# ./ident.rb HOST PORT
# Get the username of the remote port
require 'socket'
require 'timeout'
hostname = ARGV[0]
port = ARGV[1]
timeout_interval = ARGV[2] || 5
@bdrewery
bdrewery / fidentd.py
Created February 27, 2011 21:00
Hacked this up for cutie578's ident
#! /usr/bin/env python
# Mostly copied from http://docs.python.org/library/socketserver.html
import SocketServer, socket
class MyTCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
self.data = self.rfile.readline().strip()
print "Received from %s: %s" % (self.client_address[0], self.data)
self.request.send(self.data + ":USERID:UNIX:cutie578\r\n")
@bdrewery
bdrewery / usr.bin-w.patch
Created March 8, 2011 18:25
FreeBSD w patch for GeoIP (Country) and restricted per user
Summary:
Makefile | 3 ++-
w.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 46 insertions(+), 5 deletions(-)
----
Files modified:
commit dbbd24c73757c764d38ca8cb4cefcb0b08e40b16
Author: Bryan Drewery <bryan@shatow.net>
@bdrewery
bdrewery / gist:860721
Created March 8, 2011 18:31
GeoIP DB update script
We couldn’t find that file to show.