+import lldb
+
+def kdpReboot(debugger, command, result, internal_dict):
+ if not "kdp" in debugger.GetSelectedTarget().GetProcess().GetPluginName().lower():
+ print "Target is not connected over kdp. Connect to a remote machine with `kdp-remote <hostname>[:<portnum>]`."
+ return False
+
+ print "Rebooting the remote machine."
+ debugger.HandleCommand('process plugin packet send --command 0x13')
+ debugger.HandleCommand('detach')
+ return True
+
+def __lldb_init_module(debugger, internal_dict):
+ debugger.HandleCommand('command script add -f kdpReboot.kdpReboot kdp-reboot')