Accessing Raspberry Pi from your laptop

This is a small post on how to access the Pi with your laptop, in case you don’t have an external monitor and keyboard. One of my friend got this new Raspberry Pi 2 Model B and we tested it.

 

This model comes with 4 USB ports, 1 ethernet port, 1 HDMI port, audio port, SD card slot, GPIO Header. This models comes with the mini USB wifi adapter, micro SD card with pre-installed OS (NOOBS).

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux

pi@raspberrypi ~ $ cat /proc/version
Linux version 3.18.11-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 – Linaro GCC 2014.03) ) #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015

pi@raspberrypi ~ $ uname -r
3.18.11-v7+

Either you would need an monitor supporting HDMI with a keyboard to see it boot and configure it accordingly. For us we did had any external monitor so we got it working by connecting it to our laptop and configuring dhcp server on my laptop.

We used tftpd32: http://tftpd32.jounin.net , which also can be configured for dhcp and connected our Pi to my laptop.

 

The Pi got an ip and we were good to go.

 

Finally you can use putty to ssh to your Pi.
If you have a wireless network available you can also configure the Pi to connect to the wireless ssid. First of all make sure that the wireless adapter is getting detected.
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 007: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

 

Do iwconfig to check if the wireless interface shows here. You can also do, sudo ifdown wlan0/sudo ifup wlan0 to bounce the interface.

 

Use the command : sudo iwlist wlan0 scan  to scan the wifi network available, to make sure the network you are about to configure is seen in this list.

 

Now open the wpa-supplicant.conf file using nano or vi and edit it to add you desirable network to the list. Goto the bottom of the file and add:

 

network={
    ssid=”My-SSID”
    psk=”My-Password”
}

 

Save and exit and the Pi should connect to your wifi if configured correctly.

 

For me the Pi was getting an ip however was not able to go out to the internet for which I had to configure the default gateway as the gateway was not configured for my device:

 

pi@raspberrypi / $ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

 

sudo route add default gw 192.168.1.1 wlan0

 

pi@raspberrypi / $ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

 

Once the Pi has an ip address you can access the Pi GUI using couple of methods:

 

1. Using X11 Forwarding /Xming:

 

You can also use X11 forwarding and Xming to access the Graphic Interface of the Pi.
Open putty, specify the ip address of the Pi, use ssh/port 22. Goto X11 on putty window and enable X11 Forwarding and connect to your Pi.

 

 

On the Pi terminal type startlxde or lxsession and you should see the Pi desktop on Xming.

 

2.Using Xrdp :

 

You can install xrdp on Pi and rdp to it using the windows laptop.

 

pi@raspberrypi ~ $ sudo apt-get install xrdp
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
  xrdp
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 252 kB of archives.
After this operation, 1,499 kB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xrdp armhf 0.5.0-2 [252 kB]
Fetched 252 kB in 1s (135 kB/s)
Selecting previously unselected package xrdp.
(Reading database … 79469 files and directories currently installed.)
Unpacking xrdp (from …/xrdp_0.5.0-2_armhf.deb) …
Processing triggers for man-db …
Setting up xrdp (0.5.0-2) …
[….] Generating xrdp RSA keys……
Generating 512 bit rsa key…
ssl_gen_key_xrdp1 ok
saving to /etc/xrdp/rsakeys.ini
done (done).
[ ok ] Starting Remote Desktop Protocol server : xrdp sesman.

 

Open remote desktop (mstsc.exe) and connect to you Pi ip. You will be presented with the login screen, feed the Pi credentials and there you go.

 

 

Hope this would be helpful.

Some Fun

It was this lonely weekend.. I was reading some Linux blogs to add to my Linux skills when was stuck with a though to try out some hack as I saw in some movie/real life (You will know as you start reading ;)) 

So the company I work for holds a directory listing of employees (U got it where I am heading towards). You can access each employees detail along with their pic doing a search with their id (Active Directory Account).

 

The first challenge I faced was how to get the id of the people. I found that their id is also their email address so if the id is : abcd   then their email address is  abcd@XYZ.com.

 

So I could easily get the id of the people if I can somehow download all the email addresses in the organisation. But how to do that..
Doing some search I found that i can install Microsoft xchange management tool on my laptop/windows 7 and get connected to my exchange server. I can then use the exchange shell and cmdlets to connect to my exchange server and download all the email accounts.

 

How to install the Exchange management tool:
==================================

 

 

How to use the exchange shell to get the email accounts:
===========================================

 

 

Once I was able to get the email accounts. I just had to do some data formatting. Couple of Linux tools helped me with this.
virtual-machine:~$ grep -E -o “b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+b” addr.txt > hello.txt
 
 
addr.txt is the file I got from the exchange tool with all the email addresses. With the above script I got a hello.txt file which only contained the email addresses.
virtual-machine:~$ more hello.txt | awk -F”@” ‘{print $1}’ > hella.txt
I further modified it to only contain the username (Active Directory id). I also did a filter to remove duplicate entries.
virtual-machine:~$ sort -u hella.txt > final.txt
I have the final file now which contains the user accounts/ids.

 

I now basically wanted to see if I can download the images/pic for the associated ids. Working with the company portal directory listing I found a common place from where the images are being pulled.
It was something like:
http://www.xyzcompany.com/dir/abcd/zoom/userid
 
 
So my next task was to find a tool which could take the ids as feed and use the above url to download the pics associated with the ids.
Here wget was very useful for me which served the purpose.
wget -i final.txt
 

 

This was some fun…

Music

My Guitar

 

This is an Ashton D20 darling, a beginners guitar.

Type: Dreadnought Acoustic
Back & Sides: Basswood
Neck: Maple

Product Specifications:
====================

Spruce Top
Basswood Back & Sides
Rosewood Fingerboard
Maple Neck
Matte Finish
Die Cast Chrome Machine heads
Black Binding
Natural Rosette

https://www.youtube.com/watch?v=F3-r48hdDVc

https://www.youtube.com/watch?v=hZSkIPj-qRs

Look around through the eyes of EarthCam

EarthCam has live webcams around the globe through which you can experience the hustle and bustle of Times Square, be a party of the action in the heart of New Orleans, see the famous Abbey Road crossing in London and enjoy a beautiful sunset over the historic Hagia Sophia in Istanbul. Explore the world now with live views! Explore your planet LIVE.

http://www.earthcam.com/

Checkout the live feed from Statue of Liberty, view from the torch:

http://www.earthcam.com/usa/newyork/statueofliberty/?cam=liberty_hd

Wondering how the technology has grown and now you are being monitored everywhere…

 

Hope you liked this post….

Unsecured Camera Streams on the Internet

Security Camera’s are everywhere these days, often we find them not not properly secured. Doing a google search you can easily get access to many camera and see what is being monitored. You would be astonished to find that some of them are left to default security credentials. Here are couple of my searches.The Linksys Wireless camera are often used at homes. Doing a common search you know these devices use a default username/password as admin/admin.

I did a google search and see what I found:

 

You can easily see what is being monitored:

 

You can also login to some of these camera’s using the admin/admin credentials as they are not even changed from default.

Other similair search queries I found of wikihow are :

inurl:/view.shtml
inurl:ViewerFrame?Mode=
inurl:ViewerFrame?Mode=Refresh
inurl:view/index.shtml
inurl:view/view.shtml
liveapplet
intitle:”live view” intitle:axis
intitle:liveapplet
allintitle:”Network Camera NetworkCamera”
intitle:axis intitle:”video server”
intitle:liveapplet inurl:LvAppl
intitle:”EvoCam” inurl:”webcam.html”
intitle:”Live NetSnap Cam-Server feed”
intitle:”Live View / – AXIS 206M”
intitle:”Live View / – AXIS 206W”
intitle:”Live View / – AXIS 210?
inurl:indexFrame.shtml Axis
intitle:start inurl:cgistart
intitle:”WJ-NT104 Main Page”
intitle:snc-z20 inurl:home/
intitle:snc-cs3 inurl:home/
intitle:snc-rz30 inurl:home/
intitle:”sony network camera snc-p1?
intitle:”sony network camera snc-m1?
intitle:”Toshiba Network Camera” user login
intitle:”i-Catcher Console – Web Monitor”

Beware you might be tracked accessing the unsecured cameras. Do not try to break into any of them or change any thing on these devices.

Hope you liked this post….