https://github.com/matiasinsaurralde/binarypatch
Storing & retrieving arbitrary data from program headers
https://github.com/matiasinsaurralde/binarypatch
Last synced: 6 months ago
JSON representation
Storing & retrieving arbitrary data from program headers
- Host: GitHub
- URL: https://github.com/matiasinsaurralde/binarypatch
- Owner: matiasinsaurralde
- License: mit
- Created: 2016-06-23T06:21:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-25T00:53:39.000Z (over 9 years ago)
- Last Synced: 2025-04-10T19:08:28.018Z (6 months ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# binarypatch
Storing & retrieving arbitrary data from program headers
## Usage
Appending some data to an OSX/Darwin program:
```
package mainimport(
"github.com/matiasinsaurralde/binarypatch"
)func main() {
b := binarypatch.New( "myprogram", "darwin" )
index := b.Locate()
b.Write( []byte("hello"), index )b.WriteFile( "myprogram_with_data")
}
``````myprogram``` does the following:
```
package main
import(
"fmt"
"github.com/matiasinsaurralde/binarypatch"
)func main() {
b := binarypatch.ReadMyself(5, -1, "darwin")
fmt.Println("Reading from myself: ", b, string(b) )
}
```The output of the original program is:
```
% ./myprogram
Reading from myself: [0 0 0 0 0]
```Then, the output of the "patched" program:
```
% ./myprogram_with_data
Reading from myself: [104 101 108 108 111] hello
```## Supported architectures
* OSX/Darwin
* Windows## Related projects
* [binaryExpand](https://github.com/MrMaxB/binaryExpand)
* [go-liora](https://github.com/guitmz/go-liora)
* [payload-injector](https://github.com/sivu22/payload-injector)## License
[MIT](https://github.com/matiasinsaurralde/binarypatch/blob/master/LICENSE)