/cyclic-pattern

CLI tools / Python Library for generating cyclic pattern string

Primary LanguagePython

Cyclic Pattern

CLI Tools / Python library to generate and search pattern strings useful for finding offsets in Binary Exploitation.

usage

installation

pip install cyclic-pattern

generate pattern

  • generate pattern
pattern g 10000
# output: aaa0aaa1 ... PPT8PPT9
  • you can also use the string valid as integer literal (like bin, oct, and hex)
pattern g 0b1_00_00
# output: aaa0aaa1aaa2aaa3

search pattern

  • search pattern in string
pattern s PPT8PPT9
# output: 9992
  • search pattern in hex
pattern s 0x3567676734676767
# output: 256
pattern s --big 0x6767673467676735 # big endian
# output: 256

customize

  • generate and search pattern with custom block size
pattern --size 8 g 36
# output: aaaaaaa0aaaaaaa1aaaaaaa2aaaaaaa3aaaa
pattern --size 8 s uuuuuuw9
# output: 9992
  • generate and search pattern with custom alphabet and digits
pattern --alphabet ab --digits 12 g 36
# output: aaa1aaa2bbb1bbb2aab1aab2bba1bba2aba1
pattern --alphabet ab --digits 12 s aba1
# output: 32
  • alphabet and digits can be specified with preset name (lowercase, uppercase, letters, digits, hexdigits, octdigits, punctuation)
pattern --alphabet lowercase --digits octdigits g 1000
# output: aaa0aaa1aaa2aaa3 ... eef6eef7ffg0ffg1
pattern --alphabet lowercase --digits octdigits s ffg1
# output: 996
  • check information of current configuration
pattern --alphabet abc --digits 012345 --size 6 i
# output:
# alphabet: abc
# digits: 012345
# block size: 6
# max length: 8748