Skip to content

Commit

Permalink
Preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
dipusone committed Jan 2, 2023
1 parent 16dd7fc commit 566f435
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) <year> <copyright holders>
Copyright (c) <2023> <Jacopo Ferrigno>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# GoLang pclntab parser
Author: **Jacopo Ferrigno**

_BinaryNinja plugin to parse gopclntab and restore functions names for all GoLang versions._
_BinaryNinja plugin to parse GoLang binaries and restore some information, like function names._

## Description:

This plugin will parse the gopclntab and restore the function names extracting the information from the `.gopclntab` section in the binary. If there is no section named .gopclntab it will try to search for the section.

It will also try to recover type information and restore them
This plugin will parse a go binary and restore some information like:
- Function names by parsing the `.gopclntab` section in the binary. If there is no section named .gopclntab it will try to search for it.
- Recover type information by parsing specific callsbuthe gopclntab and restore the function names extracting the information from the `.gopclntab` section in the binary.

The plugin works for all GoLang version from 12 to 119.

Expand All @@ -22,7 +22,6 @@ The plugin is based on the following resources.
https://github.com/golang/go/blob/fad4a16fd43f6a72b6917eff656be27522809074/src/reflect/type.go#L317



## License

This plugin is released under an [MIT license](./license).
4 changes: 3 additions & 1 deletion golang_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def santize_gofunc_name(name):

def sanitize_gotype_name(name):
name = santize_gofunc_name(name)
name = name.replace('*', '')
return name


Expand Down Expand Up @@ -320,6 +319,9 @@ def create_types(self):
self.bv.add_user_data_ref(
gotype.address_off('nameOff'),
gotype.resolved_name_addr)

name_datavar = self.bv.get_data_var_at(gotype.resolved_name_addr)
name_datavar.name = f"{go_data_type.name}_name"
created += 1

log_info(f"Created {created} types")
Expand Down
8 changes: 4 additions & 4 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"pluginmetadataversion": 2,
"name": "GoLang pclntab parser",
"name": "GoLang binary parser",
"author": "Jacopo Ferrigno",
"type": [
"ui"
],
"api": [
"python3"
],
"description": "BinaryNinja plugin to parse gopclntab and restore functions names for all GoLang versions.",
"longdescription": "This plugin will parse the gopclntab and restore the function names extracting the information from the `.gopclntab` section in the binary. If there is no section named .gopclntab it will try to search for the section.",
"description": "BinaryNinja plugin to parse GoLang binaries and restore some information, like function names and type information",
"longdescription": "This plugin will parse a go binary and restore information like the functions names, by parsing the .gopclntab, and extract typing information from the executable itself.",
"license": {
"name": "MIT",
"text": "Copyright 2023 Jacopo Ferrigno\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
Expand All @@ -24,6 +24,6 @@
"Windows": "no special instructions, package manager is recommended",
"Linux": "no special instructions, package manager is recommended"
},
"version": "1.0",
"version": "1.1",
"minimumbinaryninjaversion": 3946
}

0 comments on commit 566f435

Please sign in to comment.