Monday, June 29, 2015

SIM Cards, Silent but deadly

Ever give much thought to the little piece of plastic in your mobile phone? No? That’s mostly because SIM cards are greatly misunderstood and perform their function extremely well. So what is it that I am getting at?

The SIM card is primarily your network identifier, it allows your device to identify and authorize itself on the home network. To do this it makes use of special security keys and algorithms. What you may not have known is that the SIM is the master of the phone, it has to possibility to dictate what the device should do.

The SIM can instruct the device to send an SMS, initiate a call, launch a web-browser, send a USSD, get network statistics including positional/location values and so much more. All this without user intervention or even consent!

Interested? In my proceeding posts I will dig further into how the mechanism around this work and how secure they may be.

Sunday, June 28, 2015

Data-Whaaat? A Simple overview of Databases

I work in an environment where databases (DB) are a way of life yet many people fear the DB. This should not be the case, if you are using Oracle or mySQL the basics remain the same.

A database is a collection of objects not tables!

People immediately think about database as tables of data, this is not the full story. A database is a collection of objects, common object are tables, procedures, constraints, index’s and jobs.

Objects are arranged/grouped in “schemas”!

^–get this and you are a database guru!
A database has one or many schema’s, a schema is normally associated with a user i.e you would log onto DBx.SchemaY where DBx is your main DB name and SchemaY is the name of a user. Within this SchemaY (or user) you have its associated objects(tables, procs ect. as mentioned above)

Each Schema is private!

The owner in possession of the schema password can “grant” other uses(i.e. their schema) access to his objects.

Queries

In 99% of cases anything before the where clause will not affect query speed! it is what comes after the “where” clause that affects speed.

Raspberry PI + 3G Dongle

Oh the headache! I believe after a week of fiddling I’ve final got my head wrapped around this madness.

There are two primary issues that need to be taken care of when using a 3G dongle with a PI
1. A USB modem has schizophrenia!
2. Network connectivity is not “always” available.

So what do I mean “schizophrenia”? Simple, the modem actually wants to a usb cdrom/flash and assumes this personality by default in most cases.
the command

lsusb

will list the current detected device. if it is not correct usb_mode_switch must be used to remind it that it should actually be a modem.

On point 2, sakis3g is a nifty tool to get you connected once you have figured out all of the “required” parameters. Its shortfall is that it never maintains the connection, i.e. if a connection is made and due to bad signal the connection is “lost” sakis3g runs like normal without ever telling you or attempting a reconnect. This is where UMTSkeeper comes in. This small yet feature packed tool maintains connectivity as well as logs network statistics! amongst other features that I have not played with.

Once you have all these 3 components working in harmony you should have a sweet “always” connected PI.