Skip to content

Instantly share code, notes, and snippets.

@jef79m
Created September 6, 2016 23:02
Show Gist options
  • Save jef79m/72e49cc36e6f7271bf415015fa1b800c to your computer and use it in GitHub Desktop.
Save jef79m/72e49cc36e6f7271bf415015fa1b800c to your computer and use it in GitHub Desktop.
Function to create pattern_create.rb and pattern_offset.rb compatible patterns within your fuzzers etc.
"""
pattern_create.py
generates unique strings similar to metasploits
pattern_create.rb for ease of use in fuzzers etc.
example:
In [1]: import pattern_create
In [2]: payload = pattern_create.make_pattern(length=50)
In [3]: print(payload)
Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9
"""
def make_pattern(seta="ABCDEFGHIJKLMNOPQRSTUVWXYZ",
setb="abcdefghijklmnopqrstuvwxyz",
setc="0123456789",
length=600):
return ''.join([u+l+d for u in seta for l in setb for d in setc])[:length]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment