Electrons and bits
Blog about electronics, Linux, Raspberry Pi and stuff
Thursday, May 12, 2016
Bluetooth ICs comparison
Here's a comparison of some Bluetooth SOCs:
STM32 MCUs comparison
STM32 microncontrollers comparison
Digikey link![]() |
source: STMicroelectronics |
Mainstream
F0
F1

F3

High performance
F2
F4

F7

Ultra low power
L0
L1
L4
Friday, January 29, 2016
Kali 2.0 on Raspberry Pi
How to run Kali 2 on RPi2
(source)
You need a microSD that's at least 8GB
Download the image here : https://www.offensive-security.com/kali-linux-arm-images/
Download Win32 Disk Imager : http://sourceforge.net/projects/win32diskimager
Download 7-zip if you don't have it : 7-zip.org
Extract the image with 7-zip
Use Win32 Disk Imager to install the img on the microSD card
The default username and password is 'root' and 'toor'
Set a static IP address (source)
If you want to use your Pi with ssh it's better is you set a static IP address.
You need a microSD that's at least 8GB
Download Win32 Disk Imager : http://sourceforge.net/projects/win32diskimager
Download 7-zip if you don't have it : 7-zip.org
Extract the image with 7-zip
Use Win32 Disk Imager to install the img on the microSD card
The default username and password is 'root' and 'toor'
If you want to use your Pi with ssh it's better is you set a static IP address.
nano /etc/network/interfaces
Modify the eth0 part so it's like this:
auto eth0
iface eth0 inet static
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
broadcast 192.168.0.255
restart connection (don't do it from ssh on eth0 cause you will lose the connection)
ifdown eth0
ifup eth0
Done! Now you can login with ssh
Install wifite
netmask 255.255.255.0
broadcast 192.168.0.255
ifdown eth0
ifup eth0
Wifite is a tool to test the security of WiFi networks
apt-get update
apt-get install wifite
Install Raspi-config
apt-get update
apt-get install wifite
With raspi-config you can extend the partition size so that you use the entire uSD card.
apt install alsa-utils
wget http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20160108_all.deb
wget http://http.us.debian.org/debian/pool/main/l/lua5.1/
wget http://http.us.debian.org/debian/pool/main/t/triggerhappy/triggerhappy_0.3.4-2_armhf.deb
dpkg -i triggerhappy_0.3.4-2_armhf.deb
dpkg -i
dpkg -i raspi-config_20160108_all.deb
raspi-config manual
Run raspi-config and extend the uSD card partition size.
wget http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20160108_all.deb
wget http://http.us.debian.org/debian/pool/main/l/lua5.1/
lua5.1_5.1.5-7.1_armhf.deb
wget http://http.us.debian.org/debian/pool/main/t/triggerhappy/triggerhappy_0.3.4-2_armhf.deb
dpkg -i triggerhappy_0.3.4-2_armhf.deb
dpkg -i
lua5.1_5.1.5-7.1_armhf.deb
dpkg -i raspi-config_20160108_all.deb
WiFi commands
Scan WiFi networks
iwlist wlan0 scan
Scan WiFi networks and only show the SSID
iwlist wlan1 scan | grep SSID
Turn the WiFi adapter on or off
ifconfig wlan0 up
ifconfig wlan0 down
Connect to WEP WiFi network from terminal
iwconfig wlan0 essid NAME key PASSWORD
dhclient wlan0
Connect to WPA WiFi network from terminal
(source)
dhclient wlan0
(source)
First you need to install wpasupplicant.
Turn the WiFi on
ifconfig wlan0 up
wpa_passphrase NETWORKSSID > wpa.conf
then enter password
apt-get install wpasupplicant
ifconfig wlan0 up
then enter password
wpa_supplicant -B -Dwext -iwlan0 -c/wpa.conf
dhclient -r
dhclient wlan0
dhclient wlan0
Wifite
(source)
wifite
Ctrl-C to stop scanning and start hacking
enter target number and press enter
When hacking WPS enable routers:
Step 1: Pixie dust attack
list of vulnerable routers
Step 2:Brute force
can take a long time
Step 3:Handshake capture
If wifite succeeds at getting the handshake, you have to crack it to get the password
To do so, you can use cowpatty or aircrack-ng.
to be continued...
To list all devices on the network
nmap -sP 192.168.0.0/24
Find the OS of a device
nmap -O 192.168.0.99
Ctrl-C to stop scanning and start hacking
enter target number and press enter
Step 1: Pixie dust attack
list of vulnerable routers
can take a long time
If wifite succeeds at getting the handshake, you have to crack it to get the password
To do so, you can use cowpatty or aircrack-ng.
to be continued...
nmap
(source1) (source2)
nmap is used to scan your network.
nmap -sP 192.168.0.0/24
nmap -O 192.168.0.99
Useful linux commands
Related to files
MOVE
mv path path
COPY
cp path path
REMOVE
rm file
rm -r folder
UNTAR
tar -xvzf file.tar.gz
tar -xvjf file.tar.tbz
or install dtrx
REDIRECT
> redirects stdout to file and overwrites
>> redirects stdout to file and appends
< redirects stdin to a command
PIPE
| gives the output of a command as input to another command
LIST FOLDERS
ls -d */
LIST FILES WITH SIZE
ls -lhS
FIND FILE
find -iname "filename"
GREP
find text in file/text
dpkg --list | grep PACKAGE
case insensitive
grep -i ...
find text in files
grep -R wordtofind /home/luke
SORT
sort text.txt > sorted-text.txt
UNIQ
uniq text.txt > uniq-text.txt
REPLACE TEXT
replace only first occurrence on each line
sed 's/texttofind/textreplace/' text.txt
replace all (add g)
sed 's/texttofind/textreplace/g' text.txt
REMOVE A LINE IF CONTAINS PATTERN
awk '!/patterntofind/' file1 > file2
sed '/patterntofind/d' ./file1 > ./file2
Related to disks
MOUNT
sudo mount -t vfat /dev/sdb1 /media (FAT)
sudo mount /dev/sdb1 /media (ext)
sudo mount -t ntfs /dev/sdb1 /mnt/drive (NTFS)
UNMOUNT
sudo umount /path
AVAILABLE SPACE
df -Bm
LIST PARTITONS (needs parted)
sudo parted
print all
CLONE A DISK
sudo dd if=/dev/sdb of=/dev/sdc bs=4096 conv=notrunc,noerror
WRITE AN IMAGE ON A DISK
sudo dd if=sdcard.img of=/dev/sdb
Related to the computer
AVAIL RAM
free -m
CPU USAGE
top
GET CPU INFO
cat /proc/cpuinfo
CHECK BATTERY POWER
cat /sys/class/power_supply/BAT0/power_now
LIST DRIVERS
lsmod
GET DRIVER INFO
modinfo MODULE
GET ENV INFO
env
LIST USB DEVICES
lsusb
GET CPU TEMP
Raspberry Pi
vcgencmd measure_temp
PC
cat /sys/class/thermal/thermal_zone0/temp
Related to packages
LIST INSTALLED PACKAGES (with version and info)
dpkg --list | grep PACKAGE
INSTALL DEB PACKAGE
sudo dpkg -i PACKAGE
sudo apt-get install -f
DOWNLOAD A GIT FOLDER
git clone <url>
Related to network
LIST NETWORK ADAPTERS
ifconfig
LIST WIFI ADAPTERS
iwconfig
SCAN WIFI
iwlist wlan0 scan
CONNECT TO WPA WIFI
wpa_passphrase NETWORKSSID > wpa.conf
then enter password
then enter password
sudo wpa_supplicant -B -Dwext -iwlan0 -c wpa.conf
sudo dhclient -r
sudo dhclient wlan0
Thursday, January 28, 2016
OSMC on Raspberry Pi
(This page is a work in progress)
If you want to play or stream movies and TV shows or watch Youtube with a Raspberry Pi, the easiest way is to install OSMC. The Raspberry Pi has a HDMI connector so you can easily connect it to your TV.
1. First get a microSD card (Raspberry Pi 2) or SD card (Raspberry Pi) of at least 4GB.
2. Download the installer and follow the steps until you have your SD card ready:
https://osmc.tv/download/
3. Put the SD card in the Raspberry Pi and connect the micro USB connector to power it on.
Now it's time to get some movies and install some apps.
Note: For the power supply I recommend using one that can supply 2A. If you only have a 1A power supply it will work but if you connect a lot of things maybe you won't have enough power. Also, the USB cable is important. If it's too long or if it's not rated for high current, the voltage drop in the cable will be so high that the Pi won't be able to work. If you see a multi-color square in the top right corner, that means the voltage on the Pi is too low.
How to name files so they appear in the library
With Genesis you can stream movies and TV shows.
Download and unzip the file in ../home/osmc/.kodi/userdata/addon_data
http://iwillfolo.com/wordpress/wp-content/uploads/download_dir/plugin.video.genesis/plugin.video.genesis-5.1.4.zip
../home/osmc/.kodi/userdata/addon_data/plugin.video.genesis/TVShows
If you want to play or stream movies and TV shows or watch Youtube with a Raspberry Pi, the easiest way is to install OSMC. The Raspberry Pi has a HDMI connector so you can easily connect it to your TV.
1. First get a microSD card (Raspberry Pi 2) or SD card (Raspberry Pi) of at least 4GB.
2. Download the installer and follow the steps until you have your SD card ready:
https://osmc.tv/download/
3. Put the SD card in the Raspberry Pi and connect the micro USB connector to power it on.
Now it's time to get some movies and install some apps.
Note: For the power supply I recommend using one that can supply 2A. If you only have a 1A power supply it will work but if you connect a lot of things maybe you won't have enough power. Also, the USB cable is important. If it's too long or if it's not rated for high current, the voltage drop in the cable will be so high that the Pi won't be able to work. If you see a multi-color square in the top right corner, that means the voltage on the Pi is too low.
How to add movies to the library
The easiest is to have a hard drive connected to the Pi. Before you do that you need to know that most hard drives need more current than what the Pi can supply.
Go to My OSMC (in programs)
Pi Config
add max_usb_current=1 (it is not usb_max_current=1)
Done, write
Even with that activated, I had the undervoltage rainbow square in the corner of my TV. That means the voltage drops due to too much current. My cable had 2 USB connectors so I taped the 5V pin on the one going to the Pi and connected the other one to a 5V USB adapter.
How to name files so they appear in the library
For movies :
\Movies\Avatar (2009)\somefilename.mkv \Movies\The Usual Suspects (1995)\somefilename.avi
For TV shows :
TV Shows |----TV Show 1 | |----Season # | |--Files Then for every episode:
- Show with season
- anything_s01e02.ext
- anything_s1e2.ext
- anything_s01.e02.ext
- anything_s01_e02.ext
- anything_1x02.ext
- anything_102.ext
Show without season
- anything_ep02.ext
- anything_ep_02.ext
- for mini-series or short documentary series.
- anything_part.II.ext
- anything_pt.II.ext
- anything_pt_II.ext
How to stream movies and TV shows
Download and unzip the file in ../home/osmc/.kodi/userdata/addon_data
http://iwillfolo.com/wordpress/wp-content/uploads/download_dir/plugin.video.genesis/plugin.video.genesis-5.1.4.zip
Link Genesis library with OSMC library
Make a shortcut of this path in OSMC home folder :../home/osmc/.kodi/userdata/addon_data/plugin.video.genesis/TVShows
Then go to Movies->Files->Add Source and add the shortcut.
First, you need to give a static IP address to your Pi so that the apps don't need to be configured again every time you reboot your Pi.
Go to My Osmc - Network and configure network manually
To control OSMC with your phone, install Yatse:
https://play.google.com/store/apps/details?id=org.leetzone.android.yatsewidgetfree&hl=en
To control OSMC with Google Chrome, install Play to Kodi:
https://chrome.google.com/webstore/detail/play-to-kodi/fncjhcjfnnooidlkijollckpakkebden?hl=en
Follow this tutorial :
http://codeyarns.com/2014/07/05/how-to-torrent-on-raspbmc-using-transmission/
-To go to the terminal exit osmc (not reboot) and press Escape
-If OSMC is playing something, hitting backspace returns to the menu and hitting Tab will go back to what's playing.
How to control OSMC from your computer or phone
First, you need to give a static IP address to your Pi so that the apps don't need to be configured again every time you reboot your Pi.
Go to My Osmc - Network and configure network manually
To control OSMC with your phone, install Yatse:
https://play.google.com/store/apps/details?id=org.leetzone.android.yatsewidgetfree&hl=en
To control OSMC with Google Chrome, install Play to Kodi:
https://chrome.google.com/webstore/detail/play-to-kodi/fncjhcjfnnooidlkijollckpakkebden?hl=en
How to download torrents
If you have a hard drive connected to your Pi you can turn it into a torrent machine!Follow this tutorial :
http://codeyarns.com/2014/07/05/how-to-torrent-on-raspbmc-using-transmission/
Some useful info about OSMC
-Default username and password is osmc and osmc-To go to the terminal exit osmc (not reboot) and press Escape
-If OSMC is playing something, hitting backspace returns to the menu and hitting Tab will go back to what's playing.
Subscribe to:
Posts (Atom)