Saturday, March 12, 2022

Hack the Planet!

As mentioned ealier, Hackers is one of my favorite movies. Inspired by the folks at Hackers Curator, I decided to build my own replica prop. But I plan to go one step further, and make mine at least somewhat functional. So, I've obtained a supposedly functional Motorola Advisor, plus a Motorola Bravo Encore to match Kate Libby's, plus several Motorola Advisor Golds for testing, since they were really cheap for a lot of 9. But before any of that came in (so far, the Advisor came in), I worked out how I was going to make it functional. Here is my plan:
  • Test all the pagers and figure out their capcodes.
  • Forward my Google Voice SMS to Gmail
  • Create a filter in Gmail to label SMS messages (I recommend SMS, which is in my .fetchmailrc below)
  • Allow imap in Gmail
  • Use fetchmail and a custom script to download/convert the SMS "folder" to a Raspberry Pi.
  • Use instructions here to transmit those messages to my pager, at least within range of my Pi.
So far, I've received the Motorola Advisor and made sure it powers on and holds time. I do not know the capcode, so I am working out how to find it. I have ideas, though ;) I've also configured fetchmail on my Raspberry Pi and written a custom script which leaves just the From and text of the SMS in a file on the Pi. Here's my fetchmail config.

.fetchmailrc:
poll imap.gmail.com
protocol IMAP
user "@gmail.com" with password "" mda "/home/pi/myfetchmailparser.sh"
folder 'SMS'
fetchlimit 1
keep
ssl
/home/pi/myfetchmailparser.sh:
#!/bin/bash
FilenameUniqueId=$(date +"%Y%m%d_%H%M%S_%N")
OutputFile="/var/tmp/mail"$FilenameUniqueId
TmpFile=$OutputFile".tmp"
echo "" > $TmpFile
while read x
do
#echo $x
echo $x >> $TmpFile
done
while read line; do
if [[ $line =~ From ]] ; then echo $line > $OutputFile; fi
done < $TmpFile
sed '1,//d;/To respond to this text message, reply to this email or visit Google Voice./,$d' $TmpFile >> $OutputFile
rm $TmpFile
Once I have the capcode of the pager, I will add code to */home/pi/myfetchmailparser.sh* from the link above to actually transmit the text of that file to my pager. **UPDATE:** I wrote a quick script to go through all possible 7-digit capcodes:
/home/pi/capcode.sh:
#!/bin/bash
for i in {0..99}
do
for num in {0..99999}
do
# printf -v cap "%02d%05dn" $i $num
# echo $cap
printf -v cmd 'echo -e "%02d%05d:CAPCODE %02d%05d" | sudo rpitx/pocsag -f "929037500" -b 3' $i $num $i $num
bash -c "$cmd"
sleep 30s
done
done
My pager frequency is labelled as 929.0375 Mhz, 929037500 above represents. That script sends "CAPCODE nnnnnnn" to every possible capcode on that frequency, sleeping 30 seconds between each. I do this for two reasons. First, so that when the last pager I have receives its capcode, I can break out of the script. Second, to keep it from completely spamming the frequency. I don't plan on running this without a bandpass filter and the output power is pretty low, but even so, I'd rather be a good neighbor and not interfere with anyone else. Considering the Pi outputs almost-square waves, the harmonics can be pretty nasty. Even though they're low power, a highly-tuned antenna could pick up a harmonic and piss someone off. Best to do what I can to mitigate that, and to stay within FCC part 15 rules. And the reason for the nested for loop... From 0 to seven 9's is just too much for bash on the Pi to handle via a single loop. Splitting it into two nested loops makes it begin execution much more quickly. I got tired of waiting when it was a single loop, and even only doing is to size 9's caused a significant delay on execution.

No comments:

Post a Comment