| 725 |
theseven |
1 |
#!/usr/bin/env python
|
|
|
2 |
#
|
|
|
3 |
#
|
|
|
4 |
# Copyright 2010 TheSeven
|
|
|
5 |
#
|
|
|
6 |
#
|
|
|
7 |
# This file is part of emCORE.
|
|
|
8 |
#
|
|
|
9 |
# emCORE is free software: you can redistribute it and/or
|
|
|
10 |
# modify it under the terms of the GNU General Public License as
|
|
|
11 |
# published by the Free Software Foundation, either version 2 of the
|
|
|
12 |
# License, or (at your option) any later version.
|
|
|
13 |
#
|
|
|
14 |
# emCORE is distributed in the hope that it will be useful,
|
|
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
17 |
# See the GNU General Public License for more details.
|
|
|
18 |
#
|
|
|
19 |
# You should have received a copy of the GNU General Public License along
|
|
|
20 |
# with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
|
|
21 |
#
|
|
|
22 |
#
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
import sys
|
|
|
26 |
import struct
|
|
|
27 |
|
|
|
28 |
file = open(sys.argv[1], "rb")
|
|
|
29 |
stub = file.read()
|
|
|
30 |
file.close()
|
|
|
31 |
|
|
|
32 |
file = open(sys.argv[2], "rb")
|
|
|
33 |
payload = file.read()
|
|
|
34 |
file.close()
|
|
|
35 |
|
|
|
36 |
file = open(sys.argv[3], "wb")
|
|
|
37 |
file.write(stub + struct.pack("<I", len(payload)) + payload)
|
|
|
38 |
file.close()
|