{"id":19594117,"url":"https://github.com/seriousben/net-script","last_synced_at":"2025-07-30T11:37:35.798Z","repository":{"id":140048351,"uuid":"125738727","full_name":"seriousben/net-script","owner":"seriousben","description":"http and websocket scripting language","archived":false,"fork":false,"pushed_at":"2018-04-01T13:48:04.000Z","size":4722,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-26T14:18:36.647Z","etag":null,"topics":["golang","lexer","parser","parser-combinators","restclient"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seriousben.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-18T15:24:52.000Z","updated_at":"2023-12-16T18:21:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"93d1d629-4f37-48aa-ad0f-8aa963813069","html_url":"https://github.com/seriousben/net-script","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seriousben/net-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fnet-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fnet-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fnet-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fnet-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seriousben","download_url":"https://codeload.github.com/seriousben/net-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousben%2Fnet-script/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267858737,"owners_count":24155952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","lexer","parser","parser-combinators","restclient"],"created_at":"2024-11-11T08:42:20.178Z","updated_at":"2025-07-30T11:37:35.768Z","avatar_url":"https://github.com/seriousben.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netscript communication language\n\n[![GoDoc](https://godoc.org/github.com/seriousben/net-script?status.svg)](https://godoc.org/github.com/seriousben/net-script)\n[![CircleCI](https://circleci.com/gh/seriousben/net-script/tree/master.svg?style=shield)](https://circleci.com/gh/seriousben/net-script/tree/master)\n[![Go Reportcard](https://goreportcard.com/badge/github.com/seriousben/net-script)](https://goreportcard.com/report/github.com/seriousben/net-script)\n[![codecov](https://codecov.io/gh/seriousben/net-script/branch/master/graph/badge.svg)](https://codecov.io/gh/seriousben/net-script)\n\nWrite runnable programs against remote servers.\n\n## Usage\n\n```\nUsage:\n  netscript [flags]\n  netscript [command]\n\nAvailable Commands:\n  help        Help about any command\n  lint        Lint a netscript program\n  run         Run a netscript program\n\nFlags:\n  -h, --help   help for netscript\n\n```\n\n## Examples\n\n### httpbin.org example\n\n```\n$ cat example/httpbin.ns\n# Get IP\nGET https://httpbin.org/ip\n\n# Get headers\nGET https://httpbin.org/headers\nX-Custom-Header: Custom value\n\n# Post data\nPOST https://httpbin.org/post\n\nDATA\n\n# Post JSON\nPOST https://httpbin.org/post\n\n{\"json\": true}\n\n# Patch DATA\nPATCH https://httpbin.org/patch\n\nDATA\n\n# Put\nPUT https://httpbin.org/put\n\n# Delete\nDELETE https://httpbin.org/delete\n\n# Get image\nGET https://httpbin.org/image/png\n\n```\n\n```\n$ netscript run http.ns\n# Get IP\nGET https://httpbin.org/ip\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 34\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: application/json\n\\\\ Date: Sun, 25 Mar 2018 15:32:12 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n{\n  \"origin\": \"192.222.149.100\"\n}\n\n# Post data\nPOST https://httpbin.org/post\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 257\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: application/json\n\\\\ Date: Sun, 25 Mar 2018 15:32:12 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n{\n  \"args\": {},\n  \"data\": \"DATA\",\n  \"files\": {},\n  \"form\": {},\n  \"headers\": {\n    \"Connection\": \"close\",\n    \"Content-Length\": \"4\",\n    \"Host\": \"httpbin.org\"\n  },\n  \"json\": null,\n  \"origin\": \"192.222.149.100\",\n  \"url\": \"https://httpbin.org/post\"\n}\n\n# Post JSON\nPOST https://httpbin.org/post\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 288\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: application/json\n\\\\ Date: Sun, 25 Mar 2018 15:32:11 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n{\n  \"args\": {},\n  \"data\": \"{\\\"json\\\": true}\",\n  \"files\": {},\n  \"form\": {},\n  \"headers\": {\n    \"Connection\": \"close\",\n    \"Content-Length\": \"14\",\n    \"Host\": \"httpbin.org\"\n  },\n  \"json\": {\n    \"json\": true\n  },\n  \"origin\": \"192.222.149.100\",\n  \"url\": \"https://httpbin.org/post\"\n}\n\n# Patch DATA\nPATCH https://httpbin.org/patch\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 258\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: application/json\n\\\\ Date: Sun, 25 Mar 2018 15:32:11 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n{\n  \"args\": {},\n  \"data\": \"DATA\",\n  \"files\": {},\n  \"form\": {},\n  \"headers\": {\n    \"Connection\": \"close\",\n    \"Content-Length\": \"4\",\n    \"Host\": \"httpbin.org\"\n  },\n  \"json\": null,\n  \"origin\": \"192.222.149.100\",\n  \"url\": \"https://httpbin.org/patch\"\n}\n\n# Put\nPUT https://httpbin.org/put\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 296\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: application/json\n\\\\ Date: Sun, 25 Mar 2018 15:32:12 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n{\n  \"args\": {},\n  \"data\": \"# Delete\\nDELETE https://httpbin.org/delete\",\n  \"files\": {},\n  \"form\": {},\n  \"headers\": {\n    \"Connection\": \"close\",\n    \"Content-Length\": \"42\",\n    \"Host\": \"httpbin.org\"\n  },\n  \"json\": null,\n  \"origin\": \"192.222.149.100\",\n  \"url\": \"https://httpbin.org/put\"\n}\n\n# Get image\nGET https://httpbin.org/image/png\n\\\\  HTTP/1.1 200 OK\n\\\\ Content-Length: 8090\n\\\\ Access-Control-Allow-Credentials: true\n\\\\ Access-Control-Allow-Origin: *\n\\\\ Connection: keep-alive\n\\\\ Content-Type: image/png\n\\\\ Date: Sun, 25 Mar 2018 15:32:12 GMT\n\\\\ Server: meinheld/0.6.1\n\\\\ Via: 1.1 vegur\n\\\\ X-Powered-By: Flask\n\\\\ X-Processed-Time: 0\n\n\u003cNo Text Representation (type: image/png)\u003e\n\n```\n\n### Simple Websocket script\n\n```\n$ cat ws.ns\nWS wss://echo.websocket.org \n\nmessage\n$ netscript run ws.ns\nmessage\n```\n\n## Vision\n\n```\n#\n# Ideas taken from https://github.com/pashky/restclient.el \n#\n\n# Assign jwt from js script\n#   Calls `function ns_entry(/*no args*/) { return JSON.stringify({ jwt: \"val\" }) }`\n:jwt |= generate_jwt.js | .jwt \n\n# Websocket connection\nWS http://example.com\nUser-Agent: net script\nAuthorization: :jwt\n\nws message 1\nws message 2\nws message 3\nws message 4\nws message 5\nws message 6\nws message 7\n\n# Pipe data to websocket.js\n#   Calls `function ns_entry(allSentMessages, allReceivedMessages) { return JSON.stringify({ key: \"val\", key2: \"val2\" }) }`\n:wsdata |= websocket.js\n\n# POST with json body\nPOST http://example.com \nUser-Agent: net script\nContent-Type: application/json\n\n{\n  \"example\": \"{{ :wsdata | .key2 }}\"\n}\n\n# GET with a query param\nGET http://example.com\n? key \"escaped query param value\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousben%2Fnet-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseriousben%2Fnet-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousben%2Fnet-script/lists"}