Category: Tutorial

TUTORIAL: Command Line Interfaces

Some of you writing servers are only now realizing how limited your use of normal stdin API’s are when working with Twisted. This tutorial shows you how to use Twisted’s command line receiver as well as my more advanced command line interface module. Twisted’s LineReceiver You generally can’t use blocking reads in Twisted and most of the stdin tools you’re used to are, in fact, blocking. For example, “rawinput()” doesn’t…

TUTORIAL: Interception

As promised, here’s the “downlow” on address interception. As a reminder, the chaperone is already configured to support this. Here’s a quick overview of the architecture. In this diagram, a node with address 20161.X.Y.Z. (hereafter X.Y.Z) sends a message to 20161.A.B.C (hereafter A.B.C). The Interceptor has already succeeded at the challenge and arranged to intercept all messages to A.B.C (either destined for, or coming from). Accordingly the message to A.B.C…

TUTORIAL: PyPy Sandboxing, and MobileCode Execution

Setting Up PyPy Thankfully, this is much easier this year. It should only require two simple steps: apt-get install pypy apt-get install python-pypy.sandbox ln -s /usr/lib/python2.7/dist-packages/pypy/ /usr/lib/pypy/dist-packages/ On the class VM’s, this is all you’ll have to do. However, if you’re running this on your own local machine, you may need additional steps. The versions of pypy and python-pypy.sandbox on the virtual machines are both 2.2.1. On my personal virtual…

Crypto Tutorial

This tutorial walks you through some basic crypto operations that you’ll need for the secure layer. For most of this, I’ll be suing the Python Cryptography Toolkit (PyCrypto). This module is imported as “Crypto”, although you usually import one or more submodules. Please make sure you have the right package installed. There are other packages named “crypto” that are not the right one. I’ll also be using a few Playground specific…

TUTORIAL: Protocols Part II

We covered the basics of protocols in an earlier post. The first tutorial focused on data transmissions and message handling. In this tutorial, we will focus on two other critical ideas: Connection Management Memory Management Connections: There are at least three distinct phases: pre-connection, connection, post-connection. The pre-connection phase is after the protocol class has been created, but before it has network connectivity. For most service protocols, such as C2C and PTCL,…

TUTORIAL: Stacking Protocols Part 2, Message Encapsulation

  See Stacking Protocols Part 1. MESSAGE ENCAPSULATION KEY CONCEPT: Each layer will only see data fields pertinent to its own layer Let’s walk through an example. Suppose we’ve set up an echo client and server over PTCL. The stacks will look like this: [ Echo Protocol (PTCL transport) ]       [ Echo Server (PTCL Transport)  ] [ PTCL Protocol (C2C transport)  ]       [ PTCL Protocol (C2C…

TUTORIAL: Bank Tutorial 4 (Programmatic Access)

The following is a tutorial on using the Bank Client programmatically (as opposed to interactively as was covered in Part 3, see also Part 2 and Part 1). The Short Version The Bank Client Protocol is around the concepts of firing off a message to the server, then registering a callback to receive the result. Let’s look at a simple example: getBalance def balanceCallback(msgObj): print “Got balance from server:”, msgObj.Balance…

TUTORIAL: Bank Tutorial 3 (Client Access)

In Part 2 of this tutorial, you should have started up a bank server and connected to it with a bank client (see also Part 1). If you were successful, you got a command line shell for interacting with the bank. In case you’re not clear, this is over the (playground) network. Here’s a diagram of the system. [ Bank Server ] [ Bank Client ] <-> User input […

TUTORIAL: Bank Tutorial 2

This is part 2 of the bank tutorial. Part 1 is here. This tutorial walks through setting up the bank. What you’ll need: A Bank private key and cert (you should know how to do this by now) A Mint private key and cert Phase 1 Generate some BitPoints. 100 is enough. The instructions are in the first part of the tutorial @53. Phase 2 Setup the new password file with…

TUTORIAL: Bank Tutorial 1

Every BitPoint has an issuer. In previous years, this was just a hard-coded string. But this year, I’ve altered the Mint to generate BitPoints where the Issuer is the “CommonName” that is in the cert. You can now use the Mint to get info printed on bitpoints or to verify them. YOU DO NOT NEED YOUR OWN MINT. But, if you’re creating one to experiment, this is how it’s done….