25 April, 2015

Raspberry Pi 2 Setup


Services:
-------------------------------


! Resize Partition
root@kali:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          2.9G  2.7G   13M 100% /
/dev/root       2.9G  2.7G   13M 100% /
devtmpfs        460M     0  460M   0% /dev
tmpfs            93M  512K   93M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           186M     0  186M   0% /run/shm

! Unplug SD card from Raspberry Pi, connect to Live CD linux and resize Partition using Gparted.

root@kali:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           15G  2.7G   11G  20% /
/dev/root        15G  2.7G   11G  20% /
devtmpfs        460M     0  460M   0% /dev
tmpfs            93M  512K   93M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           186M     0  186M   0% /run/shm

-------------------------------

! Setup WIFI

root@kali:~#
apt-get install wireless-tools
root@kali:~# apt-get install wpasupplicant
root@kali:~# apt-get install lynx
root@kali:~# vi /etc/network/interfaces
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "Ssid"
wpa-psk "Password"

root@kali:~# ifup wlan0
root@kali:~# dhclient wlan0

! Connect to Hidden Wifi
root@kali:~# wpa_passphrase "name" "Password"
network={
        ssid="name"
        #psk="Password"        
psk=78b7b953e82d25cc96063940fb2ea4f43dbd93f4167dfc92af7c0ef499bfbae1
}
root@kali:~# vi /etc/network/interfaces
auto wlan2
allow-hotplug wlan2
iface wlan2 inet dhcp
wpa-scan-ssid 1
wpa-ap-scan 1
wpa-key-mgmt WPA-PSK
wpa-proto RSN WPA2
wpa-pairwise CCMP AES
wpa-group CCMP AES
wpa-ssid "name"
wpa-psk 78b7b953e82d25cc96063940fb2ea4f43dbd93f4167dfc92af7c0ef499bfbae1

-------------------------------

! Install DHCP Server

root@kali:~# apt-get installisc-dhcp-server
root@kali:~# vi /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8;
range 192.168.1.50 192.168.1.100;
}

root@kali:~# vi /etc/default/isc-dhcp-server

INTERFACES="wlan1"
DHCPD_PID=/var/run/dhcpd.pid
DHCPD_CONF=/etc/dhcp/dhcpd.conf


root@kali:~# vi /etc/network/interfaces
auto wlan1
iface wlan1 inet static
address 192.168.1.1
allow-hotplug wlan1
netmask 255.255.255.0

root@kali:~# service isc-dhcp-server start

-------------------------------

! Configure Access Point
root@kali:~# apt-get install hostapd
root@kali:~# vi /etc/hostapd/hostapd.conf
interface=wlan0
driver=rtl871xdrv
ssid=Name
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

root@kali:~# vi /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

! Update hostapd
wget http://adafruit-download.s3.amazonaws.com/adafruit_hostapd_14128.zip

root@kali:~# apt-get install unzip
root@kali:~# unzip adafruit_hostapd_14128.zip
root@kali:~# mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
root@kali:~# mv hostapd /usr/sbin
root@kali:~# chmod 755 /usr/sbin/hostapd

root@kali:~# service hostapd start 
root@kali:~# service isc-dhcp-server start

! Starts Broadcast SSID
root@kali:~# /usr/sbin/hostapd /etc/hostapd/hostapd.conf

! Starts DHCP and AP on Startup
root@kali:~# update-rc.d hostapd enable
root@kali:~# update-rc.d isc-dhcp-server enable
root@kali:~# update-rc.d isc-dhcp-server defaults

-------------------------------

! Change Terminal

root@kali:~# apt-get install Yakuake

-------------------------------

! Install Web Browser
root@kali:~# apt-get install epiphany-browser

-------------------------------

! Install and setup VNC Server
root@kali:~# apt-get install tightvncserver
root@kali:~# /usr/bin/tightvncserver
root@kali:~# vi /root/.vnc/kali:X.log
! By Default Port : 590X
root@kali:~# vi tightvncserver-init.txt
#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
#
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='root'
### End customization required

eval cd ~$USER

case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    pkill Xtightvnc
    echo "Tightvncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

root@kali:~# mv tightvncserver-init.txt /etc/init.d/tightvncserver
root@kali:~# chown root:root /etc/init.d/tightvncserver
root@kali:~# chmod 755 /etc/init.d/tightvncserver
root@kali:~# update-rc.d tightvncserver defaults
root@kali:~# /etc/init.d/tightvncserver start/stop
root@kali:~# reboot

-------------------------------

! Start GUI Wireshark Capture 
root@kali:~# wireshark -i wlan0 -k -w test.pcap
-k start capturing immediately
root@kali:~# ls -l | grep test
-rw------- 1 root root 876224 Apr 25 12:14 test.pcap

! Start Command Line Wireshark Capture 
root@kali:~# apt-get install tshark
root@kali:~# tshark -i wlan0 -w test2.pcap
root@kali:~# ls -l | grep test2
-rw------- 1 root root 22432 Apr 25 12:23 test2.pcap

-------------------------------

! Install Scapy 
root@kali:~# apt-get install scapy

-------------------------------

! Install Iptraf
root@kali:~# apt-get install iptraf

-------------------------------