Skip to content

Commit 050fdb5

Browse files
committed
Added the auto-generating notice.
1 parent f1edb98 commit 050fdb5

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

mkhex.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/usr/bin/env bash
22

3+
#
4+
# I am a bash starter. Feel free to improve
5+
# or adapt this script.
6+
#
37

48
#
59
# Copyright 2015 Gu Zhengxiong <rectigu@gmail.com>
610
#
11+
# GPL
12+
#
713

814

915
regex='\t([0-9a-f]{2}\s)+'
@@ -14,20 +20,42 @@ then
1420

1521
if [[ $2 -eq 2 ]]
1622
then
23+
printf '/*\n * This file was automatically generated'
24+
printf ' by mkhex.sh,\n * '
25+
printf 'which, together with the complete\n * '
26+
printf 'and heavily commented assembly source code\n * '
27+
printf 'for this shellcode,'
28+
printf ' is available at\n * '
29+
printf 'https://github.com/NoviceLive/shellcoding.\n * '
30+
printf '\n * For those curious heads\n * '
31+
printf "striving to figure out what's under the hood.\n"
32+
printf ' *\n */\n\n\n'
1733
printf '# include <stdio.h>\n# include <string.h>\n\n\n'
1834
printf 'int\nmain(void)\n{\n '
1935
printf 'char *shellcode = "'
2036
fi
37+
38+
c=0
2139
for i in $hex
2240
do
41+
if [[ $2 -eq 2 ]] && [[ $c -eq 10 ]]
42+
then
43+
c=0
44+
printf '"\n "'
45+
fi
46+
2347
if [[ $2 -eq 1 ]]
2448
then
2549
fmt='%s'
2650
else
2751
fmt='\\x%s'
2852
fi
53+
2954
printf $fmt "$i"
55+
56+
c=$(($c + 1))
3057
done
58+
3159
if [[ $2 -eq 2 ]]
3260
then
3361
printf '";\n\n'

0 commit comments

Comments
 (0)