• Hacker's Edge soon to be in Closed Beta

    Posted on Friday, May 23rd, 2014

    Does anyone recall a project I began way back in 2012 called Hacker's Edge? Originally, I was building the entire project in Django, but earlier this year after creating an ncurses based website, it got me interested in trying to build Hacker's Edge using a Python console and ncurses.

    So, for the past couple of months I have been hard at work getting this new version through the alpha stage of development. The alpha is currently publicly available for anyone to jump in and play around. This new version is no longer limited by web technologies and is only limited to what I can do in Python. At the moment, I am in the process of expanding the simple-cpu I built to create both the Black Hat and White Hat tools which will be used to hack other hosts in the game, and to better protect hosts in the game respectively. My simple-cpu has come a very long way since I first built it, and now supports a full 16-bit address space, x86-like assembly instructions, and much more. I hope to make a tutorial on using the simulator soon in stand-alone projects.

    Other implemented features are a fully working mail server system, with support for independent in-game mail server. The mail system itself uses the standard mbox API for mail storage and retrieval. A DNS system is also in place, and a host can choose which host is their DNS server. So you can imagine if a player manages to hijack a DNS server in-game the havoc that could occur. Each independent host runs it's own virtual machine and has it's own memory space mapped in memory. This allows for hosts to run their own KERNELs and other programs completely independent from the other hosts in the game world. The KERNEL can be written entirely by a player if they so choose to either better prepare their hosts from attack, or to prepare their host to attack other hosts better. There is also the possibility of players creating in-game rootkits to attack other hosts and infect them. Since the hacking and white hat in-game tools will run entirely within the virtual machine, this enables players to create torjan horses to infect other hosts easily. Since most of the in-game tools will cost in-game currency to purchase, I am assuming that some players would take advantage of this and pirate the in-game tools.

    Furthermore, the following in-game player services will also be hackable by players, if they are skilled enough to do so:

    • In-game banking services, so players can technically steal currency from other players.
    • In-game ranking and experience system, so players can try to forge themselves a better ranking or increase their experience points to level up quicker.
    • In-game shops which will sell the in-game tools, these shops may also be hacked to obtain said software for no charge.

    To make the programming/coding element more accessible to players who may not have experience in Assembly-like languages, I am also developing a high-level language which compiles into Assembly, which can then be edited and then assembled into binary.

    The project still uses Django for the front-end, and for player account management. Here is the typical workflow for a player:

    1. Real user browsers to Django website, and either signs up or logs in.
    2. Real user then accesses their player management page, and proceed to create a new player character.
    3. The Django app then registers the player character in the Hacker's Edge world, and creates them their initial host.
    4. Real user now connects to either telnet or presses Play.
    5. Real user then logs in using their Player Character login credentials created via Django.
    6. Player hopefully enjoys themselves in the virtual online hacking simulation game.

    Django still plays a critical part in this project, as it's the central hub to manage a user's player characters. This enables a user to easily have multiple player characters and switch between them at will, or play against themselves in two terminal windows. Furthermore, I am also wanting to integrate the Out-of-Character mode with the web presence. This will enable players to easily access both the forums and help center, and post questions and socialize. In Out-of-Character mode, the player character is never revealed to other users, so one can post to the forum and socialize, not knowing if you are actually getting along with a rival in-game. There is definitely a separation between in-game persona and your real-world self. The only players whom will know your real-world identity will of course be server moderators, whom are there to give a helping hand and not attack your in-game hosts or real-life self.

    Which brings me to my next subject, is that I will be looking for people who would be willing to help out with moderation. You will have a special account which will allow you to perform tasks which a regular user or player would not otherwise be-able to perform. The following special powers will be provided to those who assist in moderating:

    • Access to post into staff-only forum sections.
    • Access to all the undocumented VM API calls, to assist with building specific in-game tools.
    • Ability to see the real-world Django username of an in-game player.
    • Access to any and all in-game hosts regardless of ACL table, used to assist other players.
    • Early access to KERNEL.SYS and other critical VM source code, mainly to assist in testing and debugging.
    • Access to staff-only hosts, and admin access to many in-game hosts for moderation purposes.

    I am planning for Hacker's Edge to enter Closed Beta by the end of May, or mid-June. For those who already registered on the website a couple years back, your accounts are still there and active. Once the closed beta begins, I will be choosing from the pool of users, and sending out an email notification to them to inform them of the new Hacker's Edge experience. During closed beta, the following will be available, and be tested during the closed beta:

    • In-game Black Hat and White Hat tools.
    • In game currency, and banking system.
    • In-game experience and ranking systems.
    • Missions, which will provide the experience points, and currency to the players.
    • And more, which I cannot think of right now.

    Before the alpha ends, there will be a basic test mission given to anybody who enters the alpha game in the form of an in-game email message, with instructions on what should be done. This will be there to test out the mission mechanics before going beta.

  • PyCon 2014 Montreal

    Posted on Tuesday, April 8th, 2014

    I will be attending the PyCon in Montreal this week, and I look forward to many of the talks and blogging about as much as I possibly can while I am there. If anybody whom follows Python Diary is attending, you should be-able to find me there.

    Looking forward to all the excellent talks this year, and this is my very first PyCon, so you can just see how excited I must be!

    Everything PyCon will be properly tagged on the blog, so just bookmark that tag for the latest news directly from PyCon 2014.

  • Website made entirely using ncurses!

    Posted on Saturday, February 1st, 2014

    As an interesting proof-of-concept idea, I built an entire website, my personal profile page using nothing more than ncurses and a vt100 terminal emulator! I recently unleashed it out into the public, and there was lots of positive and nostalgic responses. This is only the first iteration of the site, and more features will be coming soon.

    The result was unexpectedly usable! Although hosting such a site is only ideal for low traffic websites as the server resources can really be used up by each forked Python process. How it works is simpler than you might imagine, it is merely a standard Python console application running directly in the browser! To obtain the vt100 emulation and access to the Python application, I used a popular remote shell tool called Shellinabox. Shellinabox is normally used to provide a Linux admin with a remote login shell via their browser to administer the server, just as he/she would while using SSH. Shellinabox can actually run any terminal program you tell it to run, and this gave birth to this idea. I first tested it by running Lynx in a web browser directly, so accessing a page would immediately display the popular Lynx browser. Amazingly, the mouse was also able to control Lynx! So... I thought, if I could make my own ncurses application which can also use a mouse, I could build an entire website using just ncurses!

    You can view it live by clicking on my name below my photo in the right bar of this website. There is also an alternative telnet interface for those whom don't have a graphical browser handy, as vt100 emulation requires a decent JavaScript engine.

    This is more of a proof-of-concept, as I am planning on building this idea further with a complete recode of my Hacker's Edge massively multiplayer online game. I had some difficulties making Hacker's Edge what I wanted it to be, and I believe turning it into a full Python console application with some ncurses components might be what I need to really make this game take off. The game will end up featuring both a web-based vt100 terminal emulation for those without a compatible Telnet client, and telnet connection support. The new idea will be to add a better network simulator, many console applications, and a fake assembly language to built fake viruses and malware to create fake botnets. Think of it as a Grand Theft Auto for CyberCrime! As you can see from my Bitbucket page, I have been creating some specialized applications, such as the CPU simulator, which will make it's way into Hacker's Edge.

  • Kevin Veroneau Consulting demo video

    Posted on Tuesday, December 10th, 2013

    In this video you can see my Consulting Services website in action to see the benefits of working with me over other independent Django contractor. The tools were of course built using Django, and have been used for over a year now successfully:

  • Have Django respond to Email in real-time

    Posted on Thursday, August 1st, 2013

    It's been a long time since I wrote a new article on Python Diary, and I do apologize for the lack of content recently. Hopefully this interesting article will make up for that.

    Have you ever wanted Django to parse an incoming Email in real-time as soon as it comes into your server? Look no further than this handy solution here. In order to use this solution, you will need to configure a local Postfix server, it doesn't need to be-able to send outbound email, only receive new messages for your domain. Although being able to send messages will make it easier to reply back to the user's whom are sending the server messages.

    You will first need to create a short Python script which Postfix will deliver the actual message to:

    import sys
    import urllib2
    req = urllib2.Request(url='[Django URL]',
    f = urllib2.urlopen(req)

    This script submits the entire message unmodified directly to any web address you give the script, preferably a Django URL. Notice that I am not using the standard form encoding, as there is no need to add additional overhead when all we want to do is have Django process an entire message. The main reason why this script exists, is because this script will run normally as nobody:nogroup, so it will not be-able to easily talk with your local Django app directly using say, a management script. Sending the data directly over HTTP to the Django instance is simple and should have very little overhead and integrate easily with existing solutions.

    from django.views.decorators.csrf import csrf_exempt
    from email import message_from_string
    from django.http import HttpResponse
    def mail_parse(req):
      msg = message_from_string(req.body)
      # Process data from msg here!
      return HttpResponse("OK", content_type="text/plain")

    Here is the Django view which will receive the raw message data and parse it. You should read the Python documentation on the subject to learn how to extract the headers, body, and attachments you want to parse. Finally, here is what you should place in your /etc/aliases:

    api:         |/[path to script].py

    Be sure to run newaliases afterwards to rebuild the hash table. This alias here makes anything api@[domain] submit to your Django site. Enjoy!

  • Django bootstrap theme is ready!

    Posted on Saturday, May 25th, 2013

    You can download a project template for this now:

    It's finally ready for developer consumption, my Django bootstrap theme Django app. With this super simple app in your Django project, you can easily apply a site-wide Bootstrap theme in a matter of minutes. Here's an example base.html you would use in your project's templates directory:

    {% extends 'bootstrap_theme/starter.html' %}
    {% block title %}Bootstrap Django site{% endblock %}
    {% block branding %}Django Project{% endblock %}
    {% block content %}
    Yes Folks, this is how easy it is to implement bootstrap in Django now.  Be sure to look at the other templates available to see what <b>blocks</b> you can override.
    {% endblock %}

    Be sure to add bootstrap_theme to your INSTALLED_APPS, and this will work like a charm. Here is a list of available base templates you can extend:

    This is the main template which the ones below extend to create the Bootstrap experience.
    This is the exact starter template from the Bootstrap documentation, it's the most basic and easiest to extend.
    Similar to starter, except it allows users to sign in and out, and has a left navigation bar.
    The marketing template directly from the bootstrap examples page tailored to work with Django.
    From the bootstrap example page, another version of a marketing page you can try out.
    Yet another marketing page example, also from the bootstrap examples page.
    The bootstrap carousel example made for Django, the bonus is that the Carousel is driven from the database, so it's easy to add and edit the big Carousel banner.

    Wait, there's more... There's a large amount of templatetags at your disposal as well in the bootstrap library which you can load into any template you need it in. Here's what's included:

    buttonlink url icon
    You can create bootstrap themed buttons with this tag.
    emphasis filter
    This filter will add special styling to the text, such as muted which is the default, or anything in the text- CSS components.
    abbrev filter
    This handy filter will create an abbreviation text.
    yesnoicon filter
    Depending if the value is True or False a different icon is displayed.
    ratingicon filter
    This super handy filter will create a specific amount of star icons depending on the value.
    link filter
    Pass in any model object which has a get_absolute_url and it will automatically make it click-able.
    carousel group_name
    This is used to display a database driven Carousel. The group_name parameter is which group in the database model to display for this instance.
    navbar_gradient first_color last_color
    This super handy tag will automatically generate the required CSS style needed for the navbar gradient.
    modal title modal_id form_action
    This block tag is used to generate a modal dialog box, the last 2 options are optional. The first is the title of the dialog box, the second is the unique div ID for the modal, and the last one is the URL which the form inside the modal will be posted to, if the user saves the changes.
    icon slug
    This is used to display bootstrap icons easily.
    modal_button title modal_id icon
    This is used to generate the required A tag to display a modal dialog box generated above. The first option is what to display on the button itself, the second is the div ID chosen, and the last one is an icon slug to place on the button. The last two options are optional and have reasonable defaults.

    Don't leave yet, there's still one last thing... An include-able template which can display a Django form very elegantly in bootstrap! Finally you can make your Django generated forms look great and functional with very little effort. Here's an example contact form to get you started:

              <form action="{% url 'contact-form' %}" method="post">{% csrf_token %}
                  <legend>Contact form</legend>
                  {% include "bootstrap_form.html" %}
                  <button type="submit" class="btn btn-primary">Send Message</button>

    Wow, that's a lot to take in, in the next release I will be adding a bunch of ready made templates for django-registration so that you can get a new Django website up and running in a matter of hours.

  • Looking for advertising proposals

    Posted on Sunday, May 19th, 2013

    As some of you may have noticed, the AdSense bar no longer exists on my blog, this is due to Google recently revoking my AdSense account, I am quite sure it is in regards to mentioning it on a page. Currently users who have an account are able to opt'd out of either being tracked by Analytics or have no ads served to them. I will be removing this feature soon, as I am planning on self-hosting ads from prospect publishers. If you have a Python or Django related project which you would like to adverse on this blog, please contact me. Having a way to fund this website will allow me to publish more quality articles and tutorials. When a new article is posted, this blog receives over 1,000 hits in that single day. These are 1,000 prospect users which use Python and maybe Django who will see your advertisement. These can also be users who are just learning Python, so books and courses are also welcome.

    Currently the ad serving system has yet to be implemented, so at this time I am only asking prospect advertisers to provide me with a proposal on how the ads should be served to users and costs they might be willing to pay. For the record this blog has been online for well over a year now and receives many returning users due to the quality of the content which is provided. This website is also much more than a blog, as it has other features which bring users back for more.

    Thank you for your time in reading this.

  • DVD Collection source code now available

    Posted on Sunday, May 19th, 2013

    For those who were wanting a copy of the DVD Collection software made in Python, I have now open sourced it and it is live on BitBucket!

    DVD Collection software

  • Python Script to encode Django templates

    Posted on Sunday, May 19th, 2013

    Do you need to display raw Django template code in your Django <1.4 project? Look no further than this script! It's rather crude, but gets the job done. I haven't yet updated a few Django websites to Django 1.5, which has a new template tag to do this for you, so I created this script to use in legacy Django sites, and it works like a charm!

    import sys
      filename = sys.argv[1]
    except IndexError:
      print "This command needs exactly 1 parameter!"
    data = open(filename, 'r').read()
    data = data.replace('{%', '{! templatetag openblock !}').replace('%}', '{! templatetag closeblock !}')
    data = data.replace('{{', '{% templatetag openvariable %}').replace('}}', '{% templatetag closevariable %}')
    print data.replace('{!', '{%').replace('!}', '%}')

    You should Pygments to highlight the syntax like I do on this blog of course. If you are using Django 1.5 or greater, you should use the verbatim template tag over this.

  • Building a set of indie community focused Django apps

    Posted on Friday, May 10th, 2013

    Today I have just started work on an set of Django pluggable apps which can either be used independently or as a whole. The main focus is to provide Indie developers with an entire website framework which can be used to host a database of indie downloads, manage assets, support developer blogs and vlogs, and much more. I am building this as an open source project from the start, and it is hosted on BitBucket with the discussion hosted on Uarica.

    The first prototype of the website is done for anyone that's curious on how it currently looks, it can be accessed here.

    Uarica Project page
    BitBucket page

  • A birthday present for a friend made in Django

    Posted on Friday, April 19th, 2013

    I have a friend whom is a huge, and I really mean huge movie buff. He has the largest movie collection that I know of, and one the largest TVs I have seen. He was previously managing his collection using another website someone built, which I think is personally not very well done and my friend deserves much better!

    First I used the standard Python XML libraries to parse and extract all the movies he has on the old website, as I didn't want to re-enter all those movies, and I'm sure he wouldn't either. After it was all extracted and I was able to parse it easily through Python, I created the Django project and models for which the movie titles will live in. I created the first part of the website, including the importing of all his movies in just a mere 4.5 hours(according to my Subversion timestamp). I was truly amazed at what a full featured web application I could create in such little time, I could barely sleep last night as I wanted to continue work and add new features.

    Now, the website is nearing completion and I thought I'd share it here with all my loyal readers. This web application has full IMDb integration, which still has a few bugs here and there that need to be ironed out. I am currently debating if I should open source this creation or not...

    You can check this application at

  • Will be taking another look at web2py

    Posted on Wednesday, April 10th, 2013

    My last encounter with Web2py was with version 2.0, this was back in October of 2012, of which I have a review for that version. Reviewing their changelog, I can see that this framework has evolved a great amount in just a few short months. There were many features which I praised about the framework, but there were still some things holding me back from using it over Django for my next project. So, with that, I am planning on diving back into web2py, and should have a new review up with the latest version. I have a project, I am thinking I may convert over to web2py and see how that goes. If development becomes quicker, then I will consider web2py for future projects as well.

    If you haven't already, I would recommend taking a look at web2py and see what it can offer your project. Both Django and web2py are similar, but at the same time they are very different. They both took the Ruby on Rails idea in their own direction. One thing to note, is that apps in web2py are not like apps in Django. This also makes working with web2py a little difficult at times, as it's not easy for apps to talk to each other, not as easy as it is in Django that is. However, in web2py, it's not an apps purpose to extend the frameworks functionality, it is the job of a plugin. That being said, web2py has grown a large amount since I last used it, so all my hardships I experienced last time around might be resolved.

  • Django 1.5 review is up

    Posted on Sunday, April 7th, 2013

    For those interested in Django to see if it's right for your next project, or if you are upgrading from an earlier version, this review is for you.

  • Source code released for my Django PIM suite

    Posted on Friday, April 5th, 2013

    Not sure how many of you were following my previous blog post about a bunch of Django apps I built for my own personal use. I have finally released the source code into BitBucket. Here's a short copy and paste recap of what you can find:

    PCBank AKA myFinance
    This is a personal budgeting system which I have created, it has matured a lot throughout the past few months. I originally created it in October of 2011, as using a spreadsheet to keep track of all my expenses grew tedious. It can also manage roommates, and split bills accordingly. This is my most used app out of all of the apps I created. It also has an RSS and JSON interface for third party applications to fetch data. I use the RSS for a Live Bookmark to easily access all my online banking websites from my browser toolbar. I use the JSON interface with a mobile app I created so that I can easily check my bank balances on the go without needing to actually sign into my online bank website on an insecure wireless network.
    This app was created in recent months to keep track of my many projects I do. It keeps track of individual projects, which I can jot down notes about each one. I can create goals under each project and assign a due date for them. This makes seeing all my workload and upcoming goals easy to browse, and add personal notes to.
    Sort of an extension to myProjects above, as it keeps track of my various servers I run and operate. It sorts the servers by hosting provider. Then under each server, I can list the various applications which the server runs. Makes it easy to know where everything is located in my infrastructure.
    django-pim Source code

    Let me know what you think, all of these use Bootstrap for theming and some of them have APIs such as iCalendar, RSS, and JSON. PCBank was developed a very long ago, and some of the programming practices in there need some updating. I have included an svnlog.txt file in each app's directory so you can see just how each project grow since 2011. Yes, you heard me... 2011 was one of the early commits.

  • Using Pyjamas with Bootstrap

    Posted on Thursday, April 4th, 2013

    For a just for fun experiment, I attempted to re-create the standard Bootstrap, from Twitter theme using Pyjamas. It turned out pretty good too. Here is the source code to compile to JavaScript:

    from pyjamas.ui.RootPanel import RootPanel
    from pyjamas.ui.Button import Button
    from pyjamas import DOM
    from pyjamas.ui.Hyperlink import Hyperlink
    from pyjamas.ui.SimplePanel import SimplePanel
    from pyjamas.ui.ComplexPanel import ComplexPanel
    from pyjamas.ui.FlexTable import FlexTable
    class CustomPanel(ComplexPanel):
        def __init__(self, Element=None, **kwargs):
            if Element is None:
                Element = DOM.createDiv()
            ComplexPanel.__init__(self, **kwargs)
    class NavItems(CustomPanel):
        def __init__(self, nav_list=None, **kwargs):
            CustomPanel.__init__(self, Element=DOM.createElement("ul"))
            self.items = []
            if nav_list == None:
                nav_list = {'Home': self.onClick, 'About': self.onClick, 'Contact': self.onClick}
            for item in nav_list:
                tmp = Hyperlink(item, Element=DOM.createElement("li"))
            for item in self.items:
        def clearActive(self):
            for item in self.items:
        def onClick(self, sender):
        def setActive(self, item_id):
    class NavBar(SimplePanel):
        def __init__(self, brand="Project name", nav=None, **kwargs):
            SimplePanel.__init__(self, **kwargs)
            self.container = CustomPanel()
            self.brand = Hyperlink(brand)
            if nav == None:
                self.nav = NavItems()
            elif isinstance(nav, dict):
                self.nav = NavItems(nav)
        def setBrand(self, text):
        def setActive(self, item):
    navbar = NavBar()
    state = 0
    def alter_brand(sender):
        global state
        if state == 0:
            state = 1
            state = 0
    btn = Button("Hello Bootstrap!", alter_brand)
    btn.setStyleName("btn btn-primary")
    container = CustomPanel()
    tbl = FlexTable()
    tbl.setText(0, 0, "Hello World!")
    tbl.setText(1,0,"Python rocks")
    tbl.setText(0,1,"Coding in my Pyjamas is awesome!")
    tbl.setText(1,1,"Bootstrap works with Pyjamas!")

    This code requires the latest version of Pyjamas, version 0.8.1a as of this writing. It won't work in 0.8, which I'm curious on why. You can see a full working demo here.

About Me

My Photo
Names Kevin, hugely into UNIX technologies, not just Linux. I've dabbled with the demons, played with the Sun, and now with the Penguins.

Kevin Veroneau Consulting Services
Do you require the services of a Django contractor? Do you need both a website and hosting services? Perhaps I can help.

This Month

If you like what you read, please consider donating to help with hosting costs, and to fund future books to review.

Python Powered | © 2012-2013 Kevin Veroneau