Mosquitto C++ sample code to publish message

I start using mosquitto in a C++ program and I think documentation could be a little bit improved by some examples. To use mosquitto, there is a mosquittopp class acting as a wrapper on top of the mosquitto lib. Basically to create your own program you have to herit from that one and it is easy then.

Mosquitto lib can be managed as a thread or directly by calling the different sub function. In my point of view the thread approach is the better as otherwize you have to manage connection / disconnection manually. Mosquitto lib is then event managed, so you can subscribe to the callback event by surcharging the existing function.

Here is an exemple for a program just needing to publish messages to a broker.

Continue reading

Quickly create word list

An easy way to create a word list in bash :

for i in {a..z} ; do echo $i ; done
for i in {a..z}{{a..z},{0..9},-} ; do echo $i ; done
for i in {a..z}{{a..z},{0..9},-}{{a..z},{0..9},-} ; do echo $i ; done

The first line creates a list of one characters word from a to z

The second line creates a list of two characters word from aa to z- the alphabet for the second character can be a-z or 0-9 or –

The third line is a three character word list.

 

 

ncrack – multi protocol password brute force attack by nmap

Ncrack is a new brute force tool made by nmap, it’s actually a alpha version but the product is really interesting to verify your password policies compliance and security. It support ftp, telnet, ssh, rdp … protocols.

Easy to use in command line, I only tested it with rdp, unfortunately with no success even knowing the password to be found. I assume it’s just an alpha bug. In my point of view the multi protocol implementation makes it an interesting tool for audit automation.

 

MQTT compared to HTML for its network saving

I’m interested by MQTT for two reason, the first one is related to its services and QoS management, the second by its network efficiency because I’d like to use it over a 3G communication system with a small and low cost plan.

MQTT promise is to be network efficient but, i’d like to see it with my eyes, so I’ll try to give you some measures I’ve done to confirm it. My fear is that keep alive communication for subscriber costs could be high and request some software adaptations.

See full article to get details and eventually reproduce

Continue reading

MQTT on Raspeberry PI

MQTT (MQ Telemetry Transport) is a Message Queuing system for machine to machine communications. It allows communication of mobile systems over high latency, low bandwidth and poor quality networks. It manage communications over TCP (not over Http) to optimize the size of messages and it manages different quality of services. Depending of it, messages can be dropped, received multiple times of you can have the insurance to receive the message one and only one time.

It makes this protocol really interesting for the communication between a raspberry PI and a server when this communication is event driven and the communication link looks like a Edge/3G channel.

Mosquitto is an open source implementation for MQTT.

Here are some tips on how I implemented it, for a demonstration purpose

Continue reading

Arduino and hc-05 bluetooth shield

Tonight, I start working on a third project I have in my hack list for the moment, this one is based on bluetooth and I order some arduino stuff to make it live. The arduino itself is a leonardo and the bluetooth is a hc-05 attached to a larger shield to be connected with arduino board directly.

This article details how to use HC-05 to transfer data between arduino &  mobile device based on Bluetooth. It includes HC05 source code for pairing and communicating.

Click on link to get more

Continue reading

Raspberry PI – receive 433Mhz radio signal

Tonight, the hack objective is to communicate with 433Mhz equipments using Raspberry PI. For this, I use a 433Mhz receiver from Itead Studio bought at hack spark for 4.5€ with an emitter. Cabling is simple : VDD on 5V (I tryed to use 3.3V supply voltage but as a consequence the reception range is limited to a couple of cm) , GND goes to GND and One of the data pin going to pin 13 (gpio21/27). This is following elements found on that site : ninjablocks

If you are looking for a RF433 shield for Raspberry, check this link to another article !

The first step is to install a fresh wheezy raspbian environment and get the basis element to work :

Continue reading