maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Prey antitheft for Jolla (https://talk.maemo.org/showthread.php?t=95940)

nieldk 2015-09-09 06:45

Prey antitheft for Jolla
 
Started this new thread, to replace the old one as it is out of date. The information below is in that old thread, but spread around, so here is a recollection to sum up the install procedure for new prey version:

To install recent nodejs build of Prey for SailfishOS:

Add my merproject repository

Code:

$ devel-su
# ssu ar nieldk http://repo.merproject.org/obs/home:/nielnielsen/sailfish_latest_armv7hl/
# pkcon refresh

Install nodejs and sudo

Code:

# pkcon install nodejs
# pkcon install sudo

Alternatively, install the rpm by downloading it from
https://build.merproject.org/package...latest_armv7hl

https://build.merproject.org/package...latest_armv7hl

If you do not want to add my repository.

Then, install prey:
You NEED to do this using devel-su!

Code:

$ devel-su
# npm install -g prey
# prey config hooks post_install
# prey config account setup

now enter your account credentials,
The device is added, and you are ready to track it on panel.preyproject.com
service to start prey on boot is installed and enabled automatically

nieldk 2015-09-09 06:46

Re: Prey antitheft for Jolla
 
So far, this is what is working:

* Get location of device
* Get device hardware information (CPU/memory)
* Get network information (IP, neighbour wlans)
* logged in user (usually nemo or root)

Features missing:
* Screenshot
* Camera
* Sound alerts on device
* Message alerts on device
* Lock device
* Erase device

Allthough the missing features are nice to have (especially the lock device) I believe it is at this point usefull that we can get location reports for a stolen device.

Prey have added the distro 'mer' to the recognized distributions, so, any updates that will be done to enable the missing features should be pushable to them, and as such that will make it much more easy to install, as everything will be part of Prey's 'native' eco system.

A certain well-known developer ;) may look at the Prey sources and hopefully, in a near future we can have a more SailfiishOS-native client, and hopefully Jolla can make this a part of 'standard firmware'.

What needs to be considered, is how to protect de-installation of Prey.
Prefferable Prey as service can be protected from de-installation, and any GUI part that would be de-installed would be for status information only.

hantoo 2015-09-13 17:50

Re: Prey antitheft for Jolla
 
Installed prey this morning, and couldn't get it to locate where my Jolla is. Went to terminal and typed Prey and it came up with this. Is there suppose to be that many errors and critical?
http://i.imgur.com/qLw5zm3.jpg

nieldk 2015-09-13 18:03

Re: Prey antitheft for Jolla
 
no.
Did you fllow instructions?

Not sure if it matters. But do try to install sudo.

coderus 2015-09-13 18:08

Re: Prey antitheft for Jolla
 
only i see dbus-monitor not found error in this image?

hantoo 2015-09-13 18:51

Re: Prey antitheft for Jolla
 
So after installing Sudo everything seems to be working. It still reports errors, some the same and some new. However it seems to be working : 'Prey' after installing sudo,
http://i.imgur.com/0NLjyqZ.jpg
After typing prey it would not let me type any other commands so I had to close the session. When I reconnected and typed prey it was happy :)
http://i.imgur.com/CuaTHYU.jpg

coderus 2015-09-13 19:25

Re: Prey antitheft for Jolla
 
also i decided to try prey myself, but:
Code:

Running "config activate" as prey
Error! Command failed: /bin/sh -c /usr/bin/node /usr/lib/node_modules/prey/node_modules/ocelot/runner.js prey /usr/lib/node_modules/prey/bin/prey config activate
child_process.js:1162
    throw errnoException(err, 'spawn');
          ^
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at exports.spawn (child_process.js:995:9)
    at run_command (/usr/lib/node_modules/prey/node_modules/ocelot/runner.js:60:15)
    at Object.<anonymous> (/usr/lib/node_modules/prey/node_modules/ocelot/runner.js:95:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)


nieldk 2015-09-13 20:46

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by coderus (Post 1482407)
also i decided to try prey myself, but:
Code:

Running "config activate" as prey
Error! Command failed: /bin/sh -c /usr/bin/node /usr/lib/node_modules/prey/node_modules/ocelot/runner.js prey /usr/lib/node_modules/prey/bin/prey config activate
child_process.js:1162
    throw errnoException(err, 'spawn');
          ^
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at exports.spawn (child_process.js:995:9)
    at run_command (/usr/lib/node_modules/prey/node_modules/ocelot/runner.js:60:15)
    at Object.<anonymous> (/usr/lib/node_modules/prey/node_modules/ocelot/runner.js:95:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)


Are you using my build of nodejs ?

nieldk 2015-09-13 21:23

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by coderus (Post 1482390)
only i see dbus-monitor not found error in this image?

Yeah. Prey needs sudo for some access, and to run scripts as a prey user

coderus 2015-09-13 21:24

Re: Prey antitheft for Jolla
 
works after running with devel-su, not root :)

rob_kouw 2015-09-14 15:10

Re: Prey antitheft for Jolla
 
Yes, it works again! :)

At the end of the installation I got a message that I should fire up a GUI. I lost the exact message, but nothing was fired up when I ran the command. So I got it working with:
Code:

prey config settings update api_key aa9999999999
prey config account setup

The API-key is found on the Settings page on the Prey website, left bottom corner.

In the meantime I tried the PreyGUI from Warehouse, but that did not do the trick. So I uninstalled it again.

rob_kouw 2015-09-14 15:28

Re: Prey antitheft for Jolla
 
Not everything is configurated now, it seems. Looking up the location from the Prey website provides the following log:
Code:

  notice Mon, 14 Sep 2015 15:22:36 GMT [control-panel] Got valid push request!
    warn Mon, 14 Sep 2015 15:22:38 GMT [control-panel] Got 1 commands.
    info Mon, 14 Sep 2015 15:22:45 GMT [reports] Gathering status report.
    error Mon, 14 Sep 2015 15:22:45 GMT [reports] Unable to get battery_status: Unable to read battery info.
    error Mon, 14 Sep 2015 15:22:45 GMT [reports] Unable to get logged_user: No logged user detected.
    info Mon, 14 Sep 2015 15:22:52 GMT [reports] Report gathered: status
    info Mon, 14 Sep 2015 15:22:52 GMT [control-panel] Posting data
    info Mon, 14 Sep 2015 15:22:53 GMT [control-panel] Got 200 response: OK

So the user is not detected or registered? I'm also puzzled by the following:
Code:

[root@Jolla nemo]# prey config check
Checking installation.
Installation seems to be clean as a bean. Good job!
Voila! All good.
[root@Jolla nemo]# prey config activate
Error! This command should be run as the prey user.


coderus 2015-09-14 18:04

Re: Prey antitheft for Jolla
 
install sudo ;)

rob_kouw 2015-09-14 19:44

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by coderus (Post 1482500)
install sudo ;)

I did. Followed the instructions by nieldk.

nieldk 2015-09-14 20:24

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by rob_kouw (Post 1482512)
I did. Followed the instructions by nieldk.

Well, not completely folloew instructions ;)

I suggest you follow them.

Better to start with removing prey, removing any registered device in control panel (prey site)

Then, start from beginning on 1st post

Btw. No. There is no GUI, yet. Except prey website.

Eminem 2015-10-24 22:58

Re: Prey antitheft for Jolla
 
Got this when trying to install Prey on Sailfish OS 2.0.0.10. :(


Code:

[root@Jolla Downloads]# devel-su                                                Password:
[root@Jolla Downloads]# npm install -g prey
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/tomas/node-campfire.git /root/.npm/_git-remotes/git-github-com-tomas-node-campfire-git-82e0df35: undefined
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/tomas/node-campfire.git /root/.npm/_git-remotes/git-github-com-tomas-node-campfire-git-82e0df35: undefined
npm ERR! Linux 3.4.108.20150901.1
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "prey"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ENOGIT

npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

> prey@1.3.9 preuninstall /usr/lib/node_modules/prey
> ./bin/prey config hooks pre_uninstall

module.js:338
    throw err;
          ^
Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/lib/node_modules/prey/lib/common.js:12:27)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
npm WARN continuing anyway prey@1.3.9 preuninstall: `./bin/prey config hooks pre_uninstall`
npm WARN continuing anyway Exit status 1

npm ERR! Please include the following file with any support request:
npm ERR!    /home/nemo/Downloads/npm-debug.log
[root@Jolla Downloads]# [root@Jolla Downloads]# devel-su                                                Password:
bash: [root@Jolla: command not found
[root@Jolla Downloads]# [root@Jolla Downloads]# npm install -g prey
bash: [root@Jolla: command not found
[root@Jolla Downloads]# npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/tomas/node-campfire.git /root/.npm/_git-remotes/git-github-com-tomas-node-campfire-git-82e0df35: undefined
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
npm WARN continuing anyway prey@1.3.9 preuninstall: `./bin/prey config hooks pre_uninstall`
npm WARN continuing anyway Exit status 1

npm ERR! Please include the following file with any support request:
npm ERR!    /home/nemo/Downloads/npm-debug.log
[root@Jolla Downloads]#


nieldk 2015-10-25 05:30

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by Eminem (Post 1486656)
Got this when trying to install Prey on Sailfish OS 2.0.0.10. :(

Code:

npm ERR! Please check if you have git installed and in your PATH.

Solution in your terminal session ;)

coderus 2015-10-25 09:03

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by nieldk (Post 1486665)
Solution in your terminal session ;)

OMG! If you think i need to read all these output AND understand it - you REALLY wrong here!! You need to make it work for everybody and without any problems! And i do not need to understand how it works, i just need to click INSTALL button and everything should be done automatically! You should fix it ASAP!

nieldk 2015-10-25 10:02

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by coderus (Post 1486671)
OMG! If you think i need to read all these output AND understand it - you REALLY wrong here!! You need to make it work for everybody and without any problems! And i do not need to understand how it works, i just need to click INSTALL button and everything should be done automatically! You should fix it ASAP!

I will add a preinstall script that will prevent installation if you don't entré the correct last 4 ciphers of pi.

pichlo 2015-10-25 10:16

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by nieldk (Post 1486675)
I will add a preinstall script that will prevent installation if you don't entré the correct last 4 ciphers of pi.

THAT has made me ROTFLMAO. Thanks for giving my day a good start! :D:D:D

Eminem 2015-10-25 13:54

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by nieldk (Post 1486665)
Solution in your terminal session ;)

Found the solution and solved it. Prey is up and running/flying. :) Thanks for the hint and your pi script. ;)

nieldk 2015-10-25 18:09

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by Eminem (Post 1486686)
Found the solution and solved it. Prey is up and running/flying. :) Thanks for the hint and your pi script. ;)

Happy for you, and good you are now "protected"

objectifnul 2015-12-03 12:51

Re: Prey antitheft for Jolla
 
Any change in Saimaa 2.0.0.10 with GPS/Location data retrieval?
Since I upgraded, Prey seems to be unable to locate my device.

nieldk 2015-12-03 18:01

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by objectifnul (Post 1490447)
Any change in Saimaa 2.0.0.10 with GPS/Location data retrieval?
Since I upgraded, Prey seems to be unable to locate my device.

No. It still works.
But, perhaps the upgrade process removed some of what prey needs.
I cant really tell. I installed 2.0.0.10 from clean phone.

objectifnul 2015-12-03 18:11

Re: Prey antitheft for Jolla
 
I also installed 2.0.0.10 after factory reset. Then installed Prey according to your instructions. Investigating.

Anyway «prey -r "get location"» returns a correct answer (locally). But panel.preyproject.com couldn't display it. Maybe an issue on server side (device only briefly seen by Prey service when Prey app is started, then shown as unreachable).

In prey.conf, 'auto_connect' is set to 'false' (which is surprisingly the default setting). Forcing it to 'true' doesn't fix the issue.

In prey-agent.service, 'TimeoutStopSec' is set to '20'. Should I increase it?

Eminem 2016-04-12 06:23

Re: Prey antitheft for Jolla
 
Anyone tried it for the tablet and if so did it work?

Eminem 2016-05-06 21:23

Re: Prey antitheft for Jolla
 
Get this at the end of installation.

Credentials verified.
Linking device...
Error! Invalid os: does not exist.
[root@Jolla Downloads]#

Fixable or?

rolfok 2016-05-26 08:17

Re: Prey antitheft for Jolla
 
@nieldk What language was the old version of prey (not based on nodejs) written in and can I have a look at the source?
I'm primarily interested in python code to get gps location.

nieldk 2016-05-26 09:22

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by Eminem (Post 1505135)
Get this at the end of installation.

Credentials verified.
Linking device...
Error! Invalid os: does not exist.
[root@Jolla Downloads]#

Fixable or?

With help from Prey, yes.
They need info to add OS - sailfish - to the known platform types

Believe it shows in /etc/mer-release what they need (not sure if mer-release is correct for tablet)

nieldk 2016-05-26 09:23

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by rolfok (Post 1506111)
@nieldk What language was the old version of prey (not based on nodejs) written in and can I have a look at the source?
I'm primarily interested in python code to get gps location.

Have a look here
https://github.com/prey/prey-bash-client?files=1

rolfok 2016-05-26 10:48

Re: Prey antitheft for Jolla
 
That seems to have no GPS functions, but thanks anyway.

nieldk 2016-05-26 12:45

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by rolfok (Post 1506131)
That seems to have no GPS functions, but thanks anyway.

The various modules (GPS and others) are in seperate github.

https://github.com/prey/prey-bash-cl...odules?files=1

rolfok 2016-05-26 13:04

Re: Prey antitheft for Jolla
 
If I understand that correctly, they do just get approximate position from wifi AP using googleapis - no GPS coordinates from a built in gps receiver.

nieldk 2016-05-26 14:00

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by rolfok (Post 1506179)
If I understand that correctly, they do just get approximate position from wifi AP using googleapis - no GPS coordinates from a built in gps receiver.

Yep.
Defined here
https://github.com/prey/prey-bash-cl...core/functions

Eminem 2016-05-28 10:09

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by nieldk (Post 1506115)
With help from Prey, yes.
They need info to add OS - sailfish - to the known platform types

Believe it shows in /etc/mer-release what they need (not sure if mer-release is correct for tablet)

This info?

Mer release 0.2011 (Mer)
BUILD: Jolla-2.0.0.10-tbj-i486

or this?

[nemo@Jolla ~]$ lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch:desktop-4.0-ia32:desktop-4.0-noarch
Distributor ID: #Thisfileiscopiedashw-release(analogoustoos-release)
Description: # This file is copied as hw-release (analogous to os-release)
Release: n/a
Codename: analogoustoos-release

or maybe this?

[nemo@Jolla ~]$ lsb_release -ri
Distributor ID: #Thisfileiscopiedashw-release(analogoustoos-release)
Release: n/a

pasko 2016-06-01 09:05

Re: Prey antitheft for Jolla
 
Hi.

I have a conflict with the packages:

When I run prey -r "get location" I get a message saying that iwlist command is not found.
When I try to install "wireless-tools" the answer is that "iw" is installed already
And if I try to uninstall "iw" then "crda" is about to be uninstalled as well.

Any clues?

Regards.

explit 2016-07-05 21:22

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by hantoo (Post 1482399)
So after installing Sudo everything seems to be working. It still reports errors, some the same and some new. However it seems to be working : 'Prey' after installing sudo,
http://i.imgur.com/0NLjyqZ.jpg
After typing prey it would not let me type any other commands so I had to close the session. When I reconnected and typed prey it was happy :)
http://i.imgur.com/CuaTHYU.jpg







Quote:

Originally Posted by nieldk (Post 1506115)
With help from Prey, yes.
They need info to add OS - sailfish - to the known platform types

Believe it shows in /etc/mer-release what they need (not sure if mer-release is correct for tablet)


Hello Niel.
I have the same prob. on Jolla tablet. Any chance, that i can fix it by myself?
THX

explit 2016-07-06 07:37

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by Eminem (Post 1505135)
Get this at the end of installation.

Credentials verified.
Linking device...
Error! Invalid os: does not exist.
[root@Jolla Downloads]#

Fixable or?

Hi Eminem. I have the same problem on my Jolla Tablet
Have you found some fix?

THX

step5 2016-07-07 13:52

Re: Prey antitheft for Jolla
 
Quote:

Hi.

I have a conflict with the packages:

When I run prey -r "get location" I get a message saying that iwlist command is not found.
When I try to install "wireless-tools" the answer is that "iw" is installed already
And if I try to uninstall "iw" then "crda" is about to be uninstalled as well.

Any clues?

Regards.
Same here

have a look @
https://together.jolla.com/question/...201taalojarvi/

Quote:

iw
[packaging] Obsoletes deprecated wireless-tools. Fixes MER#1300
iwlist/wireless-tools seems to have become obsolete and replaced by iw


maybe checkout https://www.npmjs.com/package/wit
nodejs wrapper for iw command

Eminem 2016-07-07 14:34

Re: Prey antitheft for Jolla
 
Quote:

Originally Posted by explit (Post 1509081)
Hi Eminem. I have the same problem on my Jolla Tablet
Have you found some fix?

THX

Nope, gonna ask them to add the Tablet. :)


All times are GMT. The time now is 22:38.

vBulletin® Version 3.8.8