Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Last active December 11, 2015 18:49
Show Gist options
  • Save KINGSABRI/4644444 to your computer and use it in GitHub Desktop.
Save KINGSABRI/4644444 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Pattern
def initialize
@pattern = []
@offset = String
end
def create(length)
if length != 0 or nil
@pattern = ('Aa0A'..'Zz9Z').to_a.join.each_char.first(length.to_i).join # default permutations 702940
else
puts "\n[+] Error: Pattern create accepts INTEGER values only!\n\n"
length = 0
end
return @pattern.join
end
def offset(string , length = 10000)
@pattern = ('Aa0A'..'Zz9Z').to_a.first(length.to_i).join
@offset = @pattern.index(string.to_s)
if @offset.nil?
puts "\n[+] Error: Your pattern is bigger than 10000, plz mention it!\npatter offset #{string} Pattern_Size\n"
# exit 1
end
return @offset
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment