Skip to content

Instantly share code, notes, and snippets.

@Marsman1996
Forked from moyix/make_testcases.sh
Last active August 9, 2019 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marsman1996/fccba79d40fbff2eb8b93460be8c19a2 to your computer and use it in GitHub Desktop.
Save Marsman1996/fccba79d40fbff2eb8b93460be8c19a2 to your computer and use it in GitHub Desktop.
#!/bin/bash
objdump -d "${1}" | grep -Eo '\$0x[0-9a-f]+' | cut -c 2- | sort -u | while read const; do echo $const | python -c 'import sys, struct; sys.stdout.write("".join(struct.pack("<I" if len(l) <= 11 else "<Q", int(l,0)) for l in sys.stdin.readlines()))' > testcases/$const; done
i=0; strings "${1}"| while read line; do echo -n "$line" > testcases/string_${i} ; i=$(( $i + 1 )) ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment