-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
4,853 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* text=auto | ||
/.github export-ignore | ||
.styleci.yml export-ignore | ||
.scrutinizer.yml export-ignore | ||
BACKERS.md export-ignore | ||
CONTRIBUTING.md export-ignore | ||
CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/vendor | ||
/.idea | ||
/.vscode | ||
/.vagrant | ||
/builds/phust | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<p align="center"> | ||
<h1>phust</h1> | ||
</p> | ||
|
||
<h4> <center>Send RCON commands to your Rust server via the command-line</center></h4> | ||
|
||
### Requirements | ||
* PHP >= 7.2.5 | ||
|
||
### Installation | ||
Download the latest binary from the [releases](https://github.com/coef/phust/releases) page. | ||
|
||
### Usage | ||
```sh | ||
$ chmod +x phust | ||
$ ./phust rcon:send --help | ||
$ ./phust rcon:send --ip "server.ip" --port "28016" --pass "password" --command "status" | ||
``` | ||
|
||
------ | ||
|
||
## License | ||
|
||
Phust is an open-source software licensed under the [MIT license](https://github.com/coef/phust/blob/master/LICENSE.md). |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use LaravelZero\Framework\Commands\Command; | ||
use WebSocket\Client; | ||
|
||
class SendRconCommand extends Command | ||
{ | ||
/** | ||
* The signature of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'rcon:send {--command= : Command to be sent to server (required)} | ||
{--ip= : IP of server (required)} | ||
{--port= : Port of server (required)} | ||
{--pass= : RCON Password (required)}'; | ||
|
||
/** | ||
* The description of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Send RCON command'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$needs = [ | ||
'command', | ||
'ip', | ||
'port', | ||
'pass', | ||
]; | ||
foreach ($needs as $need) { | ||
if (!array_key_exists($need, $this->options()) || empty($this->options()[$need])) { | ||
$this->error('Please pass all required options'); | ||
exit(1); | ||
} | ||
} | ||
$client = new Client("ws://{$this->option('ip')}:{$this->option('port')}/{$this->option('pass')}"); | ||
$data = json_encode([ | ||
'Identifier' => 0, | ||
'Message' => $this->option('command'), | ||
'Stacktrace' => '', | ||
'Type' => 3 | ||
]); | ||
$client->send($data); | ||
$result = json_decode($client->receive()); | ||
echo $result->Message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class AppServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Create The Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The first thing we will do is create a new Laravel application instance | ||
| which serves as the "glue" for all the components of Laravel, and is | ||
| the IoC container for the system binding all of the various parts. | ||
| | ||
*/ | ||
|
||
$app = new LaravelZero\Framework\Application( | ||
dirname(__DIR__) | ||
); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Bind Important Interfaces | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Next, we need to bind some important interfaces into the container so | ||
| we will be able to resolve them when needed. The kernels serve the | ||
| incoming requests to this application from both the web and CLI. | ||
| | ||
*/ | ||
|
||
$app->singleton( | ||
Illuminate\Contracts\Console\Kernel::class, | ||
LaravelZero\Framework\Kernel::class | ||
); | ||
|
||
$app->singleton( | ||
Illuminate\Contracts\Debug\ExceptionHandler::class, | ||
Illuminate\Foundation\Exceptions\Handler::class | ||
); | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Return The Application | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This script returns the application instance. The instance is given to | ||
| the calling script so we can separate the building of the instances | ||
| from the actual running of the application and sending responses. | ||
| | ||
*/ | ||
|
||
return $app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"chmod": "0755", | ||
"directories": [ | ||
"app", | ||
"bootstrap", | ||
"config", | ||
"vendor" | ||
], | ||
"files": [ | ||
"composer.json" | ||
], | ||
"exclude-composer-files": false, | ||
"compression": "GZ", | ||
"compactors": [ | ||
"KevinGH\\Box\\Compactor\\Php", | ||
"KevinGH\\Box\\Compactor\\Json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "laravel-zero/laravel-zero", | ||
"description": "The Laravel Zero Framework.", | ||
"keywords": [ | ||
"framework", | ||
"laravel", | ||
"laravel zero", | ||
"console", | ||
"cli" | ||
], | ||
"homepage": "https://laravel-zero.com", | ||
"type": "project", | ||
"license": "MIT", | ||
"support": { | ||
"issues": "https://github.com/laravel-zero/laravel-zero/issues", | ||
"source": "https://github.com/laravel-zero/laravel-zero" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Nuno Maduro", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.2.5", | ||
"laravel-zero/framework": "^7.0", | ||
"textalk/websocket": "^1.3" | ||
}, | ||
"require-dev": { | ||
"mockery/mockery": "^1.3.1", | ||
"phpunit/phpunit": "^8.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"App\\": "app/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"preferred-install": "dist", | ||
"sort-packages": true, | ||
"optimize-autoloader": true | ||
}, | ||
"scripts": { | ||
"post-create-project-cmd": [ | ||
"@php application app:rename" | ||
] | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"bin": [ | ||
"phust" | ||
] | ||
} |
Oops, something went wrong.