Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Bruteforcer Development Assistance Library - Python Code Bank


Bruteforcer Development Assistance Library
A class that allows the easy usage of generated strings. The string's incremental nature is ideal for creating bruteforcing algorithms. http://www.stealth-x.com/programming/stringgen.php
                #!/usr/bin/env python
"""
A class that allows the easy usage of generated strings
The string's incremental nature is ideal for creating bruteforcing algorithims
http://www.stealth-x.com/programming/stringgen.php
"""

default = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-=_+[]{}\\|;:\'",.<>/?`~'
letters = default[:52]
symbols = default[62:]
numbers = default[52:62]
lowercase = default[:26]
uppercase = default[26:52]

class generator():
	def __init__(self, chars=default):
		self.value = []
		self.pointer = 0
		self.chars = chars

	def __increment__(self, char):
		return self.chars[self.chars.find(char)+1]

	def next(self):
		"Returns a newly generated word after incremenation of the one in memory"
		if self.value == []:
			self.value = [self.chars[0]]
		elif self.value[self.pointer] == self.chars[-1]:
			if self.value[0] == self.chars[-1]:
				self.pointer +=1
				self.value += self.chars[0]
				count = 0
				for round in range(len(self.value)):
					self.value[count] = self.chars[0]
					count += 1
			else:
				pointer = self.pointer
				while self.value[pointer] == self.chars[-1]:
					self.value[pointer] = self.chars[0]
					pointer -= 1
				self.value[pointer] = self.__increment__(self.value[pointer])
		else:
			self.value[self.pointer] = self.__increment__(self.value[self.pointer])

		string = ''
		for character in self.value:
			string += character
		return string

	def skip(self, times):
		"Skip the internal value ahead x ammount of incremenations"
		for round in range(times):
			null = self.next()
		return

	def reset(self):
		"Reset the memory and return the string to it's initial value"
		self.__init__()

	def make(self, count):
		"Generate a list of strings containing the ammount of values specified by 'count'"
		words = []
		for round in range(count):
			words += [self.next()]
		return words

	def save(self):
		"Return a dictionary with the saved state of the generator for continuation later on"
		return [self.value, self.pointer, self.chars]

	def load(self, data):
		"Load a previously saved state for continuation without having to reset the generator"
		self.value = data[0]
		self.pointer = data[1]
		self.chars = data[2]

            
Comments
Sorry but there are no comments to display