INSTALLING USING THE RASPBERRY PI PIRATEBOX IMG FILE DOWNLOADED FROM THE INTERNET:

After flashing the Raspberry P versions of the PirateBox onto the SD card, use the 
PirateBox Raspberry Pi DIY instructions (not the manual version).

Note that when flashing the downloaded raspberry pi piratebox image, you will not
be able to connect with a keyboard and mouse--the way you can when you start with
a Raspbian installation and modify is as described in the "manual" installation
of the pirate box software (the one where you use the piratebox-ws_current.tar.gz
file, which I struggled and struggle with and could never get to work completely.

Before connecting to the Raspberry pi PirateBox by ethernet for the first time,

you will have to follow the step under the critial note section. After the PirateBox has been set up, you can no longer connect by ethernet to the laptop. You may only connect by wifi (using: ssh alarm@192.168.77.1 and password: <>, the password I created). Even before you have modified it in any way, you may not be able to get in by ethernet cable, so you may have to use wifi instead! CRITICAL NOTE: Each time you switch SD cards with a different flash of PirateBox, before you can ssh into the PirateBox, you must type: ssh-keygen -f "/home/mint/.ssh/known_hosts" -R 192.168.77.1 on the linux computer that you are trying to SSH into the PirateBox with. Otherwise, on wifi, you will get an error message that starts: "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! ..." And you will get a NETWORK UNREACHABLE error message when you try to connect by ehternet. Further Obserations: When you ping 192.168.77.241 (the piratebox) or 192.168.77.1 (the raspberry pi) or ping almost any word or ip address, you should get a message that says: 64 bytes from icmp_seq=1 ttl=64 time = ms I have no idea why you get communication when you ping nonsense host names and IP addresses! Then to get to the piratebox web page (on the raspberry pi), type into the URL in the browser 192.168.77.1 . If you enter any other URL in linux, you will get an error. However, you can type anything (that does not begin with https--on most browsers) into the URL line in the browser, and you WILL get to the piratebox web page! You will NOT get there on some other computers!!! I was not getting there on the laptop, because my home page was an https page! If I type anything else in the URL line, I get to the PirateBox GUI. If you bring down the wlan0 interface on the piratebox using: sudo ifconfig wlan0 down, and then bring it back up again, you will still be able to ping any random IP or name and get communication, but when you type 192.168.77.1 into the browser, you will only get an error message! So, never shut down the wlan0 inteface without rebooting afterwards! By WiFi, SSH into the PirateBox as follows: ssh alarm@192.168.77.1 The password is "alarm" by default, but I have reset it to: <> This will get you to a Raspberry Pi command prompt. IMPORTANT: If you decided to store data (including html pages) on the USB stick (as per "Manually Configure USB" in the additional raspbery pi mods document), you must point to the USB stick directories in the /etc/lighttpd/lighttpd.conf file !!! This is for version 1.1.3 only. Version 1.1.4 does this with the script /opt/piratebox/rpi/bin/usb_share.sh . To USE A USB WIFI ADAPTER: To change to a usb wifi adapter, you MUST change the /boot/wifi_card.conf file to read "wlan1" instead of "wlan0". Otherwise, changing the hostapd.conf and piratebox.conf files in /opt/piratebox/conf/ won't matter, because they will be over- written at boot back to "wlan0". DEFINING WIFI SETUP: Define the txpower, channel, etc. of the wifi connection by modifying the hostapd, piratebox.conf, and wpa_supplicant files. To switch from wlan0 (the built-in antenna) to wlan 1 (the USB antenna) and change the
power used by a wifi adapater, add the following lines to /opt/piratebox/conf/piratebox.conf: #Iw physical interface PHY_IF="phy1" # Name of the wlan interface INTERFACE="wlan1" iw reg set GY iwconfig wlan1 txpower 26 #Alfa won't actually output this much power.
#It's limited to about 50 mW, no matter what Alfa advertising claims! In /opt/piratebox/conf/hostapd.conf add or modify: interface=wlan1 driver=nl80211 channel=11 TO INSTALL NMAP: Modify /etc/resolv.conf by replacing the nameserver IP that is there with 8.8.8.8. This makes DNS work again. Then update the Arch Linux installation with "sudo pacman -Syy". Then "pacman -S nmap". The command "sudo pacman -Syu" would have upgraded arch linux. For some reason, if you choose to upgrade arch linux, you will have to reset the alarm and root password with "sudo passwd alarm", etc. WHENEVER YOU USE A DIFFERENT USB STICK: Whenever you use a different USB stick, you need to remove the mount line in the /etc/fstab file that is specific to that USB stick and replace it with: /dev/sda1 /mnt/usbdrive vfat uid=nobody,gid=nogroup,umask=0,noatime,rw,user 0 0 Then, to create a process to log the MAC addresses and dates of everyone who logs onto the PirateBox, on the PirateBox create a systemctl (systemd) daemon called rc-local. This forces rc.local to start in Arch Linux at boot: sudo cp rc.local /etc/. sudo cp rc-local.service /usr/lib/systemd/system/rc-local.service sudo systemctl enable rc-local # makes rc-local.service start on bootup sudo systemctl start rc-local # starts rc-local.service this now sudo cp my_logger.sh /etc/. sudo chmod 744 /etc/my_logger.sh Then add the following line to rc.local before the exit 0 line: sudo ./my_logger.sh If the rc-local.service daemon won't run. Then just run my_logger.sh in the background by typing at the Linux prompt: sudo /etc/my_logger.sh & You'll have to do this each time you reboot the PirateBox! An alternative to putting a call to the my_logger.sh function into rc.local and making rc.local be called at boot is to make my_logger.sh it's own daemon. This would require you to take the my_logger.service, my_logger.pid, my_logger.sh, etc. files from this folder and put them onto the piratebox--using the piratebox and rc.local daemons as examples. rc.local file contents: #!/bin/bash # Written on 6-9-18 echo -e '\n\033[1;32m RC.LOCAL HAS BEEN EXECUTED\033[0m' echo -e '\n\033[1;32m RC.LOCAL HAS BEEN EXECUTED\033[0m' echo -e '\n\033[1;32m RC.LOCAL HAS BEEN EXECUTED\033[0m' printf "Executing rc.local..." # The next line will not ececute without "sudo". sudo /etc/my_logger.sh & echo -e '\n\033[1;32m MY_LOGGER.SH HAS BEEN EXECUTED\033[0m' echo -e '\n\033[1;32m MY_LOGGER.SH HAS BEEN EXECUTED\033[0m' echo -e '\n\033[1;32m MY_LOGGER.SH HAS BEEN EXECUTED\033[0m' exit 0 Contents of my_logger.sh: # # This program logs the mac address of everyone logged on # to the PirateBox and the associated date. # # Written on 6-7-18 # # To install and run this on Mint 17, # Copy your rc.local and my_logger.sh files into /etc/init.d, and type: # # sudo update-rc.d rc.local defaults # sudo update-rc.d my_logger.sh defaults # # To stop it and restart it, type: # # sudo service my_logger.sh start # sudo service my_logger.sh restart # # To install and run this on the PirateBox: # 1. sudo apt-get update # 2. Install nmap # 3. sudo chmod 744 my_logger.sh # 4. Copy my_logger.sh to /etc # 5. In /etc/rc.local add the line: sudo /etc/my_logger.sh & # 6. sudo chmod 744 rc.local # 7. To run rc.local at boot, do the following: # From: https://raymii.org/s/tutorials/rc.local_support_on_Arch_Linux_and_systemd.html #Arch Linux uses systemd. Therefore, init functions like rc.local are not supported anymore. #This systemd service allows you to have support for /etc/rc.local. #Edit /usr/lib/systemd/system/rc-local.service: # [Unit] # Description=/etc/rc.local compatibility # [Service] # Type=oneshot # ExecStart=/etc/rc.local # RemainAfterExit=yes # [Install] # WantedBy=multi-user.target #Enable it: # sudo systemctl enable rc-local.service #!/bash/bin my_mac_E6500='00:17:EF:6E:60:A2' #my_mac_E6500='FF:FF:FF:FF:FF:FF' # for testing my_mac_E6220='D0:DF:9A:F6:BC:EB' my_mac_Ralink='70:F8:1C:D2:1D:3A' my_mac_cellphone='40:DB:59:5F:52:40' # my_TPLink='?' my_macs="my_mac_E6500 my_mac_E6220 my_mac_Ralink my_mac_cellphone my_mac_E6220" # Wait for the network to come up before continuing. sleep 300 printf "Beginning logging with my_logger.sh" while [ 1 ] do MAC_line='' # Scan the IP addresses 192.168.77.0 through 192.168.77.256 to see if anything is # connected, and if so, the mac addresse of the connected computers. # Must use sudo here to get MAC addresses, otherwise you get IP addresses!!! MAC_line=`sudo nmap -sn 192.168.77.0/24 | grep "MAC Add"` #echo -e "MAC_line= $MAC_line" #debug mac=${MAC_line:13:17} #echo -e "mac= $mac" #debug if [ -n "$MAC_line" ] # Quotes must be around MC_line or this will not work! then # Search through the mac addresses of my computers to see if the first one # in MAC_line is one of them. If it is, don't do anything. result=0 for x in ${my_macs} do #echo -en "x = "; echo "$x" #debug #echo -en "\$x = "; eval echo -e "\${$x}" #debug eval dumX=\${$x} #echo -en "dumX = "; echo "$dumX" #debug if [ $mac = $dumX ] then result=1 #echo -e "result set to 1" #debug fi done # if none of the connected computers have any of my_macs mac addresses, then: #echo -e "result = $result" if [ "$result" = "0" ] then # Need to strip out "MAC Address:" from the following line. "-n" prevents line break. #echo -e " ${MAC_line} `date +%D\ %H:%M` | sed 's/MAC Address://' >> ~/mac_log #echo -e " ${MAC_line:13} `date +%D\ %H:%M`" >> ~/mac_log # Begin printing at element 14. echo -e " ${MAC_line#MAC Address: } `date +%D\ %H:%M`" >> /home/alarm/mac_log #echo -e " ${MAC_line#MAC Address: } `date +%D\ %H:%M`" #debug fi fi # Sleep 5 minutes and then do this again, because this is a daemon. sleep 300 #sleep 10 # for debugging done exit 0