commit f78a10a034b7d87614a08ceeef40d9706931f8a5 Author: James Dyson Date: Thu Nov 17 13:58:27 2016 +1100 Release 1.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9d37c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..57fe140 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "rcon-cmd" +version = "1.0.0" +authors = ["James Dyson "] + +[dependencies] +rcon = "*" +clap = "*" \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0995d34 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 James Dyson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7e499f --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +rcon-cmd +====== +Simple command line tool to connect to a rcon enabled server and issue commands + +## Usage +```$ rcon host:port password``` + +#### Common useful commands +| Command | Description | +|------------|----------------------------------------------| +| `status` | Retrieve the status of the host | +| `find ` | Search for commands where (eg `find status`) | +| `maps *` | List all maps hosted on server | \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6cd3a35 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,31 @@ +extern crate rcon; +extern crate clap; + +use clap::{App, Arg}; + +use std::io::stdin; +use std::io::BufRead; + +fn main() { + let matches = + App::new("rcon").about("rcon console tool") + .arg(Arg::with_name("ADDR") + .help("Server (HOST:PORT) to connect to") + .index(1) + .required(true)) + .arg(Arg::with_name("PASS") + .help("Password to authenicate with") + .index(2)) + .get_matches(); + + let mut conn = rcon::Connection::connect( + matches.value_of("ADDR").unwrap(), + matches.value_of("PASS").unwrap_or("") + ).expect("failed to connect to server"); + + let stdin = stdin(); + for line in stdin.lock().lines() { + let line = line.unwrap(); + println!("{}", conn.cmd(&line[..]).unwrap()); + } +} \ No newline at end of file