n8n-nodes-binalyze-air
Version:
Binalyze AIR nodes for automating DFIR with n8n workflows
73 lines • 4.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.api = void 0;
const helpers_1 = require("../../utils/helpers");
exports.api = {
async executeCommand(context, credentials, sessionId, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', `/api/public/interact/shell/sessions/${sessionId}/execute-command`);
requestOptions.body = data;
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `execute command in session ${sessionId}`);
return response;
},
async executeAsyncCommand(context, credentials, sessionId, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', `/api/public/interact/shell/sessions/${sessionId}/execute-async-command`);
requestOptions.body = data;
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `execute async command in session ${sessionId}`);
return response;
},
async interruptCommand(context, credentials, sessionId, messageId) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', `/api/public/interact/shell/sessions/${sessionId}/messages/${messageId}/interrupt-command`);
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `interrupt command ${messageId} in session ${sessionId}`);
if (response && response.success === true && response.result === null) {
return {
success: true,
result: {
messageId: messageId,
status: 'interrupted',
message: 'Command interrupted successfully'
},
statusCode: response.statusCode || 200,
errors: response.errors || []
};
}
return response;
},
async closeSession(context, credentials, sessionId) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', `/api/public/interact/shell/sessions/${sessionId}/close`);
try {
await context.helpers.httpRequest(requestOptions);
return {
success: true,
result: {
sessionId: sessionId,
status: 'closed',
message: 'Session closed successfully'
},
statusCode: 200,
errors: []
};
}
catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Failed to close session';
throw new Error(`Failed to close session ${sessionId}: ${errorMessage}`);
}
},
async getCommandMessage(context, credentials, sessionId, messageId) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', `/api/public/interact/shell/sessions/${sessionId}/messages/${messageId}`);
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, `get command message ${messageId} from session ${sessionId}`);
return response;
},
async assignInterACTTask(context, credentials, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/interact/shell/assign-task');
requestOptions.body = data;
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'assign InterACT shell task');
return response;
},
async createInterACTSession(context, credentials, data) {
const requestOptions = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/interact/shell/assign-task');
requestOptions.body = data;
const response = await (0, helpers_1.makeApiRequestWithErrorHandling)(context, requestOptions, 'create InterACT session');
return response;
}
};
//# sourceMappingURL=interact.js.map