A Software Technologist's Blog (Wanna Email Me?)

I have just written a short demo on how to support multi-tenant database for Ninja Web Framework.
The full source code can be downloaded from github.

Features of this demo

  • Support multi-tenant databases using Ninja web framework. Majority of the existing Ninja web framework documentation for database access is still applicable; only small amount of changes is required to provide tenant database information, and to bind the EntityManager provider to each tenant at runtime.
  • Existing database migration scripts can be used to migrate database changes to all tenant databases.
  • Use HikariCP connection pool in Ninja web framework.

Getting tklbam to install on Ubuntu 14.04

January 26, 2015 By miketeo

I use tklbam from TurnKeyLinux to backup a number of Linux nodes on DigtalOcean and Amazon AWS.
However, tklbam support was broken on Ubtuntu 14.04 where you can’t install the tklbam software.

Below is my workaround to get tklbam to install on Ubuntu 14.04.

Read the rest of this entry »

I have noticed that there are quite a few requests for a network scanning application to search for Windows shared folders.
I thought this will be an interesting implementation for pysmb (a pure Python implementation of the SMB1 and SMB2 protocol that supports the Windows file sharing functionality) as well as for developers who are learning to use pysmb for their applications.

You will need Python 2.4 and above, and have installed pyasn1 and pysmb. Next, download the ScanNetworkForSMB.py script. Then, run the script with 1 IP address to scan for a single machine, or a start/end IP address pair to scan a range of IP addresses. If the scanned machine has its Windows sharing port (port 137) active, the script will print out its IP address together with the names associated with this machine.

Sample output

$bash> python ScanNetworkForSMB.py
Beginning scanning 255 IP addresses... --> CETUS WORKGROUP --> I7PC WORKGROUP

Query timeout. No replies from 253 IP addresses

smb:// URL Support in pysmb

May 4, 2012 By miketeo

Starting from pysmb version 1.0.4, application developers can utilize smb:// URLs with pysmb and urllib2 python package. One benefit from this is that if your existing application already supports downloads via other protocols like http or ftp, you can “upgrade” your application to support downloads from Windows shared folders or from Samba servers by making small modifications to your existing code.

pysmb tries to follow the smb URL scheme proposed in the IETF draft which is not much different from other standard URL schemes like http and ftp. In short, your smb URL should follow this format – smb://[<user>:<password>@]<host>[:<port>][/<share>/<path>/<filename>]

Read the rest of this entry »

pysmb 1.0.0 Released!

December 25, 2011 By miketeo

About 10 years ago, I have released the first version of pysmb. Since then, Microsoft Windows has made significant changes to the NTLM authentication protocol which causes pysmb to become incompatible with Windows Vista and Windows 7 machines.

Now, with the release of pysmb 1.0.0, you can write Python applications to transfer files on shared folders on Windows XP, Windows Vista and Windows 7, as well as on Unix machines running Samba. pysmb 1.0.0 remains faithful to its clause that it will remain a pure Python SMB/CIFS module without any need for binary compilation. For this to be possible, it has utilized other pure Python modules such as pyDES, MD4 and pyasn1.

In addition to its new compatibilities with the recent Windows OS, pysmb has also been rewritten to support other frameworks. At the moment, a Twisted NetBIOS and SMB/CIFS protocol implementation has been included with pysmb 1.0.0 sources. Please refer to the documentation in the sources for more details.

For more details on pysmb 1.0.0, please go to the pysmb project page to download it, or you can also run: “easy_install pysmb” to install it on your machine.