File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -10083,6 +10083,8 @@ namespace BinaryNinja {
1008310083 WorkflowMachine(Ref<BinaryView> view);
1008410084 WorkflowMachine(Ref<Function> function);
1008510085
10086+ bool PostJsonRequest(const std::string& request);
10087+
1008610088 /*! Start the workflow WorkflowMachine
1008710089 Starts the workflow machine for the given BinaryView or Function.
1008810090 \return true if the command is accepted, false otherwise.
Original file line number Diff line number Diff line change @@ -147,6 +147,23 @@ WorkflowMachine::WorkflowMachine(Ref<Function> function): m_function(function)
147147}
148148
149149
150+ bool WorkflowMachine::PostJsonRequest (const std::string& request)
151+ {
152+ string jsonResult;
153+ if (m_function)
154+ jsonResult = BNPostWorkflowRequestForFunction (m_function->GetObject (), request.c_str ());
155+ else
156+ jsonResult = BNPostWorkflowRequestForBinaryView (m_view->GetObject (), request.c_str ());
157+
158+ rapidjson::Document response (rapidjson::kObjectType );
159+ response.Parse (jsonResult.c_str ());
160+ if (response.HasMember (" commandStatus" ) && response[" commandStatus" ].HasMember (" accepted" ))
161+ return response[" commandStatus" ][" accepted" ].GetBool ();
162+
163+ return false ;
164+ }
165+
166+
150167bool WorkflowMachine::Run ()
151168{
152169 return PostRequest (" run" );
You can’t perform that action at this time.
0 commit comments