2/04/2016

Querying MySQL with Node.js

Querying MySQL with Node.js

Node.js is slowly making inroads in normal web development routines. There are a number of modules available for Node to work with almost any requirement you imagine, although the stability of many of them is open to question. Although I’ll surely not switch my development practices to Node from PHP any time soon; for many tasks Node would be a perfect match. For example for one site I use a CRON job to regularly sync remote data to MySQL. Node with its support for asynchronous requests may possibly help me make the data syncing faster.

The following post is a quick look at the MySQL module for Node. There are currently two modules for connecting with MySQL – db-mysql and node-mysql. In this post we will be using node-mysql. Unlike db-mysql, you don’t need to install specialized MySQL client software to work with node-mysql.
I’m assuming you have Node.js installed on your system. If not you can quickly get started at the Node.js site.

Installing node-mysql

The latest version is a alpha release, however despite the fact that it is tagged as ‘alpha’ this is the recommended version to use for new developments as there are many changes to the core API as and these will be carried on to the future versions. Using npm is the best way to install the module.
npm install mysql@2.0.0-alpha3
Once the alpha version becomes stable you will need to download using the normal module name, but till then use the above command.
npm install mysql

Running your first MySQL query

We will be using a WordPress database as an example to grab post titles from the ‘wp_posts’ table. The complete code is shown below.
var mysql = require('mysql');
 
var connection = mysql.createConnection(
    {
      host     : 'localhost',
      user     : 'your-username',
      password : 'your-password',
      database : 'wordpress',
    }
);
 
connection.connect();
 
var queryString = 'SELECT * FROM wp_posts';
 
connection.query(queryString, function(err, rows, fields) {
    if (err) throw err;
 
    for (var i in rows) {
        console.log('Post Titles: ', rows[i].post_title);
    }
});
 
connection.end();
You could also pass the connection options as one single string rather than as an object.
var connection = mysql.createConnection('mysql://user:pass@host/wordpress');
The query results are returned as an array of objects with each row representing a single object in the array. So we need to iterate through the array to print all post titles. The object for a single row is shown below.
{ ID: '21',
  post_author: '1',
  post_date: Fri Feb 27 2009 03:44:07 GMT+0530 (India Standard Time),
  post_date_gmt: Fri Feb 27 2009 03:44:07 GMT+0530 (India Standard Time),
  post_content: 'sample content',
  post_title: 'web scrape',
  post_category: 0,
  post_excerpt: '',
  post_status: 'publish',
  comment_status: 'open',
  ping_status: 'open',
  post_password: '',
  post_name: 'web-scrape',
  to_ping: '',
  pinged: '',
  post_modified: Fri Feb 27 2009 03:44:07 GMT+0530 (India Standard Time),
  post_modified_gmt: Fri Feb 27 2009 03:44:07 GMT+0530 (India Standard Time),
  post_content_filtered: '',
  post_parent: '0',
  guid: 'http://localhost/wp/wordpress/?p=21',
  menu_order: 0,
  post_type: 'post',
  post_mime_type: '',
  comment_count: '0' },
Where we can access each field (post_title shown here) as below.
rows[i].post_title
The ‘query’ method of the connection object requires a callback function which will be executed whenever either one of the three events fires – error, fields, results, here denoted by the parameters errfields and rows respectively. Here the callback is registered as a anonymous function.
The above code with the callback defined as an anonymous function will return the results as a single data stream. However if there are a large number of rows in the table and you want to process each row as it arrives rather then wating to collect all the rows you can change the code to the following.
var mysql = require('mysql');
 
var connection = mysql.createConnection(
    {
      host     : 'localhost',
      user     : 'your-username',
      password : 'your-password',
      database : 'wordpress',
    }
);
 
connection.connect();
 
var query = connection.query('SELECT * FROM wp_posts');
 
query.on('error', function(err) {
    throw err;
});
 
query.on('fields', function(fields) {
    console.log(fields);
});
 
query.on('result', function(row) {
    console.log(row.post_title);
});
 
connection.end();
Note that each row is written to the console as it arrives. If you need to process the row for some purpose before getting the next row, you will have to pause the query and resume after some processing is done. But beware it is showing inconsistent results with some errors thrown in on my side.
query.on('result', function(row) {
    connection.pause();
    // Do some more processing on the row
    console.log(row);
    connection.resume();
});

Escaping query values

To avoid SQL injection you can escape user data before running the query. There are two methods. One using the ? operator is shown below.
.
.
connection.connect();
 
var key = '_edit_lock'; 
var queryString = 'SELECT * FROM wp_postmeta WHERE meta_key = ?';
 
connection.query(queryString, [key], function(err, rows, fields) {
    if (err) throw err;
 
    for (var i in rows) {
        console.log(rows[i]);
    }
});
 
connection.end();
The other using the connection.escape() method is given below.
.
.
connection.connect();
 
var key = '_edit_lock'; 
var queryString = 'SELECT * FROM wp_postmeta WHERE meta_key = ' + 
                   connection.escape(key);
 
connection.query(queryString, function(err, rows, fields) {
    if (err) throw err;
 
    for (var i in rows) {
        console.log(rows[i]);
    }
});

Closing of connections

Your connection to the MySQL server may close unexpectedly due to an error or you may close it explicitly. If it closes due to some error then you will need to handle that and reopen it if required. The 'close' event is fired when a connection is closed, so we need to handle that.
connection.on('close', function(err) {
  if (err) {
    // Oops! Unexpected closing of connection, lets reconnect back.
    connection = mysql.createConnection(connection.config);
  } else {
    console.log('Connection closed normally.');
  }
});
The connection.config object holds the current connections details which you can use to reconnect back to the MySQL server. Printing the object to the console returns the following.
{ host: 'localhost',
  port: 3306,
  socketPath: undefined,
  user: 'sam',
  password: 'some-pass',
  database: 'wordpress',
  insecureAuth: false,
  debug: undefined,
  typeCast: true,
  maxPacketSize: 0,
  charsetNumber: 33,
  clientFlags: 193487 }

Production usage

So will I be using Node.js for my next project? Absolutely not! The whole Node ecosytem is still standing on shifting sands – Module API’s are changing faster than I can complete a single project. So until the entire thing stabilizes and we have good support tools to make Node development easier, I’d stick to my old and trusted languages. Even then, I’d be using Node.js for specific tasks along with PHP rather than building entire sites using Node alone. But as it usually happens in tech, my last sentence may sound reserved and cautious 3 years from now when probably we will be building entire sites using Node.js.

CREDIT: http://www.codediesel.com/nodejs/querying-mysql-with-node-js/

1/31/2016

DRTBox สอดแนมจากฟากฟ้า

ตำรวจ US ใช้เครื่องบินติด Dirtbox แอบดักฟังชาวเมืองโทรศัพท์

สถานีตำรวจประจำเมืองอนาไฮม์ รัฐแคลิฟอเนียร์ สหรัฐฯ ออกมายอมรับว่าพวกเขาได้ใช้เทคโนโลโลยีการเฝ้าระวังโทรศัพท์มือถือ (Cell Phone Surveillance Technology) แบบพิเศษที่เรียกว่า DRTBox ซึ่งเป็นเทคโนโลยี Dirtbox ระดับสูง นำมาติดกับเครื่องบินแล้วใช้ดักฟังและติดตามการใช้งานโทรศัพท์มือถือของชาวเมือง

DRTBox สอดแนมจากฟากฟ้า

DRTBox เป็นเทคโนโลยีเฝ้าระวังทางการทหารที่รวมคุณสมบัติของ Dirtbox* และ Stringray** เข้าด้วยกัน ช่วยให้ตำรวจสามารถติดตามและดักจับการใช้งานโทรศัพท์มือถือ รวมทั้งสามารถแอบฟังบทสนทนา อีเมล และข้อความที่ส่งหากันได้ นอกจากนี้ DRTBox ยังสามารถแกะรหัสของการสนทนาได้หลายร้อยเครื่องพร้อมกัน เป็นฟีเจอร์ที่มีไว้เพื่อติดตามอาชญากร และแน่นอน ประชาชนทั่วไปด้วยเช่นกัน
* Dirtbox คือ อุปกรณ์ที่ปลอมตัวเป็นเสารับส่งสัญญาณโทรศัพท์มือถือเพื่อแอบดักจับข้อมูลการใช้โทรศัพท์มือถือ
dirtbox_1
** Stringray เป็นเครื่องมือสำหรับสอดแนมโทรศัพท์มือถืสามารถติดตาม ตรวจสอบตำแหน่ง และดักจับทราฟฟิคการใช้โทรศัพท์มือถือผ่านหมายเลขเบอร์โทรที่ต้องการได้
stringray_1

DRTBox ทำงานอย่างไร

DRTBox สามารถรับข้อมูลโทรศัพท์มือถือตั้งแต่หลักสิบไปจนถึงหลักพนเครื่องในการบินเที่ยวหนึ่ง ถูกใช้งานเพื่อจุดประสงค์ในการระบุตัวอาชญากรและผู้ต้องสงสัย อย่างไรก็ตาม ข้อมูลการใช้โทรศัพท์มือถือของชาวเมืองก็จะถูกเก็บรวบรวมไว้ด้วยเช่นกัน
โดยปกติแล้ว โทรศัพท์มือถือจะเชื่อมต่อกับเสาสัญญาณโทรศัพท์ที่ใกล้และให้กำลังแรงที่สุด DRTBox จึงปลอมตัวเป็นเสาสัญญาณเพื่อหลอกให้เหยื่อเชื่อมต่อเมื่อเข้าถึงระยะ เพื่อติดตามและดักฟังการใช้โทรศัพท์มือถือผ่านการโจมตีแบบMan-in-the-Middle ที่ตรวจจับได้ยาก นอกจากนี้ DRTBox ยังทำการบันทึกหมายเลขอุปกรณ์ฮาร์ดแวร์ของโทรศัพท์ หรือก็คือหมายเลข IMEI ไว้ด้วยเช่นกัน
drtbox_1

DRTBox แคร็กการเข้ารหัสการสื่อสารได้อย่างไร

ปกติการรับส่งข้อมูลผ่านระบบ GSM, 2G, 3G, 4G และ LTE จะมีการเข้ารหัสหลากหลายรูปแบบเพื่อปกป้องความเป็นส่วนบุคคลของการสื่อสารผ่านทางโทรศัพท์ อย่างไรก็ตาม GSM เป็นเทคโนโลยีเก่าแก่ มีอายุนานกว่า 30 ปี จึงเป็นเรื่องง่ายมากที่จะแคร็ก ในขณะที่ 3G, 4G และ LTE มีระบบการเข้ารหัสที่แข็งแกร่ง การจะแคร็กเพื่อถอดรหัสข้อมูลจึงไม่ใช่เรื่องง่าย
แต่ระบบ 3G/4G ก็มีช่องโหว่ คือ ระบบจะเปลี่ยนไปใช้การเชื่อมต่อแบบ GSM เมื่อระบบเครือข่ายเกิดการขัดข้อง เรียกว่าเป็นฟีเจอร์ Fallback เพื่อให้ผู้ใช้ยังคงใช้งานโทรศัพท์ได้อยู่ ซึ่งด้วยช่องโหว่นี้เอง DRTBox จึงได้ทำการกวนสัญญาณ 3G/4G เพื่อบังคับให้โทรศัพท์ในรัศมีเปลี่ยนไปใช้ GSM แล้วทำการดักฟังข้อมูลแทน ซึ่งการถอดรหัสก็จะไม่เป็นปัญหาอีกต่อไป
ผลลัพธ์ที่ได้คือ ตำรวจสามารถระบุชัดได้ว่า ใครโทรศัพท์หาใคร จากที่ไหน ไปที่ไหน เวลาเท่าไหร่ ได้อย่างถูกต้อง พร้อมทั้งสามาถรระบุตำแหน่งตัวตนของผู้ใช้ในรัศมีได้อย่างแม่นยำ
ที่มาและเครดิตรูปภาพ: http://thehackernews.com/2016/01/drtbox-cellphone-interception.html

1/09/2016

SmartDeviceLink : Rise of the Autonomous


The open source version of Ford AppLink, called SmartDeviceLink or SDL, is being adopted by Toyota Motor Corporation as well as suppliers QNX and UIEvolution; PSA Peugeot Citroen, Honda, Subaru and Mazda are considering following suit.

This shared technology will allow consumers to personalize their in-vehicle app experiences, automakers to accelerate smartphone app integration while retaining their own brand identities and app developers to innovate and deliver unique brand experiences.


11/29/2015

What about UPnP Networking

UPnP history

Universal Plug and Play (UPnP) saw the light in the late 1990s. Networks were just becoming popular. Several vendors were coming up with solutions to make networks  and networked applications easier to manage. One early attempt was Sun's JINI. As a reaction to JINI (or so I was told) Microsoft came with UPnP. The first Microsoft products to ship with UPnP were Windows Millenium Edition and Windows XP. Since then there have been a lot of programs and devices that depend on UPnP (Live Messenger, Playstation, X-Box) and millions of networked devices that have implemented UPnP, such as routers and, increasingly, media players and media servers.

Early versions of the Microsoft UPnP software suffered from a few buffer overflows. Until 2006 these were the most widely known UPnP bugs. In 2006 at the SANE 2006 conference in Delft, the Netherlands, I presented a paper about bugs in other UPnP devices, which are hard to fix and detect for normal users. In January 2008 the GNUcitizen hacker group used a flaw in the Adobe Flash plugin for Internet Explorer to reconfigure routers with UPnP (but only some stacks) and turned a (mostly) local attack into a remote attack.

With more UPnP enabled devices on the market, and more people taking desktop security serious (well, to some extent) some of the focus is shifting towards other devices on the network, such as access points, routers and firewalls, although at the moment it seems that right now desktops are still the prime targets. I have the feeling this will change in the future.

What is UPnP?

The main goal of UPnP is to make adding network devices and networked programs to a network as easy as it is to plug in a piece of hardware into a PC (or even easier, as that is often error prone). The devices and programs find out about the network setup and other networked devices and programs through discovery and advertisements of services and configure themselves accordingly. In short: UPnP is a framework to build networked applications.

The use of the name UPnP has caused a lot of confusion. Product specifications often mention something like 'UPnP support', but are totally unclear about what kind of support. Technically, just implementing device discovery would make a product UPnP compatible.

Depending on the context 'UPnP' can mean completey different things. For a router this often means that the Internet Gateway Device Profile is implemented. For a media device it means that MediaServer, MediaRenderer or RemoteUI is implemented.

UPnP stack layout

The UPnP stack consists of 6 layers, one of which is optional:
  1. Discovery
  2. Description
  3. Control
  4. Eventing
  5. Presentation
The extra, optional, step is 'addressing'.

Addressing

By default a UPnP-capable device tries to get an IP address through DHCP. If no IP address can be obtained through DHCP an address is chosen in the special link local address range (169.254.0.0/16), similar to what is described in RFC 3927.

Discovery

When a UPnP capable device joins a network and wants to know what UPnP services are available on the network, it sends out a discovery message to the multicast address 239.255.255.250 on port 1900 via the UDP protocol. This message contains a header, similar to a HTTP request. This protocol is sometimes referred to as HTTPU (HTTP over UDP):

M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: ssdp:discover
MX: 10
ST: ssdp:all

All other UPnP devices or programs are required to respond to this message by sending a similar message back to the device, using a UDP unicast, announcing which UPnP profiles the device or program implements. An interesting quirk: it is sent back with UDP unicast to the port the device discovery message was sent from. For every profile it implements one message is sent:

HTTP/1.1 200 OK
CACHE-CONTROL:max-age=1800
EXT:
LOCATION:http://10.0.0.138:80/IGD.xml
SERVER:SpeedTouch 510 4.0.0.9.0 UPnP/1.0 (DG233B00011961)
ST:urn:schemas-upnp-org:service:WANPPPConnection:1
USN:uuid:UPnP-SpeedTouch510::urn:schemas-upnp-org:service:WANPPPConnection:1

The above is a slightly edited response that is sent by an Alcatel/Thomson Speedtouch ADSL modem, which implements the WANPPPConnection profile.

At a regular interval UPnP capable devices or programs have to send a message to announce their services. A notification message is more or less the same as a response message to a discovery, but are sent to the UPnP multicast address 239.255.255.250 on port 1900 via UDP and have the ST header replaced by a similar header called NT.

Description

Every profile offers a description of itself and the services it offers and makes this available via XML. The response message from the discovery phase contains a header called LOCATION (case insensitive), which is a URL where a file in XML format can be downloaded. This file describes (or rather: should describe) the profile that the device or program implements, specifically the URLs that the control and eventing phase should send commands to, but possibly also other meta information about a device, such as an icon that should be displayed by Windows Explorer, the manufacturer of the device, and so on.

There is no default value for this header. In fact, in some devices, especially based on a Broadcom chipset, it is set dynamically at boot time. The only way to be completely sure is to always do device discovery.

Control

The third step in the protocol is "control": a device or program can ask another device or program to perform an action on the client's behalf, using SOAP. SOAP is a protocol that runs over HTTP and uses XML to describe remote procedure calls to a server and return results from those calls. SOAP is mainly used for web based services. For every major programming language libraries are available that can be used to implement SOAP requests and process SOAP responses.

Requesting a service is done by sending a SOAP request to the so called "control URL" of the control point, with the right parameters. The control URL for a specific profile can be found inside the tag in the XML file found at the URL in the LOCATION header from the Description stage. The tag from the Thomson Speedtouch 510 for the WANPPPConnection profile looks like this:


  urn:schemas-upnp-org:service:WANPPPConnection:1
  urn:upnp-org:serviceId:wanpppc:pppoa
  /upnp/control/wanpppcpppoa
  /upnp/event/wanpppcpppoa
  /WANPPPConnection.xml


For sending SOAP requests only the URL inside the controlURL tag is necessary.  It depends on the profile which actions can be performed. The URL found at the URL in the SCPDURL tag is the so called "URL for service description". It describes which SOAP methods can be performed for that profile and what the so-called state variables for the profile are.  What is in this file should match the services that are offered by the device, but in practice they don't always seem to match.

Eventing

In UPnP there is the concept of so called "state variables". These variables are, as the name says, used for keeping some form of state in UPnP devices and programs. A program can subscribe to state changes: when a state variable is changed, the new state is sent to all programs/devices that have subscribed to the event. A program/device can subscribe to the state variables of a service by subscribing to a URL, which can be found in the URL pointed to by LOCATION.


  urn:schemas-upnp-org:service:WANPPPConnection:1
  urn:upnp-org:serviceId:wanpppc:pppoa
  /upnp/control/wanpppcpppoa
  /upnp/event/wanpppcpppoa
  /WANPPPConnection.xml


The eventing protocol in UPnP is based on GENA.

Presentation

The presentation layer in UPnP refers to the human controllable interface, for example, the webinterface on a router. It is surprising to see that these interfaces often don't match with the functionality that you can use through SOAP. For example, it is often impossible to even see on a router which portmappings are active, let alone change them.

UPnP profiles

Actions and state variables can form a so called 'profile'. The UPnP standardization organizations have standardized a few profiles, which are in widespread use. The most used profiles are:
  • Internet Gateway Device (IGD)
  • Audio/Video (A/V), basis for DLNA
Many profiles have subprofiles, which implement specific behaviour, such as the WANIPConnection subprofile in the Internet Gateway Device profile. A device can sometimes implement one (sub)profile multiple times. Top level profiles are usually just containers for several subprofiles.

Implementation caveats

There are a few things you should keep in mind, if you want to implement UPnP functionality for whatever reason.

The most important one is that devices will send responses to M-SEARCH requests to the port that was used for sending the request. You will need to have a program listening on that port. A good solution is to send from UD port 1900 and reuse the socket. There are some incompatibilities between operating systems how you should do this. An extra benefit is that this will also capture a lot of the announcements that are sent regularly over the network.

CREDIT: Armijn Hemel/upnp-hacks.org

8/25/2015

51 Open Source Tools for the Internet of Things


51 Open Source Tools for the Internet of Things


These open source software and hardware projects make it easy for hobbyists, startups and established companies to develop new IoT devices and applications.

According to the market researchers at IDC, there were 9.1 billion Internet of Things (IoT) devices installed at the end of 2013. They expect that number to grow 17.5 percent each year and hit 28.1 billion in 2020, when the total IoT market could be worth more than $7 trillion.
The open source community has been at the forefront of this new trend, creating software and hardware designs that enable nearly anyone to experiment with IoT devices and applications. And the number of open source projects dedicated to IoT has been growing rapidly. Last year, we put together a list of 35 open source IoT projects, and this year, we've extended it to 51 tools.
As always, if you know of additional open source projects that you think should be on our list, feel free to make note in the comments section below.

Operating Systems

1. Contiki
This open source IoT operating system boasts highly efficient memory allocation, full IP networking, power awareness, standards support, dynamic module loading, support for a wide variety of hardware and more. There are a wide variety of papers, books and other support materials to help users and developers get started using it.
2. eLinux
A number of IoT devices run the Linux kernel (or a portion of it). This site provides extensive information about using Linux in embedded systems.
With millions of deployments, FreeRTOS claims to be "the market leading real time operating system (or RTOS), and the de-facto standard solution for microcontrollers and small microprocessors." Optional commercial licensing and support are available.
4. mbed
Developed by ARM and its partners, mbed is an operating system designed for IoT devices that run on ARM processors. It includes a C++ application framework, and the company also offers other development tools and a related device server.
Raspbian is a variation of Debian Linux optimized to run on the Raspberry Pi. It includes more than 35,000 applications that can run on the device.
6. RIOT
RIOT calls itself "the friendly operating system for the Internet of Things," and it aims to be developer-friendly, resource-friendly, and IoT-friendly. Key features include support for C and C++, partial POSIX compliance, multi-threading, energy efficiency and more.
Ubuntu is one of the most popular distributions of Linux, and this variation brings Ubuntu to the Internet of Things. It can run on cloud computing services like Microsoft Azure, Google Compute Engine and Amazon Elastic Compute, as well as on IoT devices like the BeagleBone Black and the Raspberry Pi.
8. TinyOS
Downloaded more than 35,000 times per year, TinyOS is a popular operating system designed for low-power wireless devices, such as those in IoT deployments. It boasts excellent support for networking and low-power operation.
9. Tizen
Governed by the Linux Foundation, Tizen is a Linux-based operating system for mobile and connected devices, and it comes in versions for vehicles, smartphones and tablets, TV and wearables. Samsung sells several products based on the operating system and has been one of its largest supporters.


IoT Platforms

10. Arduino
One of the best-known names among open source IoT projects, Arduino is a platform that encompasses both hardware and software. The software includes an integrated development environment (IDE) for writing code in the Arduino language.
This project aims to be "the go-to platform for makers" and "the universal interface for Internet of Things and M2M." It includes tools for data gathering and analysis, remote control and event-based alerting, and it allows users to control many different devices from a single dashboard. Paid enterprise versions and support are available.
This toolkit includes a smart object API gateway service reference implementation, an HTTP- to-CoAP semantic mapping proxy, gateway-as-a-service deployment, application framework, embedded software agents, semantic discovery and linkage, linked data compatibility, tools for multiple sensor net clients, and Raspberry Pi and cloud micro-instance deployment images. The project also sponsors a meetup group in Silicon Valley.
13. OpenWSN
OpenWSN is the repository for IoT hardware and software projects underway at the University of California Berkeley. Its ultimate goal is to provide a complete standards-based open source IoT stack.
14. Particle
Formerly known as Spark, Particle is a full suite of hardware and software for building IoT devices, applications and services. Particle boards start at just $19, and the software is available on GitHub
15. SiteWhere
SiteWhere aims to help companies build scalable IoT applications and speed their time-to-market with new products and services. It integrates with MongoDB, HBase, Hortonworks, Clouder, Apache Solr and Twilio, and it supports deployment on nearly any cloud computing platform.
This IoT application and API makes it possible to collect and process data from remote devices. Key features include real-time data collection, geolocation data support, data processing, data visualizations and device status messages.
17. Webinos
Webinos is a web-based application platform for the internet of things. Its goal is to enable developers to write applications that run on any device, including IoT devices, cars, TVs and smartphones.
18. Zetta
Based on Node.js, Zetta can create IoT servers that link to various devices and sensors. The website includes a page devoted to projects built with betta that includes a car speed tracker and home security systems.


Hardware

Sold by Arduino's sister organization Genuino, this open source board includes two separate processors: the ATmega32u4 microcontroller that runs Arduino and the Atheros AR9331 that runs a specialized Linux distribution called OpenWrt-Yun. It includes 16 MB of Flash memory, 64 MB RAM, Ethernet, WiFI, USB and a Micro-SD card reader.
This organization offers several different open-source boards, all of which are about the size of a credit card. Their flagship product, the BeagleBone Black promises that users will be able to boot Linux in under 10 seconds and get started with development projects in less than 5 minutes. Their boards can run Linux or Android.
21. Flutter
Designed for hobbyists, students and engineers, Flutter offers a fast ARM processor and long-range wireless communication. It also includes built-in battery charging capabilities and a built-in security chip. It runs Arduino, and prices start at $36 for the basic model.
While many IoT boards rely on ARM processors, Intel also offers a IoT development board known as Galileo. It's Arduino-compatible and boasts a wider range of ports than most similar boards.
Working with the AllSeen Alliance, Local Motors has developed a Rally Car, which they are using as the platform for their Connected Car project. The open source design includes an automotive grade Linux distribution, a Raspberry Pi board, several Arduino relay boards, and Octoblu open source software.
Microduino offers a range of extremely small boards that are about the size of a quarter and start at just $8. They are currently taking orders for their new mCookie modules which stack like Lego blocks. A variety of extension boards and application kits are also available for purchase on the website.
25. OpenADC
Sold by a company called NewAE Technology, OpenADC is an open source hardware platform with an emphasis on hardware security. The company is also behind the CHipWhisperer hardware security project and offers hardware security training.
26. OpenMote
OpenMote offers three different boards: Open-Mote-CC2538, OpenBase and OpenBattery. They can be purchased separately or in kits for complete IoT deployments.
OpenPicus offers several different open source system on a module (SoM) boards, all of which come with the company's free IDE. You can choose from three different kinds of connectivity—Wi-Fi, GPRS or Ethernet. Modules start at €35.
28. Pinoccio
This company sells very small wireless boards that it calls Scouts. Connect your Scouts together into a mesh network called a Troup and then connect the Lead Scout to the Web. Compatible with Arduino.
29. RasWIK
Ciseco (not to be confused with Cisco) offers a Raspberry Pi Wireless Inventors Kit, or RasWIK. It promises that you "can build wireless devices in just a matter of minutes," and it comes with 29 projects for you to try. Prices for the kit start at £49.99.
30. SODAQ
SODAQ, which stands for "Solar-Powered Data Acquisition," offers Arduino-compatible boards that are easy to connect together. The organization's newest offering is called the Mbili (which means "two" in Swahili), and it includes the Atmel ATmega 1284P microcontroller. It's a low-power board that can run on solar energy.
31. Tessel
This open source IoT hardware platform features a modular design that makes prototyping easy. The Tessel 2, which begins shipping in September, costs just $35 and is compatible with Node.js for fast development. Available modules include Accelerometer, Ambient, Relay, Climate, Infrared, Servo, RFID, GPS, MicroSD, Camera, Audio, Lights, Keypad, Motors, Pulse and more.
32. UDOO
Udoo offers several different open source boards that can run Android, Arduino and the UDOObuntu distribution of Linux, as well as some other operating systems. Prices for boards start at $99, or you can use the provided specs to build your own.
33. WeIO
This group wants to make creating Internet-connected objects as easy as creating websites. Its award-winning devices support HTML5 and Python, and prices start at $69.
34. WIZnet
WIZnet makes chips and IoT boards based on those chips. The link above includes details and specifications for its open source hardware products.


Connectivity Software

DeviceHive is a machine-to-machine (M2M) communication framework for smart energy, home automation, remote sensing, telemetry, remote control and monitoring software and other IoT applications. It supports Java, C++, .NET, Python, Javascript, and other platforms.
36. IoTivity
Sponsored by the Open Interconnect Consortium, The IoTivity software allows for device-to-device connectivity. It is an implementation of the OIC's standard specification. Operating System: Linux, Arduino, Tizen


Database

37. InfluxDB
InfluxDB is a "distributed time series database with no external dependencies." That makes it ideal for collecting data from IoT sensors; in fact, it can track data from tens of thousands of sensors sampling more than once per second. Operating System: Linux, OS X


Development Tools

The Eclipse Foundation has a long list of IoT-related projects that include standards and development frameworks. The project also offers a wealth of videos, tutorials, sandboxes and other tools to help new IoT developers get started on their first projects.
39. KinomaJS
The Kinoma platform encompasses both hardware and software tools for prototying IoT devices and applications. KinomaJS, its JavaScript-based application framework, is available under an open source license. Operating System: Windows, Linux, OS X
Based on Java and the Apache Cassandra NoSQL database, Mainspring describes itself as "an open source application framework for building machine to machine (M2M) applications such as remote monitoring, fleet management or smart grid." Features include flexible device modeling, device configuration, communication between devices and applications, data validation and normalization, long-term data storage and data retrieval. Operating System: Windows, Linux, OS X
41. Node-RED
This "visual tool for wiring the Internet of Things" simplifies the process of connect IoT devices with APIs and online services. It is built on Node.js and includes a browser-based flow editor. Operating System: Windows, Linux, OS X


Home Automation Software

42. OpenHAB
This Java-based open source home automation software promises a vendor-agnostic way to control all the IoT devices in your home through a single interface. It allows users to set up their own rules and control their home environment. You can download the software from the site or use it through the my.openHAB cloud service. Operating System: Windows, Linux, OS X, Android
The Thing System's website says, "Today, you have to fight your things. They don't talk to each other, the apps don't work, it's a tower of babel. Our solution — the Thing System — is open source. We'll talk to anything, you can hack the system, it has an open API." It supports a huge list of IoT devices, including those made by Cube Sensors, Parrot, Next, Oregon Scientific, Samsung, Telldus, Aeon Labs, Insteon, Roku, Google, Apple and other manufacturers. Operating System: Windows, Linux, OS X, others


Middleware

44. AllJoyn
Sponsored by the AllSeen Alliance, whose members include the Linux Foundation, Microsoft, LG, Qualcomm, Sharp, Panasonic, Cisco, Symantec and many others, AllJoyn is a "collaborative open-source software framework that makes it easy for devices and apps to discover and communicate with each other." It has supports bindings for C, C++, Objective-C and Java, and it includes per-to-per encryption and authentication. Operating System: Windows, Linux, OS X, Android, iOS Arduino, others
45. Kaa
Focused on speeding IoT projects, Kaa describes itself as "a production-ready, multi-purpose middleware platform for building complete end-to-end IoT solutions, connected applications, and smart products." It enables communication and monitoring between IoT devices and back-end infrastructure, and it can be easily deployed on Amazon's cloud. Operating System: Linux
46. Mango
Mango automation software offers features like data acquisition, real-time monitoring, a high-performance NoSQL database, security and much more. It is available in both a free open source version and paid enterprise versions. Operating System: Windows, Linux, OS X
47. Nimbits
Nimbits describes itself as "a Data Logging Service and Rule Engine Platform for connecting people, sensors and software to the cloud and one another." It includes server software, an open source Java library, an Android client and a public cloud that runs Nimbits Server.
48. OpenIoT
Funded in part by the EU, OpenIoT describes itself as a "blueprint middleware infrastructure for implementing/integrating Internet-of-Things solutions." The project's goals are to be able to collect and process data from nearly any IoT device, stream that data to the cloud and analyze and visualize the collected data. Operating System: Windows, Linux, OS X
This award-winning project boasts users like Philips, Trust Digital Lifestyle Accessories, Ooma, VolkerWessels and others. Free and paid versions are available.


Monitoring

50. Freeboard
This project promises "ridiculously simple dashboards for your devices." It offers a widget-based, drag-and-drop development tool that makes it easy to track the data from your IoT devices. Both free and paid plans are available. Operating system: OS Independent


Printing

This unusual project makes it possible to create your own small, internet-connected printer. Want to talk to the project owners? You can send a message or draw a picture that will be printed on the Exciting Printer in their office.


SOURCE: http://www.datamation.com/mobile-wireless/51-open-source-tools-for-the-internet-of-things-1.html