Notices


Reply
Thread Tools
Posts: 7 | Thanked: 23 times | Joined on Sep 2012
#1
Updated to Prey 0.5.9

I've updated Prey to 0.5.9 on my N900 after seeing it was released and finding the geo module was no longer working on 0.5.3 due to Google changing their API. I've also gotten the rest of prey working, including the gateway IP address and the webcam (using gst-launch). The webcam on the N900 takes rather dim pictures, so you'll just have to hope that any would-be thief uses it in a well lit area.

I've changed this post quite a bit, so I've uploaded the old one here if anyone still wants to take a look at 0.5.3:
http://sprunge.us/RMFF

I've also made quite a few more changes this time around to get everything working, so to make it easier, I've just made a .tar.gz file of my working version to download. I'll go ahead and list out the changes at the bottom of this for those who are curious.

Installation

First, download my tar file (attached to this post). A note here: I've remove the GPL license file and the pixmaps image folder from the archive to get it under the 488KB upload limit on this forum. I've attached the license in a separate file so as to not break the terms of the GPL.

Once you download it, you will need to place it on your phone with whatever method you what (I used sftp). Then, untar the file to /home/opt/prey:

Code:
cd /home/opt
mkdir prey/
cd prey/
mv /directory/tar/file/is/in/prey-maemo-0.5.9.tar.gz ./
tar xvzpf prey-maemo-0.5.9.tar.gz

Next we'll need to get curl working. Install curl from extras-devel. Note that curl will not work right away. Maemo holds back the update to libcurl3 for some reason (no idea why here, but I haven't found any negative effects from updating it).

Code:
apt-get install curl
apt-get install libcurl3

Next we will need bash4 (the regular bash package will not work correctly), wireless-tools, gstreamer-tools and imagemagick.

Code:
apt-get install bash4 wireless-tools gstreamer-tools imagemagick

Last we need to set up cron. You may be able to use fcron here, but I used cron since the prey script tries to call `crontab` several times.

Code:
apt-get install cron
Add a startup script for cron, so it will start after a reboot.

/etc/event.d/cron:
Code:
start on started hildon-desktop
stop on starting shutdown
console none
service
script
/etc/init.d/cron start
end script
Then you want to add prey to your crontab (replace nano with whatever editor you use):

Code:
EDITOR=nano crontab -e
Add the line:

Code:
*/10 * * * * bash4 /home/opt/prey/prey.sh > /var/log/prey.log 2>&1
After that, we should be ready to set up prey. Create an account on http://preyproject.com/. Once you create the account, log in and click on the "Account" tab. Once there, find your API key on the left side. You'll need to copy this into the config file:

Code:
nano -w /home/opt/prey/config
Find the api_key='' line and add your API key there. Then run the prey.sh script (you may need to make it executable first):

Code:
cd /home/opt/prey
chmod +x prey.sh
bash4 prey.sh
This should create a device in your control panel. Check and see. Also make sure it added the device key into your config file below the API key. If not, add this in (device key is found in the control panel on the left side when viewing a device).

Once that is done, it should be ready to test. Mark the device as missing in the control panel and set the frequency to whatever you want (I use 10). Note that it will update your crontab entry based on this. I also set it to recieve every bit of data that it can. Everything should be working at this point, but note that I've hardcoded the modified files time to 1 hour and the path to /home/user/MyDocs. If you would like to change this, look at the manual changes section below to see where to edit it.

After that, wait and make sure you recieve a report after 10 minutes, or you can run prey.sh manually to check as well. I'd also reboot and test it as well just to make sure cron was set up correctly.

If you've gotten several reports and everything looks good, then congrats, you're done!

Manual Changes

This section is for anyone who is interested in the changes I made to the stock Linux Prey version (Download here: http://preyproject.com/download) to get everything working. I've you've downloaded my version and followed the directions above, you do not need to make these changes.

Applied this bug fix affecting Prey 0.5.9. Geolocation results came back incorrect, based on IP address only instead of nearby WIFI points, without this fix:
https://github.com/TAWood/prey-bash-...ae7e0a2b90e57a

config:
Prey switched to using SSL to submit reports and curl on Maemo fails when trying to verify the certificate, so the --insecure option needs to be added (if anyone can figure out a better way, let me know).
Code:
curl_options='--insecure --compress --connect-timeout 60'
core/functions:
Update the crontab line to use bash4.
Code:
update_execution_delay(){
        local full_path=$(full_path "$base_path")
        (crontab -l 2> /dev/null | grep -v prey; echo "${1}" "bash4 ${full_path}/prey.sh > /var/log/prey.log 2>&1") | crontab -
}
platform/linux/functions:
Change the whoami line to check for root instead of $logged_user:
Code:
if [ "`whoami`" != "root" ]; then
Prey was grabbing the IP address from the loopback device (127.0.0.1) instead of wlan0, so we just need to alter the get_ip_address() function slightly to grab the correct address:
Code:
get_ip_address(){
        ifconfig $1 2> /dev/null | grep "inet " | awk '{print $2}' | sed "s/127.0.0.1//" | sed "s/addr://" | awk '{ printf "%s", $0 }'
}
Maemo doesn't come with iproute2 (might be in busybox-power). Either way, I've just change the function to grab the gateway address to use `route` instead of `ip r`.
Code:
get_gateway_ip(){
        route | grep default | awk '{print $2}'
}
modules/network/platform/linux/functions:
Remove -p option and redirect errors to /dev/null.
Code:
get_active_connections() {
	active_connections=$(netstat -tun 2>/dev/null | grep -v "127.0.0.1")
}
modules/session/core/functions:
Busybox find doesn't support -mmin, so I've changed this to -mtime. Also used /home/user/MyDocs as the directory to search and removed the regex hiding hidden files since most of Maemo's files in MyDocs are in hidden directories (.images, .sounds, .documents, etc).
Code:
get_modified_files() {
	modified_files=`find /home/user/MyDocs -type f -mtime -1 2> /dev/null`
}
modules/webcam/platform/linux/functions:
Changed streamer to gst-launch here. Also just emptied the capture_video() function since it was using streamer doesn't seem to be needed.
Code:
take_picture() {

        # do we have streamer installed ?
        local streamer=`which gst-launch`
        if [ -n "$streamer" ]; then
                $streamer v4l2camsrc device=/dev/video1 num-buffers=1 ! dspjpegenc ! filesink location="$tmpdir/streamer3.jpeg" 2>&1 > /dev/null
                mv "$tmpdir/streamer3.jpeg" "$webcam__picture" > /dev/null
        fi

}

capture_video() {

        # we should already know if we do have streamer
        if [ -n "$streamer" ]; then
                echo -n ''
        fi

}
A small note on the above: You can change /dev/video1 to /dev/video0 if you would rather have it take a picture with the main camera than the front cam. Keep in mind though that the lens cover would need to be open, or all you would get would be a blank image.
Attached Files
File Type: gz prey-maemo-0.5.9.tar.gz (485.8 KB, 98 views)
File Type: gz LICENSE.tar.gz (12.0 KB, 85 views)

Last edited by Presence; 2013-02-04 at 16:26.
 

The Following 18 Users Say Thank You to Presence For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#2
Can you create a deb?
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2012-11-28 at 14:56.
 

The Following User Says Thank You to marmistrz For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#3
Originally Posted by marmistrz View Post
Can you create a deb?
Man, oh man!
You really quote this long and thorough explanation, making the thread a pain to scroll, just for your one-liner to beg for a deb???

You even received a 'Thanks' for that!!!

EDIT: THANKS for removing the quote, ...and letting me look like a dumb troll!

Last edited by michaaa62; 2012-11-28 at 15:28.
 

The Following 3 Users Say Thank You to michaaa62 For This Useful Post:
Wreck's Avatar
Posts: 304 | Thanked: 266 times | Joined on Apr 2011 @ Apeldoorn area, Netherlands
#4
Originally Posted by marmistrz View Post
Can you create a deb?
Wow just wow.
All the work the OP has done and you ask for a ****ing deb file. Be happy he already figured this out.

@Presence

Thanks, going to try it out when I get home
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#5
Originally Posted by Wreck View Post
Wow just wow.
All the work the OP has done and you ask for a ****ing deb file. Be happy he already figured this out.

@Presence

Thanks, going to try it out when I get home
I do am happy just forgot to click "thanks"
fixed the too long quote
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 

The Following User Says Thank You to marmistrz For This Useful Post:
Posts: 7 | Thanked: 23 times | Joined on Sep 2012
#6
Originally Posted by marmistrz View Post
Can you create a deb?
I have no real interest in this. I'm an Arch Linux user myself, so I have no idea how to package a .deb file. The point of this was to document how I took the stock package released by Prey and got it working on Maemo. If anyone else wants to take what is here and package it into a .deb file, they are more than welcome to.
 

The Following 2 Users Say Thank You to Presence For This Useful Post:
Posts: 238 | Thanked: 131 times | Joined on May 2011 @ Bulgaria
#7
Hi to all and Happy New Year,first congratulations for these tools,but i have a several problems about configuration files.
1.
Now comes the hard part. There's a few places we need to fix things to make prey work with Maemo. First edit the file prey/modules/geo/core/functions and add the line "wifi_points=${wifi_points//\\/}" under the if statement so it looks like this:
....
if [ -n "$wifi_points" ]; then
wifi_points=${wifi_points//\\/}
current_location_json....
in my prey/modules/geo/core/functions:
get_current_location() {
if [ -n "$wifi_points" ]; then

local query=$(echo $wifi_points | tr -d '}"\\' | \
awk 'BEGIN {RS=","; FS=":"}
/mac_address/ { gsub(/ /,"", $2); printf
where exactly i have to put that line wifi_points=${wifi_points//\\/}
under
if [ -n "$wifi_points" ]; then
2.That line no exist in prey/core/functions
(crontab -l | grep -v prey; echo "${new_delay}" "${full_path}/prey.sh > /var/log/prey.log") | crontab -
in my is
(crontab -l 2> /dev/null | grep -v prey; echo "${1}" "${full_path}/prey.sh > /var/log/prey.log 2>&1") | crontab -
maybe i have to remove:
(crontab -l 2> /dev/null | grep -v prey; echo "${1}" "${full_path}/prey.sh > /var/log/prey.log 2>&1") | crontab -
and paste this:
(crontab -l | grep -v prey; echo "${new_delay}" "bash4 ${full_path}/prey.sh > /home/opt/prey/prey.log") | crontab -
3.Last, edit platform/linux/functions and change the line
"if [ "`whoami`" != "$logged_user" ]; then"
to:
if [ "`whoami`" != "root" ]; then
this one is not problem,sorry if i ask to much from you but if someone is able to instаlled successfully,any help it will be very useful
regards
 
Posts: 2,290 | Thanked: 4,133 times | Joined on Apr 2010 @ UK
#8
Originally Posted by Presence View Post
I have no real interest in this. I'm an Arch Linux user myself, so I have no idea how to package a .deb file. The point of this was to document how I took the stock package released by Prey and got it working on Maemo. If anyone else wants to take what is here and package it into a .deb file, they are more than welcome to.
As an alternative you could look at SMSCON which was designed for Maemo to do a similar job.
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following 2 Users Say Thank You to sixwheeledbeast For This Useful Post:
Posts: 7 | Thanked: 23 times | Joined on Sep 2012
#9
Originally Posted by disappear View Post
this one is not problem,sorry if i ask to much from you but if someone is able to instаlled successfully,any help it will be very useful
regards
This guide was written for Prey 0.5.3. They've since updated to 0.5.9, and I haven't gotten around to installing the new version on Maemo, so it's possible there are some parts from the guide that may have changed. You can download 0.5.3 from their archive if you would rather try with that:
http://preyproject.com/releases/0.5.....5.3-linux.zip
 
Posts: 7 | Thanked: 23 times | Joined on Sep 2012
#10
I've updated the first post with directions for version 0.5.9.

Originally Posted by disappear View Post
Hi to all and Happy New Year,first congratulations for these tools,but i have a several problems about configuration files.
Looks like you were trying to apply my changes for 0.5.3 to version 0.5.9. If you are still looking to install this, check out my new post for directions for the new version.
 

The Following User Says Thank You to Presence For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 20:44.