Last active
June 6, 2019 14:27
-
-
Save Jinmo/3ddcbdf870e9cabbb8b9b9f259890dd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"swig/plugin" | |
"swig/ida_kernwin" | |
) | |
func InitPlugin() int { | |
ida_kernwin.Msg("console!") | |
return plugin.PLUGIN_KEEP | |
} | |
func RunPlugin(arg int) bool { | |
switch arg { | |
case 0: | |
ida_kernwin.Warning("warning") | |
case 1: | |
ida_kernwin.Info("info") | |
} | |
return true | |
} | |
func init() { | |
plugin.InitPlugin(plugin.Plugin{ | |
Flags: plugin.PLUGIN_FIX, | |
Name: "jinmo123", | |
Init: InitPlugin, | |
Run: RunPlugin, | |
}) | |
} | |
func main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes, subprocess, tempfile | |
path = os.path.expanduser('~/idasdk70') | |
os.environ['GOPATH'] = path | |
os.putenv('GOPATH', path) | |
def run_script(script): | |
with open('script.go', 'wb') as f: | |
f.write(script) | |
dll = tempfile.NamedTemporaryFile(suffix='.dll') | |
dll.close() | |
p = subprocess.Popen(['go', 'build', '-buildmode', 'c-shared', '-o', dll.name, 'script.go'], stderr=subprocess.PIPE) | |
stdout, stderr = p.communicate() | |
print stderr | |
ctypes.WinDLL(dll.name) | |
run_script(r""" | |
package main | |
import ( | |
"swig/ida_kernwin" | |
) | |
func init() { | |
ida_kernwin.Msg("hello!\n") | |
} | |
func main() {} | |
""".strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment