Nov 24

I've seen several different approaches to dictionary generators over time, and this was one method that struck me that it didn't seem like anyone else had used. If someone else has used this method, I apologize, you deserve full credit, but I came up with this particular version completely independently. I first wrote it in JavaScript (if you want that version, feel free to leave me a comment, but it was slow as fuck), then I ported it to Python for better speed. I even wrote comments for once, so that you can understand what I did (it's not very hard to understand, I just need to get into the habit). Enjoy it :)

def generate(size):
	f = file(raw_input("Output file: "), "w") # Set the output file
	y = [] # Create an empty list
	z = True # Set the toggle boolean to "True" (use the x list)
	charset = "0123456789abcdefghijklmnopqrstuvwxyz" # Charset for generating dictionary
	charlen = len(charset) # Length of charset
	x = list(charset) # Make a list with all the characters in the charset string
	for i in xrange(charlen): f.write(x[i] + "\\n") # Write the character set to the output file
	for i in xrange(1,size+1): # Loop until you have generated to the length specified
		if z == False: # If the toggle boolean is "False", append to y
			xlen = len(x) # Length of list x
			for i in xrange(0,charlen): # Loop through all the characters in charset
				for c in xrange(0,xlen): # Loop through all the items in x and prefix them with the appropriate character
					y.append(charset[i] + x[c]) # Append results to y
					f.write(charset[i] + x[c] + "\\n") # Write the results to file
			x = [] # Clear out list x

		else: # If the toggle boolean is "True", append to x
			ylen = len(y) # Length of list y
			for i in xrange(0,charlen): # Loop through all the characters in charset
				for c in xrange(0,ylen): # Loop through all the items in y and prefix them with the appropriate character
					x.append(charset[i] + y[c]) # Append results to x
					f.write(charset[i] + y[c] + "\\n") # Write the results to file
			y = [] # Clear out list y
		z = z == False # Flip the toggle boolean
	f.close() # Close the output file
generate(4) # Call with largest character length you want to generate
Nov 12

Here was my problem: I needed to reverse a boolean value throughout a loop. True, False, True, False, etc. In most languages, let's say PHP, that looks like this:

$var = !$var;

Python doesn't like the ! when used in this context. However, I got to thinking, and this is what I came up with.

var = var == False

or

var = var != True

Hope this is useful to someone.

Sep 13

This is something quick I whipped up in Python to search Google for username:password pairs for whatever pattern you specify and spit them into a textfile. If you can't figure out what this is useful for, it's not for you.

Wordlist leecher

Aug 15

PHP Version:

function toascii($s){
	$tmp = "";
	for($i=0;$i<strlen($s);$i++){
		$tmp .= "&#" .hexdec(bin2hex($s[$i])) . ";";
	}
	return htmlentities($tmp);
}

Python Version:

import urllib
def encodeDork(s):
	tmp = ""
	for i in xrange(0,len(s)): tmp += "&#" + str(int(binascii.b2a_hex(s[i]), 16)) + ";"
	return urllib.quote(tmp)

Something quick I did.. Very useful for blocked Google queries ;)