TABLE OF CONTENTS
Scripts and Utilities

Scripts

The following are some scripts that I've written for the BBS that other SysOps may find useful:



BBSLink Script

BBSLink is an awesome site running several BBS Door games that you can allow your users to connect to from your system. This is great if you are trying to run under a linux server or are having trouble getting doors to work in house. For more information on BBSLink go to bbslink.net


In order to connect your system to BBSLink you will have to first apply on their website. Once your application has been accepted, you will receive an email with your credentials and connection information.


The BBSLink site has many scripts and information that will help you connect your BBS. However, I wrote a Mystic Python script which will allow you to connect Mystic BBS to BBSLink. Mystic Python scripts are a custom python scripts that allow you to run regular Python code and integrate it into Mystic BBS.


  • For More Information on Mystic BBS: www.mysticbbs.com
  • For More Information on Mystic Embedded Python scipting: wiki.mysticbbs.com/doku.php?id=python

  • The Script I wrote can be downloaded here:

    bbslink.mpy
    (Or you can cut & past from below)

    To Use The Script:


  • Ensure that you have Python 2.7 running on your computer. If you need help with this, click here: http://wiki.mysticbbs.com/doku.php?id=python_install
  • Copy the Script file into your mystic BBS Scripts directory (mystic\themes\default\scripts or mystic\scripts depending on which release you are running)
  • Edit the script with your favorite text editor. Scroll down to about lines 43 thru 45:
    	syscode="changeme"
    	authcode = "changeme"
    	schemecode = "changeme"
    	(You will want to change these to match the information you received when you applied for BBSLink.
    
  • Go into your Mystic Configuration (mystic -cfg) and go to your menu editor. You will need to set up a command to go to BBSLink.
        Menu Command: GY (Executable Python Script
        Data: bbslink doorcode
        NOTE: The doorcode above is a door that you are navigating to. A lsit of these door codes can be retrieved from bbslink. However, if you omit the "doorcode" and just put "bbslink", the script
       will take your users to a door menu on the BBSLink site where they can pick from all the doors available.
    
  • The Script

    #    ***********************************************************************
    #    * BBS Link Script for Mystic BBS                                      *
    #    ***********************************************************************
    #    * This script will allow you to run BBSlink from your system.         *
    #    * Installation:                                                       *
    #    * (1) Go to http://www.bbslink.net and register!                      *
    #    * (2) Locate the line below that says "BBS Auth Information".         *
    #    *     Change the syscode, authcode, and schemecode to match what you  *
    #    *     receive when you signed up.                                     *
    #    * (3) Install this script into your mystic /themes/default/scripts    * 
    #    *     directory.                                                      *
    #    * NOTE: This is a Mystic Python script, so you will have to install   *
    #    * python 2.7 to run this. Refer to this page for help:                *
    #    * http://wiki.mysticbbs.com/doku.php?id=python_install                *
    #    * (4) In Mystic -cfg, you will need to add a menu option in your      *
    #    *     menu editor:                                                    *
    #    *     Menu Command: GY (Executable Python Script)                     *
    #    *     Data: bbslink doorcode                                          *
    #    *     or just bbslink which will bring up a menu of doors             *
    #    *                                                                     *
    #    ***********************************************************************
    import json
    import httplib
    import hashlib 
    import random
    import string
    import md5
    from mystic_bbs import *
    
    def randomString(stringLength=10):
        """Generate a random string of fixed length """
        letters = string.ascii_lowercase
        return ''.join(random.choice(letters) for i in range(stringLength))
        
    def getMD5Hash(s):
    	m = md5.new()
    	m.update(s)
    	rv = m.hexdigest()
    	return rv
    
    
    #BBS Auth Information
    syscode = "changeme";
    authcode = "changeme";
    schemecode = "changeme";
    
    #Host Connection Info
    host  = "games.bbslink.net"
    
    #Script Information
    scripttype = "JS"
    scriptver = "1.2.1"
    
    #User Information 
    user  = getuser(0)
    usernumber = user["id"]
    
    #Door to launch. Default is to bring up the menu
    if param_str(1) is None:
    	doorcode="menu"
    else:
    	doorcode = param_str(1)
    
    
    config = getcfg()
    bbsName = config["bbsname"]
    screenrows = 24
    
    writeln("Please wait...")
    #Open Connection
    conn = httplib.HTTPConnection(host)
    
    #Get Token from server
    key = randomString(6)
    endpoint = "/token.php?key=" + key;
    conn.request('GET', endpoint)
    response1 = conn.getresponse()
    token = response1.read();
    
    #Authenticate with server
    authurl = "/auth.php?key=" + key;
    headers = {
    	"X-User": usernumber,
    	"X-System": syscode,
    	"X-Auth": getMD5Hash(authcode + token),
    	"X-Code": getMD5Hash(schemecode + token),
    	"X-Rows": screenrows,
    	"X-Key": key,
    	"X-Door": doorcode,
    	"X-Token": token,
    	"X-Type": scripttype,
    	"X-Version": scriptver
    }
    conn.request('GET', authurl, "", headers)
    response2 = conn.getresponse()
    status = response2.read()
    status = str(status).strip()
    if status == "complete":
    	writeln("Connecting to the interBBS server...")
    	menucmd("IT", "/addr={} /port=23".format(host))	
    else:	
    	writeln("Unable to connect")
    	writeln("Response: " + status)
    
    writeln("Returning to " + bbsName + "...")
    
    
    Document Roots