Monthly Archives: August 2013

Zerofill in MySQL databases

I have had this problem for a long time and there are barely, if at all any, resources on the Internet that can aid in resolving this issue. I came across “Zerofilling” when creating my backend MySQL database for brute force attacks. To make it a lot easier to query the primary keys in my database, I felt it necessary to populate the field with nine digits off the bat. Rather than having to wait until there are 99,999,999 entries in my database before the primary key finally utilised all nine digits assigned to the primary key, the zerofill option will fill the a zero in every place the number currently in the primary key doesn’t physically take up. So, instead of having 1, 2, 3…. 56, 57…. 1098, 1099 as your primary keys, you will now have 000001, 000002, 000003…. 000056, 000057…. 001098, 001099. Which in my opinion looks a lot better and allows querying to be tailored to search for six digits, rather than 1 to 6 digits.


The problems with zerofilling fields occurs when initially creating the table. I have encountered numerous posts on the Internet where users are constantly stuck with Syntax errors in their MySQL code with no clue as to why it is happening as you can see above.

I noticed something odd when looking back at the table I created for my dissertation and where the unsigned zerofill was located when I “described” the table.


As you can see, the unsigned zerofill is associated with the data type that is assigned to that particular tuple. By rearranging the previous MySQL statement when I was getting the syntax error, I can now create the table without any errors by using the following statement:

create table Mastah (P_ID int(6) unsigned zerofill primary key auto_increment not null);

This conclusion or workaround, as far as I know, as not been detailed on any forums but you now have the solution to the problem =)



Hindsight is a bitch!

Well, as you may have read in my previous posts, I have finished my university degree. I came out with a 2:1 in Computer Networks and Security which is exactly what I was expecting. What I did not expect was the low grade I got in my final year dissertation project. Obviously, I only have myself to blame, but the choice in my final year topic, Brute Force Attacks on IVR Systems, was mainly picked because my university decided to merge the Computer Networks and the Computer Security degrees together. My argument was that if I was to have “BSc in Computer Networks and Security” on my resumé, I should at least have some experience in security, especially as we had only done one module prior to the final year and one security module during the final year. Just two modules out of 23 modules a very small percentage. Therefore, I decided to base my dissertation on something security orientated. Big mistake! After talking to a lot of my work colleagues, 95% of which went through university, I feel that my focus should have remained on the Networking side of my module, especially as my sandwich year placement was mainly server administration. Due to me doing a server admin role for my placement year and focusing all my efforts on a security dissertation, I am two years out of shape with Cisco networking and a little behind in obtaining my CCNA qualification.

If it was up to me now, I wish I had done something networking related for my dissertation – such as investigating how TCL scripts can aid in voice gateway processing, building a functional router using a Raspberry Pi, converting IPv4 addresses into IPv6, the list could go on really.

One positive thing that came out of my dissertation was my initial foray into Cisco IP Telephony by watching some of the CBT Nugget videos for CCNA Voice which led me onto deciding I should base my dissertation on VoIP. If it wasn’t for this, it is almost certain that I would not have got my current role as a Network Engineer for the company I am currently employed by.

My advice, for any student, is to focus on what you feel is right and not be pushed by your university. I made that mistake, and I feel like I have slightly let me progression down as a Network professional.



Tickling Cisco CME and Voice Gateways

A little while ago, a customer asked if it was possible for a company’s name to appear on the display of their telephones so that they knew who was calling before they answered the phone. For those that do not really know much about telephony, this might sound extremely easy to do – just save the number and then enter the contact’s name. If only it was that simple.

If you have a company with over 3,000 employees, the chances are that these employees will have direct dial numbers which will show up rather than the company’s phone number. Additionally, each phone will need to have every potential phone number for a company saved in its own directory. The permutations of this set up become astronomical when you think that a medium sized company will typically have 3,000 employees. If each of these employees of Company A have a DDI, and Company B also has roughly 3,000 employees, that means that 9,000,000 entries need to be entered on the phones!

One way in which this can be achieved is through the use of TCL scripts, also know as Tickle scripts. The Tickle script runs directly on the Cisco IOS of a router – in this case it will be the voice gateway. The script will run a look up on a .txt or .csv file which will list a company’s name and an associated phone number. Once a call is presented to the voice gateway, the Tickle script will take a hold of the ANI, run a look up on the .txt/.csv file and then send the company’s name directly to the phone.

Obviously, there are downsides to having this script running – especially in a very busy environment. The performance of the router will be considerably affected. This is one thing I mentioned to the customer. Another downside is that the scripts can be extremely flaky, even more so in a very busy environment when there could be hundreds of calls going through the voice gateway every hour.

In the end the customer decided against the script being implemented but my interest in TCL scripts has been piqued, especially as the modifications of what can be displayed on the phones could potentially be limitless – it is also interesting to find out a more efficient way of doing the above without compromising on the routing performance.

Watch this space for developments!


SendKeys Python module

Tedious copy and pasting to make sure the right amount of tabs was pressed to get to a certain link

Tedious copy and pasting to make sure the right amount of tabs was pressed to select a certain link on a webpage.

A few posts ago, I mentioned that I had been tasked with a script that would automate web browsing to a website. I felt, after doing a little bit of research, that the SendKeys module was best suited for the job. The only problem I encountered was when entering the same key command over and over again became extremely tedious as you can see on the right.

The script would load up a webpage, unfortunately using Internet Explorer, accept a security certificate, type in log in details, open a certain page and then activate an online platform that is used by the company I work for. With this script running on another PC to the one it was developed on, I needed to use another module, Py2Exe, to convert the .py file into an executable file.

Despite the length of the script and the repetitive nature of the commands, the script works absolutely perfectly. The pauses need to be planned in advance – especially when loading an application such as Internet Explorer. I obviously will not be posting the script I built due to the fact it does include an internal IP address of a company’s SNMP probe and log in details but I thoroughly recommend the SendKeys module for any automated tasks you encounter.

If you know of a better way in which automated web browsing can be achieved, I am extremely happy to hear any ideas you may have =)


The Apprentice 2014

Today, I have started my application to be on BBC’s The Appentice 2014. I do not want to disclose too much information as I really do not know if I have the time to complete the application but I have had an idea of a business that I wish to start up but the initial start-up costs are quite astronomical. I will obviously keep you up to date if I actually make it any further in the process. Here’s to remaining optimistic!