Showing posts from 2017

How to stream rtsp videos or mp4 files throught python/flask + opencv

First, you need to download the code to generate your site with flask. To do this, you can use the following @miguelgrinberg project to stream your webcam or image files with flask.

git clone

In you need replace:

from camera import Camera
from camera_opencv import Camera

Now, you must edit your video source from
video_source = 0, means that you want to stream your webcam (/dev/video0)
You can edit it, by a file or a rstp url

If you replace 0 by 'video.mp4' you will probably get the following error:

Starting camera thread.
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python3.5/", line 914, in _bootstrap_inner
File "/usr/lib/python3.5/", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/nboettcher/Downloads/rtsp/flask-video-streaming/", line 93, in _thread
for frame in frames_i…

How to install Matlab from iso files in Ubuntu Linux

If you try mount the iso files, maybe you can't change the permissions to execute (read-only files).
Try to extract both isos with:

7z x namefileDVD1.iso
7z x namefileDVD2.iso

To run matlab installer you must change the permissions from two files:

chmod +x install
chmod +x bin/glnxa64/install_unix

If you execute "sudo ./install" probably you will get this message:

Preparing installation files ...
Installing ...

That means that you may have problem with your jre environment.
Give the JRE path to the executable to run it:

sudo ./install -javadir "/usr/lib/jvm/java-8-openjdk-amd64/jre" 

If you don't know where is your JRE path, just find jre folders with:

locate jre

Enjoy it!

How to install Freeplane 1.6.x from github in Ubuntu 16.04

First, you need to clone the project form github:

git clone

Now, to build it, you need to install grandle to create BIN folder where will be freeplane:

sudo apt-get install gradle
cd freeplane
gradle dist test
cd BIN

Enjoy it!

How to configure a Matlab cluster in your lan

First, you need to run admincenter to mange your cluster. It route should be there:


Now, you must run mdce on each member node of your cluster

cd /usr/local/MATLAB/R2016a/toolbox/distcomp/bin
sudo ./mdce start    

WARNING: The mdce script detected that the number of processes allowed
is limited by ulimit. Be sure that the limit of processes for the ROOT user
(or the user running the mdce service) is set to either "unlimited"
or at least 128 * W, where W is the maximum number of MATLAB Distributed
Computing Server workers that will run on this machine.

Creating LOGBASE directory (/var/log/mdce).
Creating CHECKPOINTBASE directory (/var/lib/mdce).
Creating SECURITY_DIR directory (/var/lib/mdce/security).
Starting the MATLAB Distributed Computing Server in the background.

To choice who is the jobmanger or workers you need run each command by separate:

sudo ./startjobmanager
sudo ./startworker

Now, press Add or Find to add your clust…

IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/protobuf-3.2.0-py2.7.egg/EGG-INFO/namespace_packages.txt'

If you try to execute a python script and you get this error:

File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 3017, in <module>
  File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 3003, in _call_aside
    f(*args, **kwargs)
  File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 3045, in _initialize_master_working_set
  File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 2575, in activate
    for pkg in self._get_metadata('namespace_packages.txt'):
  File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 2565, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "~/.local/lib/python2.7/site-packages/pkg_resources/", line 1471, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "~/.local/lib/python2…

How to install wine on Ubuntu 16.04 64 bits

If you try to install wine, maybe you will see the following error:

The following packages have unmet dependencies:
 wine1.6 : Depends: wine1.6-i386 (= 1:1.6.2-0ubuntu14)
           Recommends: fonts-droid but it is not installable
E: Unable to correct problems, you have held broken packages.

I tried installing these fonts but without solution.
To avoid it, you can download the source code and compile it:

tar xjvf wine-2.0.tar.bz2
cd wine2.0

checking whether gcc -m32 works... no
configure: error: Cannot build a 32-bit program, you need to install 32-bit development libraries.

This happend because you must be explicit if you want to install on a 64-bits platform.

./configure --enable-win64
make -j8
sudo make install

Enjoy it!

How to broke the pdf security to edit it

If you think the protection of pdf is enough for nobody can edit it, you are wrong.
Just execute the follow sentence to broke it:

sudo apt-get install qpdf
qpdf --decrypt encrypted.pdf decrypted.pdf

Enjoy it!

How to install a WhatsApp bot based on Python

First, we need to download the yowsup code:

git clone
cd yowsup
sudo python install
python yowsup-cli registration -p 569xxxxxxxx -C 56 -r sms

Where 56 is the country code (Chile in my case)
You will receive a code in your phone to register the account

python yowsup-cli registration -p 569xxxxxxxx -C 56 --register 201-124

Now, create a file called mydetails with the following information and the password that yowsup-cli prints:


To send a whatsapp message, you only need write the following sentence:

yowsup-cli demos -c mydetails -s 569xxxxxxxx "hello world"

If you prefer the CLI, you need to do the following:

yowsup-cli demos --yowsup --config mydetails 
/message send 569xxxxxxxx "hello world"

Enjoy it!

Install Netflix in RK3188 without google play

To access to any android application, you can use to get the apk file and install it without google play.
In my case I have a CYX_809III_RK3188, is a HDMI Stick for your TV and runs Android 4.4.2
If you try install on it the last Netflix version, you will see this message:

There is a problem parsing the package
To avoid it, you need to found a Netflix version compatible with your device. I used to search every versions of Netflix. In my case, the last version that works on my device is Netflix 3.11 Enjoy it!

How to upgrade networkx to developer version in Linux

Weight functions are only available on networkx development version.
To install it you need to do the following:

git clone
cd networkx
sudo python install

ERROR: Failure: ImportError (No module named coverage)
ImportError: No module named pandas

To fix it, install these libraries and re-run nesetest:

sudo pip install pandas coverage
Ran 3045 tests in 33.191s


If you run your python console you can ask for networkx version as follows:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx
>>> print networkx.__version__


But, if you run your code it still be using version 1.1 Now you need to remove the previous version and re-install the last ve…

How to connect a2dp bluetooth headset on Ubuntu 16.04

The bluetooth stereo headset on Ubuntu has been in trouble for some time.
To solve it, I have read different techniques but in several you have to edit and configure files.
I found a quick and easy way to connect and enable the a2dp function (stereo) on your headset with just execute one file.

You can download it from the github project or directly:

Just execute it with python3 and select your mac address device that you want to connect.
If you use pavucontrol, you can see on configuration tab, that your device appears with a High Fidelity Playback (A2DP Sink) profile.
Enjoy it!

npm ERR! Failed at the node-sass@3.13.1 postinstall script 'node scripts/build.js'.

Deal with npm is a big headache.
I have npm 3.53 and node 8.0.0-pre
Today I has been fighting with run npm install and I had this error:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN You are using a pre-release version of node and things may not work as expected
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.0.13 (node_modules/iltorb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.0.13 install: `node-gyp rebuild`
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.13.1 postinstall scrip…

multicast join failed: No such device

If you try to generate multicast traffic with iperf, this message could probably appear, especially if you are using mininet:

multicast join failed: No such device 

To solve it, you need to create an entry in the route table for multicast traffic like this:

ip route add dev eth0

On the server side use:

iperf -s -u -B -i 1

On the client side use:

iperf -c -i -i 1 -l 100 -b 1k

Enjoy it!

fatal: Unable to find remote helper for 'https'

A common issue with git is when you try clone a project (nodejs in my case) appears this error:

git clone
Cloning into 'node'...
fatal: Unable to find remote helper for 'https'

I was reading different solutions, like replace https by git, but the errors is still here:

git clone git://
Cloning into 'node'...
fatal: unable to connect to[0:]: errno=Connection timed out

Other recurrent solution is to install openssl libraries for curl (to read https protocol):

sudo apt-get install libcurl4-openssl-dev

Now, you must install git again:

tar xvf git-2.12.0.tar.gz
cd git-2.12.0
make -j8
sudo make install

Enjoy it!

How to install go 1.8 on Ubuntu 16.04

If install golang in Ubuntu 16.04 throught synaptic, you will install version 1.6 and maybe you will see the following problems:

cannot find package "" in any of:
/usr/lib/go-1.6/src/ (from $GOROOT)
/src/ (from $GOPATH)
exit status 1
exit status 1

To avoid it, is better install it from the source:

sudo tar -zxvf go1.8.linux-amd64.tar.gz -C /usr/local/
mkdir ~/go
echo 'export GOROOT=/usr/local/go' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc

Enjoy it!

How to get the difference between the last two values in influxdb

If you are measuring traffic, probably your are writting OVS data as accumulative bytes.
This is an extract of my influxdb data

You can get the newest two values with the following sentence:

influx -execute "SELECT value FROM packets_in WHERE dp_name='s3' AND port_name='port1' ORDER BY time DESC LIMIT 2" -database=faucet -precision=rfc3339

name: packets_in
time                 value
----                 -----
2017-03-16T20:00:23Z 326
2017-03-16T20:00:13Z 302

If you want to get the difference between them (326-302), you need the lastest influxdb version (here a post about how to upgrade your current version).
With the DIFFERENCE command, you can do it:

influx -execute "SELECT DIFFERENCE(value) * -1 FROM packets_in WHERE dp_name='s3' AND port_name='port1' ORDER BY time DESC LIMIT 1" -database=faucet -precision=rfc3339

name: packets_in
time                 difference
----                 ----------
2017-03-16T20:00:13Z 24

Enjoy it!

How to upgrade Influxdb 0.10.0 to 1.2.2 in Ubuntu 16.04

First, you need to remove the old version:

sudo apt-get remove influxdb influxdb-client

Now, to install the newest version you can do it throught a .deb file or from the repositories:

From .deb file:

sudo dpkg -i influxdb_1.2.2_amd64.deb

From repositories:

curl -sL | apt-key add -
source /etc/lsb-release
echo "deb xenial stable" | tee -a /etc/apt/sources.list
apt-get update
apt-get install influxdb

In both cases the following message may appear:

Preparing to unpack .../influxdb_1.2.1-1_amd64.deb ...
Unpacking influxdb (1.2.1-1) over (0.10.0+dfsg1-1) ...
dpkg: error processing archive /var/cache/apt/archives/influxdb_1.2.1-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/influx', which is also in package influxdb-client 0.10.0+dfsg1-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
influxdb.service is not …

How to create a Unity icon for Pycharm

As every aplications, you can create a .desktop file to run it from your Desktop.
If you copy this .desktop file in ~/.local/share/applications, you can see it in Unity, but when you run Pycharm the icon that appears doesn't load.

To create an icon here, just open Pycharm and create it clicking on Tools > Create Desktop Entry...

Now, you could load Pycharm with an Unity icon.

Enjoy it!

How to run root python scripts on Pycharm

Mininet needs root privileges ti run. If you run a python mininet script on Pycharm you will see the following message:

*** Mininet must run as root.

To enable root privileges, you need create a new interpreter as follows:

sudo visudo -f /etc/sudoers.d/python Add the following information: <user> <host> = (root) NOPASSWD: <full path to python> For example: boettcher boettcher-server = (root) NOPASSWD: /usr/bin/python Create a script called, containing (with your correct full python path): #!/bin/bash sudo /usr/bin/python "$@" Be sure to make the script executable: chmod +x To change your actual interpreter for this new one, in PyCharm, go to File > Settings > Project Interpreter. Click the gear icon by the current Project Interpreter drop-down, and choose “More…”.

Then click the green plus icon to add a new interpreter (Add Local). Browse to and select it and set it as the interpreter for the project.

Now when y…

Automate mininet to run batch commands

If you prefer to use mininet console instead python API, maybe you will need automate the process to run batch commands.
With source command you can load a file with all commands to execute inside mininet, like this:

source init.cli

This is the content of init.cli:

py "Configuring network"
h1 ifconfig h1-eth0
h2 ifconfig h2-eth0
py "Current network:"
py "Adding switches to the controller"
sh ovs-vsctl set-controller s1 tcp:
sh ovs-vsctl set-controller s2 tcp:

Enjoy it!

How to run ping when STP is ready in a mininet topology

If you have a topology like a mesh or any other with redundant links, you must use Spanning tree protocol (STP) to avoid a while.
To run STP, you can use a controller app or setup your virtual switches to be compatible with STP.

To run as controller:

Run a STP controller app. In my case I use Ryu:
ryu-manager --ofp-tcp-listen-port=6633

To run as virtual switch (OVSSwitch):

You can modify your switch from your terminal (outside mininet) as follows:

ovs-vsctl set bridge s1 stp-enable=true

You can use the same sentence inside a python script like follows:

s1.cmd('ovs-vsctl set bridge s1 stp-enable=true')
Now, to avoid execute ping before STP is ready, you need to see the status port of your switch. You can use the following code to insert in your python script.

while(s1.cmdPrint('ovs-ofctl show s1 | grep -o FORWARD | head -n1') != "FORWARD\r\n"): time.sleep(3) # Avoid initial too long delaytime.sleep(2) info("Running ping\n"…

How to use proxychains to hide your ip address

If you want hide your ip address to emulate different users, a good option is proxychains.
To install it, you need following these steps:

sudo apt-get install tor
git clone
cd proxychains-ng 
make -j4
sudo make install
sudo make install-config
sudo service tor start

You can edit proxychains config file to add more proxies if you want:

vim /usr/local/etc/proxychains.conf

To validate if it's working, you can check out you ip address throught curl:

proxychains4 curl -s '' |grep "IP:" | grep -oE "[0-9\.]*"
[proxychains] config file found: /usr/local/etc/proxychains.conf
[proxychains] preloading /usr/local/lib/
[proxychains] DLL init: proxychains-ng 4.12
[proxychains] Strict chain  ...  ...  ...  OK

Enjoy it!

Full faucet.yaml file configuration

version: 2
        dp_id: 0x0000000000000001   # The id of the datapath to be controlled
        description: "Initial Test Faucet"    # Purely informational
        hardware: "Open_vSwitch"  # used to determine which valve implementation to use
                native_vlan: 100
                name: "port1"   # name for this port, used for logging/monitoring
                acl_in: 1
                description: "Port 1"    # informational
                #native_vlan: 100
                tagged_vlans: [100,2001,2002,2003]
                name: "port2"
                acl_in: 1
                description: "Port 2"
        description: "Test vlan" # informational
        name: "test_vlan"  # used for logging/monitoring
        max_hosts: 3 # Maxium of 3 hosts can go on this VLAN
        name: "trusted n…

Issues to run

A typicall issue when you run is the following:

sudo ryu-manager --ofp-tcp-listen-port=6633 /home/nboettcher/Downloads/faucet/src/ryu_faucet/org/onfsdn/faucet/

... in __init__ 
self.config_file, self.logname)
TypeError: 'NoneType' object is not iterable

To see the specific conflictive line in your config file (faucet.yaml), you need to check out the faucet log:

$ cat /var/log/ryu/faucet/faucet.log
faucet.config ERROR    Error in file /etc/ryu/faucet/faucet.yaml (while scanning for the next token
found character '\t' that cannot start any token
  in "/etc/ryu/faucet/faucet.yaml", line 15, column 1)

As you can see, yaml files can't use tabulation to ident the content. Replace tabs by spaces.
Don't forget delete empty lines at the end of file.

Enjoy it!

Do you have problems with Aliexpress sign in?

A common issue in Chrome (I don't know if it happends on Firefox or other browser), is that Aliexpress cookies has problems when you want to access to your account.

When you press Access now, the page reloads, but the identification section doesn't shows your name.
To fix it, a solution is clear all cookies, but you can delete only ali* cookies as follows:
Go to chrome://settings/

Filter by ali and click on Remove all shown. Now you can login again without problems Enjoy it!

How to geolocate a Wireless IP Camera (P2P) WIFICAM

Yesterday I read about how to access in a remote Wireless IP Camera (P2P) WIFICAM (this is the link
Fortunately, I had one to test it and validate the bug.

This camera has telnet, but I could never find the password.
If you try the bug, yo can replace telnet by a bash terminal, using and exploit in C or throught the webpage:

Now, when you try access to your camera throught telnet, you will have root access.

Cámara Wifi IP P2P permite acceso a telnet sin password gracias a vulnerabilidad en configuración FTP. — Nicolás Boettcher (@nicoboettcher) March 9, 2017 Also, if you exploit this vulnerability in a random camera, you could know where is it in the world, just with the wireless information.

With this information, you can search it in Wigle databases to get the latitude and longitude.
PyGLE is a wrapper for the WiGLE WiFi mapping API (…

Contiki 3.0 on XM1000

In other post, I installer contiki 3.x on xm1000.
Now, we going to install contiki 3.0 (the lastest version).
First, you need to dowload the lastest code from github:

git clone

Now we need to add xm1000 compatibility to our contiki.
Thanks to DMI  for the xm1000 patch. Without it, you will see the following error:

make: *** No rule to make target 'obj_xm1000/cc2420.o', needed by 'contiki-xm1000.a'.  Stop.

I upgrade his patch with an app to access to the xm1000 sensors.
Download it from

Now, extract it into contiki folder:

tar xzvf xm1000.tar.gz
cd xm1000

Go to the apps folder and execute an script that I create to automate the process:

cd $YOUR_CONTIKI_PATH/platform/xm1000/apps/sensors

Enjoy it!

Running Faucet and Gauge on localhost

In my post about how to configure mininet-ryu-faucet-gauge-influxdb I used faucet in a remote machine (as virtual machine).
Now, I going to explain how to install and configure it in localhost.
First, download it form github:

git clone
cd faucet
sudo python install

Probably, you will see this message:

build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory

To avoid it, you need to install yaml:

apt-get install libyaml-dev

If you try to install it again you will see this message:

ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 111, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 248, in cfg_to_args
    kwargs = setup_cfg_to_setup_kwargs(config, script_args)
  File "/usr/local/lib/python2.7/dist-packages/pbr/", line 382, in…

How to fix a pip3 failed installation

In my case, I was trying to install bluepy from pip3 with the following command:

pip3 install bluepy

But an error appears:

fatal error: glib.h: No such file or directory\n #include <glib.h>\n                  ^\ncompilation terminated.\nMakefile:28: recipe for target 'bluepy-helper' failed\nmake: *** [bluepy-helper] Error 1\nmake: Leaving directory '/tmp/pip-build-djwz1adc/bluepy/bluepy'\n"

Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-djwz1adc/bluepy/';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-p2v5kjik-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-djwz1adc/bluepy
Storing debug log for failure in /root/.pip/pip.log

Usually, we see the outpu after Cleaning up...,…

Fix tiny font on google chrome tabs and boomarks

After a chrome upgrade, maybe you could see a modification on your tabs font size.

To fix it, install the lastest version from this repository, with the following commands:

wget -q -O - | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-beta

As you can see, the font recover it's original size
Enjoy it!

How to capture Android traffic throught Wireshark

An option is connect wireshark from your pc to your android throught ssh.
You can use sshdroid to enable ssh on your Android.
On your computer use the following commands:

mkfifo /tmp/remote
wireshark -k -i /tmp/remote &
ssh root@android_ip "tcpdump -s 0 -U -n -w - not port 22" > /tmp/remote

Now you could see you Android traffic
Enjoy it!

How to record IP camera video throught RTSP

Some IP webcams requires Quicktime to show the image throught the browser.
To get the full URI with the video source, you can get it from a virtual machine with windows throught wireshark like this:


To reproduce it with vlc, use this command:

vlc "rtsp://"

Probably you should see the first frame as static frame and the following error:

Failed to open VDPAU backend cannot open shared object file: No such file or directory
avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)

You can install libvdpau-va-gl1 dependencie, but the problem persists.
If you prefer to use vlc (if you compile it with hw acceleration), you can enable the option --avcodec-hw vdpau

If you don't have vlc with hw acceleration enabled, you can use mvp. To install it, follow these steps:

sudo …

How to configure a Raspberry 3 with a MagicBulb

First, we need to download the official rapsberry image (raspbian Pixel version):


Now, we need mount the image in a microSD. You can use etcher to automatize the entire proccess:

unzip -e

Before placing the microSD in the raspberry, you need enable ssh service. To do this, just create a file called ssh in the boot partition.

cd /media/PI_BOOT
touch ssh

where PI_BOOT is the boot raspberry partition.
Use pi as user and raspberry as password to access it throught ssh.
Now, we need to install dependencies for magicblue:

sudo apt-get install libglib2.0-dev libbluetooth-dev
git clone
cd bluepy
sudo python install 
cd ..
sudo pip3 install setuptools bluepy webco…

How to troubleshoot a module import problem in a scapy script

If you try to run a Python script importing some module and you get this following issue:

NameError: name 'IP' is not defined
ImportError: No module named all

check your Python script name. Probably you are using some reserved name from a function.
To fix it, rename your Python script for other name, like (to be sure you are not using a reserved function name).
Don't forget delete any .pyc file that can has any conflict with any function name.

Here's an example about how to fix it:
rm new.pyc

Enjoy it!

How to login in Spotify throught Facebook

A common issue is when you get this following alert:

A facebook error has occurred. Please try again

To fix it, you need to enable an alternative password for thirds applications in your facebook security configuration, like follows:

Browse to, Settings (top right corner) > Security (left hand menu) > App Passwords. There, generate a password for "spotify". Use this password (and your email address to login in facebook) to login to Spotify on your mobile app.

Enjoy it!