{"id":17132586,"url":"https://github.com/alphapeter/webcommander","last_synced_at":"2025-03-24T05:34:18.903Z","repository":{"id":148546034,"uuid":"73607985","full_name":"alphapeter/webcommander","owner":"alphapeter","description":"Simple web application written in go that allows you to exeute commands, scripts and make http requests using an http rest API","archived":false,"fork":false,"pushed_at":"2017-04-11T19:11:51.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T11:24:55.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/alphapeter.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":"2016-11-13T10:07:32.000Z","updated_at":"2016-11-13T11:21:23.000Z","dependencies_parsed_at":"2023-06-25T21:08:22.101Z","dependency_job_id":null,"html_url":"https://github.com/alphapeter/webcommander","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphapeter%2Fwebcommander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphapeter%2Fwebcommander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphapeter%2Fwebcommander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphapeter%2Fwebcommander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alphapeter","download_url":"https://codeload.github.com/alphapeter/webcommander/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217434,"owners_count":20579291,"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","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":[],"created_at":"2024-10-14T19:27:32.178Z","updated_at":"2025-03-24T05:34:18.885Z","avatar_url":"https://github.com/alphapeter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webcommander\n## Summary\nSimple web application written in go that allows you to exeute commands, scripts and make http requests using an http rest API.\nThe result of the executed command, script or http request will be returned as a result to the GET requests.\n\n*The server does currently not implement https. If it would be used publicly, it should be placed behind an SSL termination proxy*\n\n## Dependencies\nTo build the application you will need to install the [go framework](https://golang.org/)\n \n## Building the application\ntype `go build ` to create the binary. It is also possible to cross compile for other platforms, see the go language documentation for details.\n\n## Running the application\n**From source**  \ntype `go run *.go` or `go run *.go --settings path-to-settings/settings.json`  \n**Compiled binary**  \nBy default the application will look for a `settings.json` in the execution path, to use settings file located in an other directory, supply the parameter `--settings path-to-settings/settings.json`, ex. `./webcommander --settings /etc/webcommanded/settings.json`\n\n## Configuration\nThe configuration is done using a JSON file to define address, an optional api token, commands and http poxy requests.\nBy default the application will look for a `settings.json` in the execution path \n\n* address: ex. `\":8080\"` or `\"192.168.1.1:8080\"`\n* apiToken: ex. `\"9zk1HT7027716xk8z4PY08L5MiyZP6qi\"`\n* commands: ex. a json list of commands ex `[command]` where commands is composed of path, command, arguments and description\n    * command: ex. `\"ls\"` - the command to be executed\n    * arguments: ex. `[\"/\", \"-la\"]` - the arguments for the command\n    * path: ex. `\"/ls\"` - the path for the server, the result for the example would be `http://localhost:8080/ls`\n    * description: a description for the endpoint, accessible from the root path `http://localhost:8080` ex. `\"lists all files\"`\n* proxyRequests:\n    * path: ex. `\"/ip\"`\n    * url: ex. `\"https://api.ipify.org?format=json\"`\n    * description: ex. `\"shows the server external ip\"`\n\n### Sample configuration file\n*settings.json*\n```json\n{\n  \"address\": \":8080\",\n  \"apiToken\":\"\",\n  \"commands\": [{\n    \"path\": \"/restart-vpn\",\n    \"command\": \"/etc/init.d/vpn\",\n    \"arguments\": [\"restart\"],\n    \"description\": \"restart vpn\"\n  },\n    {\n      \"path\": \"/start-vpn\",\n      \"command\": \"/etc/init.d/vpn\",\n      \"arguments\": [\"start\"],\n      \"description\": \"start vpn\"\n    },\n    {\n      \"path\": \"/stop-vpn\",\n      \"command\": \"/etc/init.d/vpn\",\n      \"arguments\": [\"stop\"],\n      \"description\": \"stop vpn\"\n    }],\n  \"proxyRequests\":[{\n    \"path\": \"/ip\",\n    \"url\": \"https://api.ipify.org?format=json\",\n    \"description\": \"shows the server external ip\"\n  }]\n}\n\n```\n\n## Making requests\n\n**List available commands**    \nMake a http GET request to the root path ex. `http://localhost:8080`\n\n**Execute a command**   \nMake an http GET request to the corresponding path ex. `http://localhost:8080/restart-server` where `/restart-server` is the path\n\n**Authorization token**   \nThe token can be added to the request using either URL parameter or header field, read the Authorzation section below.\n\n## Authorization\n \n**No authorization**  \nThe authorization is optional, if the configuration property if left empty, no apiToken is required.\n\n**Required authorization**  \nAny string could be used as apiToken, ex. password or generated string.\n*Be aware that when using unencrypted http requests anyone could potentially read the token in plain text.*\n \n**Adding token to the GET request**   \n* Using url parameter  \n    Append the token to the url using apiToken=\u003ctoken\u003e, ex. `http://localhost/restart-server?apiToken=9zk1HT7027716xk8z4PY08L5MiyZP6qi`\n* Using header field   \n    Add the header field `apiToken` with the token as a value\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphapeter%2Fwebcommander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphapeter%2Fwebcommander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphapeter%2Fwebcommander/lists"}