Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
@Marsman1996

This comment has been minimized.

Copy link

commented Aug 9, 2019

When I run this shell, I get make_testcases.sh: 3: make_testcases.sh: 0: not found error.
Maybe line4 i=$[ $i + 1 ] ; should be changed to i=$(( $i + 1 )) ; ?

@moyix

This comment has been minimized.

Copy link
Owner Author

commented Aug 9, 2019

Are you running it with bash? $[ ] is valid syntax for bash but not sh:

moyix@lorenzo:~$ sh -c 'echo $[ 1 + 1 ]'
$[ 1 + 1 ]
moyix@lorenzo:~$ bash -c 'echo $[ 1 + 1 ]'
2
@Marsman1996

This comment has been minimized.

Copy link

commented Aug 10, 2019

Sorry, I run it with sh. My bad >_<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.