Forum

Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    July 2006
    Posts
    1,600

    Useful tools: ts3pwgen, notify

    notify.php
    Sends a message to all connected users on all virtual servers of a teamspeak3 server instance
    Requirements:

    Examples:
    Code:
    # send bold message in red color
    ./notify "The server is going down for a restart"
    
    # send unformatted message
    ./notify --plain "Plain Message"
    PHP Code:
    #!/usr/bin/php
    <?php
    // define where your local copy of the ts3 php framework is located
    $framework "./libraries/TeamSpeak3/TeamSpeak3.php";

    if(
    $argc || $argc 3) {
      
    fprintf(STDERR"Usage: %s [--plain] \"MESSAGE\"\n"basename(__FILE__));
      exit(
    1);
    }
    $plain $argv[1] == "--plain" true false;
    require_once(
    $framework);
    try {
      
    $instance TeamSpeak3::factory("serverquery://serveradmin:[email protected]:10011/");
      if(!
    $plain) {
        
    $message "[color=red][b]" $argv[1] . "[/b][/color]";
      } else {
        
    $message $argv[2];
      }
      
    $instance->message($message);
      
    } catch (
    Exception $e) {
      
    fprintf(STDERR"Error " $e->getCode() . ": " $e->getMessage() . "\n");
      exit(
    1);
    }
    ?>
    You might need to grant execution rights to the script: chmod u+x notify.php

    ----


    ts3pwgen.php
    • generates random passwords
    • is able to use user specified passwords
    • and encodes them with the standard teamspeak3 password hash algorithm

    Requirements:
    • Linux
    • php
    • `pwgen' installed on your machine (by the way: you always want to generate save passwords on the machine you are using it on. Never ever use online password generators to prevent anyone from sniffing it over the network)


    Examples:
    Code:
    ./ts3pwgen.php --help
    Usage: ts3pwgen.php [PASSWORD(S)...]
    Code:
    ./ts3pwgen.php
    Password: aiYee2ka Encoded: 6Qwy+EYkZHFbefh5n1Jgx3EpIgk=
    Code:
    ./ts3pwgen.php mySecretPassword anotherPassword
    Password: mySecretPassword Encoded: 8DJoApmwd6+5UJPeQIL2JVArglE=
    Password: anotherPassword Encoded: 7u8iwNsQCspG51eh8unbMTzUjw0=
    PHP Code:
    #!/usr/bin/php
    <?php

    function encodeAndPrint($password) {
        
    $encoded base64_encode(sha1($passwordtrue));
        
    fprintf(STDOUT"Password: %s Encoded: %s\n"$password$encoded);
    }
    function 
    printUsageAndExit() {
      
    fprintf(STDERR"Usage: %s [PASSWORD(S)...]\n"basename(__FILE__));
      exit(
    1);
    }

    if(
    in_array("-h"$argv) || in_array("--help"$argv)) {
        
    printUsageAndExit();
    }

    $passwords = array();
    for(
    $i 1$i sizeof($argv); $i++) {
        
    array_push($passwords$argv[$i]);
    }

    if(
    sizeof($passwords) > 0) {
      foreach(
    $passwords as $password) {
        
    encodeAndPrint($password);
      }
    } else {
      
    exec("pwgen -c -n 8 1"$output);
      
    encodeAndPrint($output[0]);
    }

    ?>
    You might need to grant execution rights to the script: chmod u+x ts3pwgen.php
    Last edited by maxi1990; July 5th, 2012 at 09:29 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. handy cap tools
    By Doug530 in forum General Questions
    Replies: 0
    Last Post: December 21st, 2011, 09:13 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •