Updated Updater Script

This commit is contained in:
2025-11-01 03:53:03 -06:00
parent 42e75aa258
commit bec43418c1
27 changed files with 277 additions and 1899 deletions

View File

@@ -1,16 +0,0 @@
{
"version": 1,
"name": "Query OS String [LINUX]",
"description": "Simply returns the operating system in the output.",
"category": "application",
"type": "ansible",
"script": "LS0tCi0gbmFtZTogR2V0IG9wZXJhdGluZyBzeXN0ZW0gaW5mb3JtYXRpb24KICBob3N0czogYWxsCiAgZ2F0aGVyX2ZhY3RzOiB5ZXMKCiAgdGFza3M6CiAgICAtIG5hbWU6IFByaW50IE9TIHN0cmluZwogICAgICBkZWJ1ZzoKICAgICAgICBtc2c6ICJ7eyBhbnNpYmxlX2Rpc3RyaWJ1dGlvbiB9fSB7eyBhbnNpYmxlX2Rpc3RyaWJ1dGlvbl92ZXJzaW9uIH19IHt7IGFuc2libGVfZGlzdHJpYnV0aW9uX3JlbGVhc2UgfCBkZWZhdWx0KCcnKSB9fSIK",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,15 +0,0 @@
{
"version": 1,
"name": "Write Canary to C Drive Root",
"description": "Write a basic canary file to the C:\\ drive to determine if SYSTEM-level access is functional within the script engine.",
"category": "script",
"type": "ansible",
"script": "---\n- name: Create Canary.txt on local Windows machine\n hosts: localhost\n connection: local\n gather_facts: no\n\n tasks:\n - name: Write Canary.txt to C:\\\n ansible.windows.win_copy:\n content: \"This is a canary file created by Ansible.\"\n dest: C:\\Canary.txt\n",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": []
}

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +0,0 @@
{
"version": 1,
"name": "Remote Agent Update [WIN]",
"description": "Reaches out to the remote Borealis agent and triggers an automatic unattended update from the Github repository.",
"category": "script",
"type": "powershell",
"script": "W0NtZGxldEJpbmRpbmcoKV0KcGFyYW0oCiAgICBbUGFyYW1ldGVyKCldCiAgICBbc3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b24KfQoKaWYgKC1ub3QgJHVwZGF0ZVN1Y2NlZWRlZCkgewogICAgdGhyb3cgJ1VwZGF0ZS5wczEgVXBkYXRlIEZhaWxlZC4nCn0=",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,25 +0,0 @@
{
"version": 1,
"name": "Write Canary File to C Drive",
"description": "Writes a simple text file to the C:\\ drive of the computer. Requires SYSTEM level execution context to work.",
"category": "script",
"type": "powershell",
"script": "IyBEZWZpbmUgdGhlIGZpbGUgcGF0aAokZmlsZVBhdGggPSAiQzpcQ2FuYXJ5LnR4dCIKCiMgV3JpdGUgc29tZSBjb250ZW50IGludG8gdGhlIGZpbGUKJGVudjpjYW5hcnlNZXNzYWdlIHwgT3V0LUZpbGUgLUZpbGVQYXRoICRmaWxlUGF0aCAtRW5jb2RpbmcgVVRGOAo=",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [
{
"name": "canaryMessage",
"label": "Canary Message",
"type": "string",
"default": "Hello world!",
"required": true,
"description": "This is the text that will be written into the canary file."
}
],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,33 +0,0 @@
{
"version": 1,
"name": "Write Canary File to a Specific Folder",
"description": "Writes a basic canary file to a specific folder with specific input.",
"category": "script",
"type": "powershell",
"script": "JGVudjpjYW5hcnlNZXNzYWdlIHwgT3V0LUZpbGUgLUZpbGVQYXRoICRlbnY6Y2FuYXJ5TG9jYXRpb24gLUVuY29kaW5nIFVURjgK",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [
{
"name": "canaryLocation",
"label": "Folder Location",
"type": "string",
"default": "C:\\Users\\example\\Desktop\\Canary.txt",
"required": true,
"description": "Location of Canary File"
},
{
"name": "canaryMessage",
"label": "Message",
"type": "string",
"default": "Hello World!",
"required": false,
"description": "Message to be written into the canary file."
}
],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,25 +0,0 @@
{
"version": 1,
"name": "Ad-Hoc Powershell Command [WIN]",
"description": "Run an arbitrary powershell command (or series of commands) ad-hoc. Useful for a variety of tasks.",
"category": "script",
"type": "powershell",
"script": "IyBNb3ZlIGludG8gdGhlIGZvbGRlciBvZiB3aGVyZSB0aGlzIHNjcmlwdCBpcyBydW5uaW5nClNldC1Mb2NhdGlvbiAtUGF0aCAoU3BsaXQtUGF0aCAtUGFyZW50ICRQU0NvbW1hbmRQYXRoKQoKIyBSZXBvcnQgdGhlIGNvbW1hbmQgaXNzdWVkIHRvIHRoZSBTdGRPdXQKV3JpdGUtSG9zdCAiQ29tbWFuZCBFeGVjdXRlZDogJGVudjpjb21tYW5kIgoKIyBSdW4gdGhlIENvbW1hbmQKSW52b2tlLUV4cHJlc3Npb24gJGVudjpjb21tYW5kCg==",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [
{
"name": "command",
"label": "Powershell Command",
"type": "string",
"default": "",
"required": true,
"description": "Command to invoke in Powershell"
}
],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,25 +0,0 @@
{
"version": 1,
"name": "Shutdown Device [WIN]",
"description": "Shutdown the device with a configurable countdown.",
"category": "script",
"type": "powershell",
"script": "c2h1dGRvd24uZXhlIC9zIC9mIC90ICRlbnY6dGltZW91dA==",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [
{
"name": "timeout",
"label": "Shutdown Countdown",
"type": "number",
"default": "30",
"required": true,
"description": "Amount of time to wait before shutdown occurs."
}
],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,25 +0,0 @@
{
"version": 1,
"name": "ipconfig Release & Renew",
"description": "Releases the current IP address, waits n seconds, then renews the IP asking for a new one.",
"category": "script",
"type": "powershell",
"script": "aXBjb25maWcgL3JlbGVhc2UgClN0YXJ0LVNsZWVwIC1TZWNvbmRzICRlbnY6c2xlZXBUaW1lCmlwY29uZmlnIC9yZW5ldw==",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [
{
"name": "sleepTime",
"label": "Seconds Until Renew",
"type": "string",
"default": "5",
"required": true,
"description": "Number of seconds between releasing the IP and asking for a new one."
}
],
"files": [],
"script_encoding": "base64"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +0,0 @@
{
"version": 1,
"name": "RocketChat [WIN]",
"description": "Silently pulls down the most recent x64 MSI installer of RocketChat from Github and installs it for all users on the device.",
"category": "script",
"type": "powershell",
"script": "IyMjIFBvd2VyU2hlbGwgU2NyaXB0IHRvIERvd25sb2FkIGFuZCBJbnN0YWxsIHRoZSBMYXRlc3QgUm9ja2V0LkNoYXQgTVNJIEluc3RhbGxlcgoKIyBEZWZpbmUgdmFyaWFibGVzIGZvciB0aGUgR2l0SHViIHJlcG9zaXRvcnkgYW5kIHRoZSBsb2NhbCBkb3dubG9hZCBwYXRoCiRHaXRIdWJSZXBvID0gImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvUm9ja2V0Q2hhdC9Sb2NrZXQuQ2hhdC5FbGVjdHJvbi9yZWxlYXNlcy9sYXRlc3QiCiREb3dubG9hZFBhdGggPSAiJGVudjpURU1QXHJvY2tldGNoYXQtbGF0ZXN0Lm1zaSIKCnRyeSB7CiAgICAjIFN0ZXAgMTogRmV0Y2ggdGhlIGxhdGVzdCByZWxlYXNlIGluZm9ybWF0aW9uIGZyb20gR2l0SHViCiAgICBXcml0ZS1Ib3N0ICJGZXRjaGluZyB0aGUgbGF0ZXN0IHJlbGVhc2UgaW5mb3JtYXRpb24gZnJvbSBHaXRIdWIuLi4iCiAgICAkUmVsZWFzZUluZm8gPSBJbnZva2UtUmVzdE1ldGhvZCAtVXJpICRHaXRIdWJSZXBvIC1Vc2VCYXNpY1BhcnNpbmcKCiAgICAjIFN0ZXAgMjogRXh0cmFjdCB0aGUgVVJMIG9mIHRoZSB4NjQgTVNJIGZpbGU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0LkNoYXQgc2lsZW50bHkuLi4iCiAgICAkQXJndW1lbnRzID0gIi9pIGAiJERvd25sb2FkUGF0aGAiIC9xdWlldCAvbm9yZXN0YXJ0IEFMTFVTRVJTPTEiCiAgICBTdGFydC1Qcm9jZXNzIG1zaWV4ZWMuZXhlIC1Bcmd1bWVudExpc3QgJEFyZ3VtZW50cyAtV2FpdCAtTm9OZXdXaW5kb3cKCiAgICBXcml0ZS1Ib3N0ICJSb2NrZXQuQ2hhdCBpbnN0YWxsYXRpb24gY29tcGxldGVkIHN1Y2Nlc3NmdWxseS4iCgp9IGNhdGNoIHsKICAgICMgQ2F0Y2ggYW5kIGRpc3BsYXkgYW55IGVycm9ycyBkdXJpbmcgdGhlIHByb2Nlc3MKICAgIFdyaXRlLUVycm9yICJBbiBlcnJvciBvY2N1cnJlZDogJF8iCn0gZmluYWxseSB7CiAgICAjIFN0ZXAgNTogQ2xlYW4gdXAgdGhlIGRvd25sb2FkZWQgZmlsZSBpZiBuZWVkZWQKICAgIGlmIChUZXN0LVBhdGggJERvd25sb2FkUGF0aCkgewogICAgICAgIFJlbW92ZS1JdGVtICREb3dubG9hZFBhdGggLUZvcmNlCiAgICAgICAgV3JpdGUtSG9zdCAiQ2xlYW5lZCB1cCB0aGUgZG93bmxvYWRlZCBpbnN0YWxsZXIuIgogICAgfQp9Cg==",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": [],
"script_encoding": "base64"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +0,0 @@
{
"version": 1,
"name": "PuTTY [WIN]",
"description": "",
"category": "application",
"type": "powershell",
"script": "PCMgUHVUVFkgaW5zdGFsbGVyIChzaWxlbnQsIGluc3RhbGwtb25seSkgIz4KCmZ1bmN0aW9uIEVuYWJsZS1UbHMxMiB7CiAgICB0cnkgeyBbTmV0LlNlcnZpY2VQb2ludE1hbmFnZXJdOjpTZWN1cml0eVBy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aSBgIiRtc2lQYXRoYCIgL3FuIC9ub3Jlc3RhcnQiIC1XYWl0IC1QYXNzVGhydSAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQokY29kZSA9IGlmICgkcHJvYykgeyAkcHJvYy5FeGl0Q29kZSB9IGVsc2UgeyAxIH0KClJlbW92ZS1JdGVtICRtc2lQYXRoIC1Gb3JjZSAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQpleGl0ICRjb2RlCg==",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": [],
"script_encoding": "base64"
}

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +0,0 @@
{
"version": 1,
"name": "Microsoft Visual C++ Redistributable (2015-2022) [WIN]",
"description": "",
"category": "application",
"type": "powershell",
"script": "V3JpdGUtSG9zdCAiTWljcm9zb2Z0IFZpc3VhbCBDKysgUmVkaXN0cmlidXRhYmxlICgyMDE14oCTMjAyMikiCldyaXRlLUhvc3QgIj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSIKCiMgVExTIGVuYWJsZW1lbnQKdHJ5IHsKICAgIFtOZXQuU2VydmljZVBvaW50TWFuYWdlcl06OlNlY3VyaXR5UHJvdG9jb2wgPSBbRW51bV06OlRvT2JqZWN0KFtOZXQuU2VjdXJpdHlQcm90b2NvbFR5cGVdLCAzMDcyKQp9IGNhdGNoIHt9CgpmdW5jdGlvbiBOZXctSHR0cENsaWVudCB7CiAgICAkaGFuZGxlciA9IE5ldy1PYmplY3QgU3lzdGVtLk5ldC5IdHRwLkh0dHBDbGllbnRIYW5kbGVyCiAgICB0cnkgewogICAgICAgICRwcm94eSA9IFtTeXN0ZW0uTmV0LldlYlJlcXVlc3RdOjpEZWZhdWx0V2ViUHJveHkKICAgICAgICBpZiAoJHByb3h5KSB7CiAgICAgICAgICAgICRoYW5kbGVyLlVzZVByb3h5ID0gJHRydWUKICAgICAgICAgICAgJGhhbmRsZXI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ubWVudF06OklzNjRCaXRPcGVyYXRpbmdTeXN0ZW0pIHsKICAgIEluc3RhbGwtVkMgLUFyY2ggeDg2CiAgICBJbnN0YWxsLVZDIC1BcmNoIHg2NAp9IGVsc2UgewogICAgSW5zdGFsbC1WQyAtQXJjaCB4ODYKfQoKV3JpdGUtSG9zdCAiLSBPcGVyYXRpb25zIGNvbXBsZXRlLiIK",
"timeout_seconds": 3600,
"sites": {
"mode": "all",
"values": []
},
"variables": [],
"files": [],
"script_encoding": "base64"
}

View File

@@ -1,106 +0,0 @@
{
"tab_name": "Value Parser",
"nodes": [
{
"data": {
"body": "",
"content": "Fetch JSON from HTTP or remote API endpoint, with CORS proxy option.",
"intervalSec": "10",
"label": "API Request",
"result": "{\n \"status\": \"ok\"\n}",
"url": "http://localhost:5000/health",
"useProxy": "true"
},
"dragHandle": ".borealis-node-header",
"dragging": false,
"height": 124,
"id": "node-1754799747658",
"position": {
"x": 27.333333333333314,
"y": 28
},
"positionAbsolute": {
"x": 27.333333333333314,
"y": 28
},
"selected": false,
"type": "API_Request",
"width": 160
},
{
"data": {
"content": "Display prettified multi-line JSON from upstream node.",
"jsonData": {
"status": "ok"
},
"label": "Display JSON Data"
},
"dragHandle": ".borealis-node-header",
"dragging": false,
"height": 150,
"id": "node-1754799750393",
"position": {
"x": 245.33333333333326,
"y": 28
},
"positionAbsolute": {
"x": 245.33333333333326,
"y": 28
},
"selected": false,
"type": "Node_JSON_Pretty_Display",
"width": 260
},
{
"data": {
"content": "Provide a dot-separated key path (e.g. 'name.en'); outputs the extracted string or 'Key Not Found'.",
"keyName": "status",
"label": "JSON Value Extractor",
"result": "ok"
},
"dragHandle": ".borealis-node-header",
"dragging": false,
"height": 145,
"id": "node-1754799751513",
"position": {
"x": 559.3333333333333,
"y": 28
},
"positionAbsolute": {
"x": 559.3333333333333,
"y": 28
},
"selected": false,
"type": "JSON_Value_Extractor",
"width": 160
}
],
"edges": [
{
"animated": true,
"id": "reactflow__edge-node-1754799747658-node-1754799750393",
"source": "node-1754799747658",
"sourceHandle": null,
"style": {
"stroke": "#58a6ff",
"strokeDasharray": "6 3"
},
"target": "node-1754799750393",
"targetHandle": null,
"type": "bezier"
},
{
"animated": true,
"id": "reactflow__edge-node-1754799750393-node-1754799751513",
"source": "node-1754799750393",
"sourceHandle": null,
"style": {
"stroke": "#58a6ff",
"strokeDasharray": "6 3"
},
"target": "node-1754799751513",
"targetHandle": null,
"type": "bezier"
}
]
}

View File

@@ -1,113 +0,0 @@
{
"tab_name": "Logic Comparison",
"nodes": [
{
"data": {
"content": "Store a String or Number",
"label": "String Input A",
"value": "Bunny"
},
"dragHandle": ".borealis-node-header",
"dragging": false,
"height": 67,
"id": "node-1754800111049",
"position": {
"x": 19.333333333333314,
"y": 20.666666666666657
},
"positionAbsolute": {
"x": 19.333333333333314,
"y": 20.666666666666657
},
"selected": false,
"type": "DataNode",
"width": 160
},
{
"data": {
"accentColor": "#ff8c00",
"content": "Store a String or Number",
"label": "String Input B",
"value": "Bunny"
},
"dragHandle": ".borealis-node-header",
"dragging": false,
"height": 67,
"id": "node-1754800112609",
"position": {
"x": 19.33333333333337,
"y": 121.33333333333337
},
"positionAbsolute": {
"x": 19.33333333333337,
"y": 121.33333333333337
},
"selected": false,
"style": {
"--borealis-accent": "#ff8c00",
"--borealis-accent-dark": "#b36200",
"--borealis-title": "#ff8c00"
},
"type": "DataNode",
"width": 160
},
{
"id": "node-1754800323495",
"type": "ComparisonNode",
"position": {
"x": 271.3333333333333,
"y": 69.33333333333333
},
"data": {
"label": "Does A and B Match?",
"content": "Compare A and B using Logic, with new range operator.",
"value": "1",
"accentColor": "#c0ff00",
"inputType": "String",
"operator": "Equal (==)"
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 67,
"positionAbsolute": {
"x": 271.3333333333333,
"y": 69.33333333333333
},
"selected": false,
"dragging": false,
"style": {
"--borealis-accent": "#c0ff00",
"--borealis-accent-dark": "#86b300",
"--borealis-title": "#c0ff00"
}
}
],
"edges": [
{
"source": "node-1754800111049",
"sourceHandle": null,
"target": "node-1754800323495",
"targetHandle": "a",
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800111049-node-1754800323495a"
},
{
"source": "node-1754800112609",
"sourceHandle": null,
"target": "node-1754800323495",
"targetHandle": "b",
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800112609-node-1754800323495b"
}
]
}

View File

@@ -1,147 +0,0 @@
{
"tab_name": "Math Operations",
"nodes": [
{
"id": "node-1754800111049",
"type": "DataNode",
"position": {
"x": 19.333333333333314,
"y": 20.666666666666657
},
"data": {
"label": "Number Input A",
"content": "Store a String or Number",
"value": "5"
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 67,
"selected": false,
"positionAbsolute": {
"x": 19.333333333333314,
"y": 20.666666666666657
},
"dragging": false
},
{
"id": "node-1754800112609",
"type": "DataNode",
"position": {
"x": 19.33333333333337,
"y": 121.33333333333337
},
"data": {
"label": "Number Input B",
"content": "Store a String or Number",
"accentColor": "#ff8c00",
"value": "3"
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 67,
"selected": false,
"positionAbsolute": {
"x": 19.33333333333337,
"y": 121.33333333333337
},
"dragging": false,
"style": {
"--borealis-accent": "#ff8c00",
"--borealis-accent-dark": "#b36200",
"--borealis-title": "#ff8c00"
}
},
{
"id": "node-1754800119705",
"type": "MathNode",
"position": {
"x": 276.66666666666663,
"y": 69.33333333333334
},
"data": {
"label": "Multiply A x B",
"content": "Perform Math Operations",
"value": "15",
"operator": "Multiply",
"accentColor": "#00d18c"
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 67,
"positionAbsolute": {
"x": 276.66666666666663,
"y": 69.33333333333334
},
"selected": false,
"dragging": false,
"style": {
"--borealis-accent": "#00d18c",
"--borealis-accent-dark": "#009262",
"--borealis-title": "#00d18c"
}
},
{
"id": "node-1754800128555",
"type": "DataNode",
"position": {
"x": 517.3333333333334,
"y": 69.33333333333333
},
"data": {
"label": "Usable Result",
"content": "Store a String or Number",
"value": "15"
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 67,
"positionAbsolute": {
"x": 517.3333333333334,
"y": 69.33333333333333
},
"selected": true,
"dragging": false
}
],
"edges": [
{
"source": "node-1754800111049",
"sourceHandle": null,
"target": "node-1754800119705",
"targetHandle": "a",
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800111049-node-1754800119705a"
},
{
"source": "node-1754800112609",
"sourceHandle": null,
"target": "node-1754800119705",
"targetHandle": "b",
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800112609-node-1754800119705b"
},
{
"source": "node-1754800119705",
"sourceHandle": null,
"target": "node-1754800128555",
"targetHandle": null,
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800119705-node-1754800128555"
}
]
}

View File

@@ -1,276 +0,0 @@
{
"tab_name": "Text Recognition",
"nodes": [
{
"id": "node-1754800498085",
"type": "Borealis_Agent",
"position": {
"x": 25.999999999999943,
"y": 24.000000000000014
},
"data": {
"label": "Borealis Agent",
"content": "Select and manage an Agent with dynamic roles",
"agent_id": ""
},
"dragHandle": ".borealis-node-header",
"positionAbsolute": {
"x": 25.999999999999943,
"y": 24.000000000000014
},
"width": 205,
"height": 146,
"selected": false,
"dragging": false
},
{
"id": "node-1754800514571",
"type": "Agent_Role_Screenshot",
"position": {
"x": 278,
"y": 24
},
"data": {
"label": "Agent Role: Screenshot",
"content": "Capture screenshot region via agent",
"interval": "1000",
"x": "250",
"y": "100",
"w": "300",
"h": "200",
"visible": "true",
"alias": ""
},
"dragHandle": ".borealis-node-header",
"width": 166,
"height": 115,
"selected": false,
"positionAbsolute": {
"x": 278,
"y": 24
},
"dragging": false
},
{
"id": "node-1754800556810",
"type": "Image_Viewer",
"position": {
"x": 507.33333333333326,
"y": 24
},
"data": {
"label": "Raw Image Viewer",
"content": "Visual preview of base64 image with zoom overlay."
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 69,
"selected": false,
"positionAbsolute": {
"x": 507.33333333333326,
"y": 24
},
"dragging": false
},
{
"id": "node-1754800584420",
"type": "BWThresholdNode",
"position": {
"x": 507.33333333333337,
"y": 110
},
"data": {
"label": "BW Threshold",
"content": "Applies black & white threshold to base64 image input."
},
"dragHandle": ".borealis-node-header",
"width": 160,
"height": 96,
"selected": false,
"positionAbsolute": {
"x": 507.33333333333337,
"y": 110
},
"dragging": false
},
{
"id": "node-1754800597090",
"type": "OCR_Text_Extraction",
"position": {
"x": 46.800008138020814,
"y": 280.00000000000006
},
"data": {
"label": "OCR Text Extraction",
"content": "Extract Multi-Line Text from Upstream Image Node",
"engine": "EasyOCR",
"backend": "GPU",
"dataType": "Mixed",
"customRateEnabled": "true",
"customRateMs": "1000",
"changeThreshold": "0"
},
"dragHandle": ".borealis-node-header",
"width": 231,
"height": 160,
"selected": false,
"positionAbsolute": {
"x": 46.800008138020814,
"y": 280.00000000000006
},
"dragging": false
},
{
"id": "node-1754800680302",
"type": "ArrayIndexExtractor",
"position": {
"x": 497.3333333333333,
"y": 280
},
"data": {
"label": "Array Index Extractor",
"content": "Output a Specific Array Index's Value",
"lineNumber": "1"
},
"dragHandle": ".borealis-node-header",
"width": 210,
"height": 121,
"selected": false,
"positionAbsolute": {
"x": 497.3333333333333,
"y": 280
},
"dragging": false
},
{
"id": "node-1754800736215",
"type": "DataNode",
"position": {
"x": 328.6666666666665,
"y": 568.6666666666666
},
"data": {
"label": "String / Number",
"content": "Store a String or Number",
"value": "[ERROR] No base64 image data provided."
},
"dragHandle": ".borealis-node-header",
"width": 226,
"height": 67,
"selected": true,
"positionAbsolute": {
"x": 328.6666666666665,
"y": 568.6666666666666
},
"dragging": false
}
],
"edges": [
{
"source": "node-1754800498085",
"sourceHandle": "provisioner",
"target": "node-1754800514571",
"targetHandle": null,
"type": "smoothstep",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800498085provisioner-node-1754800514571",
"label": "Capture the Screen",
"labelBgStyle": {
"fill": "#000000"
},
"labelStyle": {
"fill": "#58a6ff"
}
},
{
"source": "node-1754800514571",
"sourceHandle": null,
"target": "node-1754800556810",
"targetHandle": null,
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800514571-node-1754800556810"
},
{
"source": "node-1754800514571",
"sourceHandle": null,
"target": "node-1754800584420",
"targetHandle": null,
"type": "bezier",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#58a6ff"
},
"id": "reactflow__edge-node-1754800514571-node-1754800584420"
},
{
"source": "node-1754800584420",
"sourceHandle": null,
"target": "node-1754800597090",
"targetHandle": null,
"type": "smoothstep",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#00d18c"
},
"id": "reactflow__edge-node-1754800584420-node-1754800597090",
"label": "Process Agent Screenshot into Text",
"labelBgStyle": {
"fill": "#000000"
},
"labelStyle": {
"fill": "#00d18c"
}
},
{
"source": "node-1754800597090",
"sourceHandle": null,
"target": "node-1754800680302",
"targetHandle": null,
"type": "straight",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#00d18c"
},
"id": "reactflow__edge-node-1754800597090-node-1754800680302",
"label": "Extract a Specific Line of Text",
"labelBgStyle": {
"fill": "#000000"
},
"labelStyle": {
"fill": "#00d18c"
}
},
{
"source": "node-1754800680302",
"sourceHandle": null,
"target": "node-1754800736215",
"targetHandle": null,
"type": "smoothstep",
"animated": true,
"style": {
"strokeDasharray": "6 3",
"stroke": "#ff8c00"
},
"id": "reactflow__edge-node-1754800680302-node-1754800736215",
"label": "Do something with the result",
"labelStyle": {
"fill": "#ff8c00"
},
"labelBgStyle": {
"fill": "#000000"
}
}
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,9 @@
param()
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
$script:BorealisTlsInitialized = $false
$script:BorealisTrustedThumbprints = @()
$script:BorealisCallbackApplied = $false
$symbols = @{
Success = [char]0x2705
Running = [char]0x23F3
@@ -223,8 +226,278 @@ function Get-BorealisServerUrl {
} catch {}
}
if (-not $serverBaseUrl) { $serverBaseUrl = 'http://localhost:5000' }
return $serverBaseUrl.Trim()
if (-not $serverBaseUrl) { $serverBaseUrl = 'https://localhost:5000' }
$resolved = Resolve-BorealisServerUrl -Url $serverBaseUrl
if ([string]::IsNullOrWhiteSpace($resolved)) {
return 'https://localhost:5000'
}
return $resolved
}
function Resolve-BorealisServerUrl {
param(
[string]$Url
)
if ([string]::IsNullOrWhiteSpace($Url)) {
return ''
}
$candidate = $Url.Trim()
if ($candidate -notmatch '^[A-Za-z][A-Za-z0-9+.-]*://') {
$candidate = "https://$candidate"
}
try {
$builder = New-Object System.UriBuilder($candidate)
} catch {
return $candidate.TrimEnd('/')
}
$allowPlaintext = $false
try {
$allowValue = $env:BOREALIS_ALLOW_PLAINTEXT
if ($allowValue) {
$normalizedAllow = $allowValue.ToString().Trim().ToLowerInvariant()
if ($normalizedAllow -and @('1','true','yes','on') -contains $normalizedAllow) {
$allowPlaintext = $true
}
}
} catch {}
if ($builder.Scheme -eq 'http' -and -not $allowPlaintext) {
$hostName = $builder.Host.ToLowerInvariant()
if ($hostName -in @('localhost','127.0.0.1','::1')) {
$builder.Scheme = 'https'
if ($builder.Port -eq -1 -or $builder.Port -eq 80) {
$builder.Port = 5000
}
}
}
return $builder.Uri.AbsoluteUri.TrimEnd('/')
}
function Get-CertificatesFromPem {
param(
[string]$Path
)
if (-not $Path -or -not (Test-Path $Path -PathType Leaf)) {
return @()
}
$lines = @()
try {
$lines = Get-Content -Path $Path -ErrorAction Stop
} catch {
return @()
}
if (-not $lines -or $lines.Count -eq 0) {
Write-Verbose ("PEM content at {0} is empty." -f $Path)
return @()
}
$collecting = $false
$buffer = ''
$certificates = @()
foreach ($line in $lines) {
$lineValue = if ($null -ne $line) { $line } else { '' }
$trimmed = $lineValue.ToString().Trim()
if ($trimmed -eq '-----BEGIN CERTIFICATE-----') {
Write-Verbose ("Detected certificate begin marker in {0}." -f $Path)
$collecting = $true
$buffer = ''
continue
}
if ($trimmed -eq '-----END CERTIFICATE-----') {
Write-Verbose ("Detected certificate end marker in {0}; buffer length = {1} characters." -f $Path, $buffer.Length)
if ($collecting -and $buffer) {
try {
$raw = [Convert]::FromBase64String($buffer)
$cert = $null
try { $cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($raw) } catch {}
if (-not $cert) {
try {
$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new(
$raw,
'',
[System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::EphemeralKeySet
)
} catch {}
}
if (-not $cert) {
throw "Unable to hydrate X509Certificate2 from PEM fragment."
}
$certificates += $cert
Write-Verbose ("Loaded certificate '{0}' from {1}" -f $cert.Subject, $Path)
} catch {
Write-Verbose ("Failed to decode certificate block from {0}: {1}" -f $Path, $_.Exception.Message)
}
}
$collecting = $false
$buffer = ''
continue
}
if ($collecting) {
$buffer += $trimmed
}
}
Write-Verbose ("Discovered {0} certificate(s) in {1}" -f $certificates.Count, $Path)
return $certificates
}
function Ensure-BorealisCertificateValidator {
if (-not ('Borealis.Update.CertificateValidator' -as [Type])) {
$typeDefinition = @"
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Borealis.Update
{
public static class CertificateValidator
{
private static readonly HashSet<string> _trusted = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
public static bool AllowLoopback { get; set; } = true;
public static void ReplaceTrustedThumbprints(string[] thumbprints)
{
_trusted.Clear();
if (thumbprints == null)
{
return;
}
foreach (var thumb in thumbprints)
{
if (string.IsNullOrWhiteSpace(thumb))
{
continue;
}
_trusted.Add(thumb);
}
}
public static bool Validate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
if (errors == SslPolicyErrors.None)
{
return true;
}
X509Certificate2 cert2 = certificate as X509Certificate2;
if (cert2 == null && certificate != null)
{
cert2 = new X509Certificate2(certificate);
}
if (cert2 != null && _trusted.Contains(cert2.Thumbprint))
{
return true;
}
if (chain != null)
{
foreach (var element in chain.ChainElements)
{
if (element.Certificate != null && _trusted.Contains(element.Certificate.Thumbprint))
{
return true;
}
}
}
if (AllowLoopback && sender is HttpWebRequest request && request.RequestUri != null)
{
var host = request.RequestUri.DnsSafeHost;
if (string.Equals(host, "localhost", StringComparison.OrdinalIgnoreCase) ||
string.Equals(host, "127.0.0.1", StringComparison.OrdinalIgnoreCase) ||
string.Equals(host, "::1", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}
"@
Add-Type -TypeDefinition $typeDefinition -Language CSharp -ErrorAction Stop
}
}
function Initialize-BorealisTlsContext {
param(
[string]$AgentRoot,
[string]$ServerBaseUrl
)
if ($script:BorealisTlsInitialized -and $script:BorealisTrustedThumbprints.Count -gt 0) {
return
}
$candidatePaths = @()
if ($env:BOREALIS_ROOT_CA_PATH) {
$candidatePaths += $env:BOREALIS_ROOT_CA_PATH
}
if ($AgentRoot) {
$candidatePaths += (Join-Path $AgentRoot 'Certificates\borealis-root-ca.pem')
$candidatePaths += (Join-Path $AgentRoot 'Certificates\engine-root-ca.pem')
$candidatePaths += (Join-Path $AgentRoot 'Certificates\borealis-server-bundle.pem')
}
$candidatePaths += (Join-Path $scriptDir 'Engine\Certificates\borealis-root-ca.pem')
$candidatePaths += (Join-Path $scriptDir 'Engine\Certificates\borealis-server-bundle.pem')
$candidatePaths += (Join-Path $scriptDir 'Certificates\borealis-root-ca.pem')
$candidatePaths += (Join-Path $scriptDir 'Data\Engine\Certificates\borealis-root-ca.pem')
$candidatePaths = $candidatePaths | Where-Object { $_ } | Select-Object -Unique
$trusted = @()
foreach ($path in $candidatePaths) {
$exists = $false
try { $exists = Test-Path $path -PathType Leaf } catch {}
Write-Verbose ("Evaluating Borealis TLS candidate: {0} (exists={1})" -f $path, ($exists ? 'true' : 'false'))
if (-not $exists) { continue }
try {
$trusted += Get-CertificatesFromPem -Path $path
} catch {}
}
if ($trusted.Count -gt 0) {
$script:BorealisTrustedThumbprints = $trusted | ForEach-Object { $_.Thumbprint.ToUpperInvariant() } | Sort-Object -Unique
Write-Verbose ("Borealis TLS trust store loaded {0} certificate(s)." -f $script:BorealisTrustedThumbprints.Count)
} else {
$script:BorealisTrustedThumbprints = @()
Write-Verbose "No Borealis TLS certificates located; loopback hosts will be allowed without CA verification."
}
Ensure-BorealisCertificateValidator
try {
[Borealis.Update.CertificateValidator]::ReplaceTrustedThumbprints($script:BorealisTrustedThumbprints)
} catch {}
try {
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls11
} catch {}
if (-not $script:BorealisCallbackApplied) {
try {
$callback = New-Object System.Net.Security.RemoteCertificateValidationCallback([Borealis.Update.CertificateValidator]::Validate)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $callback
$script:BorealisCallbackApplied = $true
} catch {}
}
$script:BorealisTlsInitialized = $true
}
function Get-AgentServiceId {
@@ -628,6 +901,7 @@ function Get-ServerCurrentRepoHash {
$json = $resp.Content | ConvertFrom-Json
return $json
} catch {
Write-Verbose ("Get-ServerCurrentRepoHash request to {0} failed: {1}" -f $uri, $_.Exception.Message)
return $null
}
}
@@ -873,6 +1147,7 @@ function Invoke-BorealisAgentUpdate {
$gitExe = Get-GitExecutablePath -ProjectRoot $scriptDir
$currentHash = Get-RepositoryCommitHash -ProjectRoot $scriptDir -AgentRoot $agentRoot -GitExe $gitExe
$serverBaseUrl = Get-BorealisServerUrl -AgentRoot $agentRoot
Initialize-BorealisTlsContext -AgentRoot $agentRoot -ServerBaseUrl $serverBaseUrl
$agentId = Get-AgentServiceId -AgentRoot $agentRoot
$authContext = Get-AgentAccessTokenContext -AgentRoot $agentRoot -ServerBaseUrl $serverBaseUrl -AgentGuid $agentGuid