Giter VIP home page Giter VIP logo

scout's Introduction

Surveillance Detection Scout - Your Lookout on Autopilot

DEFCON 22 Badge OPEN-SOURCE GPL Licence

Surveillance Detection Scout is a hardware and software stack that makes use of your Tesla's cameras to tell you if you're being followed in real-time. The name, as you likely gathered, pays homage to the ever-effective "Surveillance Detection Route". When parked, Scout makes an excellent static surveillance practitioner as well, allowing you to run queries and establish patterns-of-life on detected persons.

-- Feb Update: README to be updated shortly to reflect initial FCR.

Before going any further, I want to make sure to acknowledge the people (and repositories) who helped this project, with or without knowing they did so.

  1. TeslaUSB (https://github.com/marcone/teslausb).
  2. ALPR-Unconstrained (https://github.com/sergiomsilva/alpr-unconstrained).
  3. Facenet (found at https://github.com/davidsandberg/facenet) and facenet_trt (https://github.com/JerryJiaGit/facenet_trt).
  4. TeslaJS (https://github.com/mseminatore/TeslaJS) build off the original work of Tim Dorr (https://tesla-api.timdorr.com/)
  5. The whole team at Tevora (https://threat.tevora.com).

Information

Scout is a simple to install (at v1.0), and simple to use tool for analyzing video data from Tesla Model S, 3 and X camera feeds.

Scout is intended to be built on an Nvidia Jetson Xavier or Nano, but you may use a Raspberry Pi 4 if real time notification isn't a priority.

Detailed documentation coming shortly.

First Things First (Polling Data)

Even if you don't yet have the hardware necessary to start running inference with Scout, you can start polling your vehicle, so that at least you can start to capture your historical trip data. Scout utilizes TeslaJS for polling.

NOTE: Replace all CHANGEME areas in code

If you'd like to restart the poll script automatically if it crashes (internet outage or similar), uncomment lines 3 and 4 of setup.sh, and comment line 5.

Finally, run ./scripts/TeslaJS/setup.sh.

Xavier Setup

  1. Jetpack SDK full install
  2. Install NVMe SSD (great instructional article here)
  3. 3D print Xavier base cover to hold antennas
  4. Install wireless adapter and antennas
  5. Install Node
  6. Install, configure and start up a MongoDB instance
  7. Create one 240GB EXT4 partition on the SSD
  8. Copy the files in scripts/Xavier/l4t-usb-device-mode over to /opt/nvidia/l4t-usb-device-mode/.
  9. Plug the rear USB C into a Windows or Mac, then /opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-start.sh
  10. Once you see the drive come up on your Windows or Mac, reformat it (from said Windows/Mac) as EXT4
  11. Eject the drive from Windows/Mac
  12. Run service nv-l4t-usb-device-mode stop
  13. Close and reopen the Disks app on Xavier
  14. Create another partition, 284GB, EXT4
  15. Create a partition image of the 240GB partition which you just reformatted- save it inside the new 284GB partition as sdsusb.img
  16. Delete the 240GB partition
  17. Create a 500GB EXT4 Partition
  18. In /opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-config.sh, uncomment line 110 and comment line 109
  19. Get the UUIDs of the two partions on the SSD, and update the CHANGEME areas of ./scripts/Xavier/setup.sh appropriately
  20. Run ./scripts/Xavier/setup.sh and ./setup.sh from the scripts/alpr-unconstrained directory
  21. Reboot Xaxier
  22. Add the lines in ./scripts/Xavier/crontab to your user's crontab
  23. Congratulations, you are now a data hoarder.
  24. The lp2 directory requires a weights file which you can download here. This is simply custom training YoloV3 to detect license plates using the Google OpenImages dataset.
  25. You should run the command in unixTS from within the mongo shell to add unixTS field to any existing poll docs. This will be implemented as an automated method shortly.

Try powering down the Xavier and plugging it into a Tesla USB slot (unplug your existing flash drive first if you're using one), using the provided Xavier USB-C to USB-A cable, and powering the Xavier via USB-C car charger (into the USB-C port on the side of the Xavier with the other various ports). Tesla will either automatically mount the device, or if you see the camera icon with a gray dot, you can press-hold on the camera button to mount the device. That gray dot should turn red.


Next Up: Familiar Face Detection, then GUI. Watch this repo to be notified as code is released. Releasing code as soon as I am able.

BOM

List:

Disclaimer

This framework is provided for educational purposes only. Using this framework without permission from all appropriate parties may be against the law depending on your jurisdiction. Use at your own risk.

You may use this library with the understanding that doing so is AT YOUR OWN RISK. No warranty, express or implied, is made with regards to the fitness or safety of this code for any purpose. If you use this library to query or change settings of your vehicle you understand that it is possible to make changes that could inadvertently lower the security of your vehicle, or cause damage, through actions including but not limited to:

  • Unlocking the vehicle
  • Remotely starting the vehicle
  • Opening the sunroof
  • Opening the frunk or trunk
  • Lowering the battery charge level
  • Impacting the long-term health of your battery

Please be careful not to use this code in a way that loads the Tesla servers with too many concurrent requests. Calling the Tesla REST APIs at a very high frequency will stress the Tesla servers and could get your IP or favorite cloud service blocked by Tesla. Or in the worst case it could cause Tesla to revoke the key that enables access via this and many other libraries.

scout's People

Contributors

craigtaverner avatar trumankain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scout's Issues

checkCopy.sh vs watcher.py directory

In check copy.sh it moves files to /tesladrive/Videos/RecentClips/
however watched checks folder /tesladrive/backups/RecentClips

I suspect this is in error?

Recommend cameras

This is amazing any possibility you could cover how to set this up with off the shelf purchased cameras for those poor souls like myself that dont have a Tesla but want to use this? Recommend some good cameras for this?

Ive got to the point in your Howto

I hope your looking at providing instructions for Jetson 4.2 , else please advise what version you're running on your Xavier so I can try again :)

running but really slow and hardly any plates detected

So I have got it all running, CPU pretty much running 100% all the time and GPU nearly the same.

I've checked and the CPU seems to be running at 100% from the FFmpeg process, should this be done in GPU or CPU? Just wondering if I need to check something... I've installed it as per https://devtalk.nvidia.com/default/topic/1041988/jetson-agx-xavier/ffmpeg-problem-solved but its all in CPU.

Running the process on 1gbps of files... or 31 files in total, is still running after 8 minutes, should this be the case?

SSH ok or is MongoDB required?

Is there a recommended way to setup remote access to the Xavier to minimize security issues with opening ports through MongoDB over public wifi? Would SSH work instead of MongoDB? Or is SSH not possible since the Xavier would be in the car moving through different IP addresses. If MongoDB is needed, can you share the code needed to safely restrict port access on the Xavier?

How can I verify the Tesla is seeing the Jetson Xavier as a USB drive?

TL;DR: I think I have the basic configuration correct but I can't figure out how to test if my Tesla actually wrote video to my Jetson Xavier.

I got through the setup and install mostly by reading the comments. I hooked up the Jetson Xavier (JX) to my Tesla. I saw that I had a red light on the top of the center display. I drove around for a while to collect video.

Now what?

I tried booting the JX at connecting it to my Ubuntu laptop. I assumed the laptop would see it as an external USB drive. It didn't. I tried plugging the JX USB cable into my Mac. Since it's running ext4 I don't expect the Mac to see it, but I expected to see a USB drive in Disk Utility. I didn't.

How can I verify that JX is actually making itself available as an external USB drive to the Tesla? Is there something specific I need to get the Ubuntu laptop to recognize it as a USB drive? Is there a way to mount the disk image inside the JX itself so I can verify that I'm actually getting the Tesla to write video to the JX?

I was a UNIX sys admin for years. Then I transitioned to network engineering. I still have some UNIX/Linux skills, but they're dated. Any help you can provide would be appreciated.

Is this dead?

What ever happened to the November update? Is the frontend code ever going to be released?

Detecting stolen vehicles

I'd love to be able to be reported of cars that are stolen or have amber alerts on them.

A list can be downloaded for New Zealand from https://www.police.govt.nz/stolenwanted/stolen-vehicles?nondesktop (download CSV). How easy would something like this be to implement? I'd love for an easy way to prepackage units and ship at cost to our Tesla Owners group of New Zealand.

Would also be cool to have a second database of Tesla Owners Group members, so when they drive past it shows up the name of the person who just drove past, would be a cool gimmick and a talking point when seeing members at a meetup.

Use Environment Variables instead of CHANGEME(USERNAME)'s throughout the code

Rather than people search/replacing through the code, if instead there were a standard set of Environment variables that people should set (eg. $(SCOUT_HOME) and $(SCOUT_MOUNTDIR) ), then peoples source directory could remain untainted as updated are made to the code.

If a particular config file can't read environment variables, then an install script could generate the config file from the environment.

Step 10 EXT4 in Windows

  1. Once you see the drive come up on your Windows or Mac, reformat it (from said Windows/Mac) as EXT4

I don't believe you can format EXT4 in Windows is this supposed to say exFAT, NTFS, or FAT?

EXT4 on Mac?

So I finally managed to Jetpack upgrade my Xavier and have the l4t-usb-device working and started from scratch with your how to.

The part that says "Once you see the drive come up on your Windows or Mac, reformat it (from said Windows/Mac) as EXT4", EXT4 is not an option with MAC? So I plugged it into my Jetpack ubuntu host (which I bought today as I couldn't get jetpack working through virtual box) and formatted the partition as EXT4 as described.

Problem now is Ubuntu doesn't want to make an image of the file, worked fine previously for me, but I think that's because I didn't have an EXT4 partition inside an EXT4 partition, it says Creating disk image: 0.0% but doesn't increase what so ever. Not mounted and trying to save the image to the 284Gb disk. I see the file appear , so it reserves the disk space, but doesn't progress.

Going to try a few other options and will report back

Help with Xavier Setup Step #8

I am new to Ubuntu, so please forgive me if this is a stupid question. But I am stuck on Step 8 (Copy the files in scripts/Xavier/l4t-usb-device-mode over to /opt/nvidia/l4t-usb-device-mode/)

When I type cp -b scripts/Xavier/l4t-usb-device-mode /opt/nvidia/l4t-usb-device-mode/

I get this error message:

cp: cannot stat '/scripts/Xavier/l4t-usb-device-mode': No such file or directory

Can you tell me what I need to type in Terminal to complete step 8? Thanks!

Having trouble with Nvidia Jetson setup

Can I pay someone to help me set this all up, I'm decent with linux servers but many of the commands seem to not be working correctly. I would prefer is someone can do it for me either remotely or in person.

Your setup.sh files

All of your setup files don't run because of the . at the end.
For example ./scripts/TeslaJS/setup.sh contains cp poll.js ../../TeslaJS/samples/.
I had to remove the . off the end to get it to work.

Also, scripts/Xavier/setup.sh contains code mkdir /media/nvidia/SCOUT & chmod 755 /media/nvidia/SCOUT ; though you actually need to create the /media/nvidia folder first before you can make folders in it.

Can I suggest you update the how-to to suggest running it as the user (not root) and using the LOGNAME env to determine username , or

nvidia@nvidia-desktop:~$ echo $USER
nvidia
nvidia@nvidia-desktop:~$ 

how to use watcher?

root@nvidia-desktop:/scripts# chmod 755 watcher.py
root@nvidia-desktop:
/scripts# ./watcher.py
import-im6.q16: unable to open X server ' @ error/import.c/ImportImageCommand/358. from: can't read /var/mail/watchdog.observers from: can't read /var/mail/watchdog.events import-im6.q16: unable to open X server ' @ error/import.c/ImportImageCommand/358.
from: can't read /var/mail/subprocess
./watcher.py: line 7: class: command not found
./watcher.py: line 8: DIRECTORY_TO_WATCH: command not found
./watcher.py: line 10: syntax error near unexpected token (' ./watcher.py: line 10: def init(self):'
root@nvidia-desktop:~/scripts#

confusion on Step #20 setup.sh in ...scripts/alpr-unconstrained

cp -R darknet /home/(CHANGEME)/alpr-unconstrained/.
cp -R data /home/(CHANGEME)/alpr-unconstrained/.
cp *.py /home/(CHANGEME)/alpr-unconstrained/.

What should the CHANGEME be set to? The top level of the user running the package? I.e
/home/installuser/alpr-unconstrained ?? But this directory is not yet created...
otherwise, it seems that you are moving it to the existing directory?

Please clarify.
Thank You.

module dn3 where to get it?

root@nvidia-desktop:~/alpr-unconstrained# python license-plate-ocr.py 
Traceback (most recent call last):
  File "license-plate-ocr.py", line 6, in <module>
    import darknet.python.dn3 as dn
ImportError: No module named dn3
root@nvidia-desktop:~/alpr-unconstrained# 

I've managed to get as far as the videos being processed into frames
the frames being processed into vehicles
the vehicles being processed into plates

Now I just need to read the plates and store them to DB.

I also assume some cleanup scripts are required for the following folders...

clean folders

rm -fr /tesladrive/backups/RecentClips/*
rm -fr /tesladrive/Frames/*
rm -fr /tesladrive/detections/vehicles/*

can't get darknet to work

root@nvidia-desktop:/alpr-unconstrained# python vehicle-detection.py
Traceback (most recent call last):
File "vehicle-detection.py", line 7, in
import darknet.python.darknet as dn
ImportError: No module named darknet.python.darknet
root@nvidia-desktop:
/alpr-unconstrained#

have tried doing a few different paths in the python script such as these
sys.path.append('/root/alpr-unconstrained/python/')
sys.path.append('/opt/Scout/alpr-unconstrained/')
sys.path.append('/opt/Scout/alpr-unconstrained/darknet/')

disk not mounting across to Mac

So my gear arrived today and I've set it all up.

Unfortunately the disk is not sharing across to my MAC when I start the script

root@jetson-0423818076546:/opt/nvidia/l4t-usb-device-mode# ls
mac-addresses  nv-l4t-usb-device-mode-config.sh  nv-l4t-usb-device-mode-start.sh

root@jetson-0423818076546:/opt/nvidia/l4t-usb-device-mode# cat mac-addresses 
mac_rndis_h=5a:d0:de:22:e7:1c
mac_rndis_d=5a:d0:de:22:e7:1d
mac_ecm_h=5a:d0:de:22:e7:1e
mac_ecm_d=5a:d0:de:22:e7:1f

I have since gone ahead, created the other 284gb and 500gb disks, done an image of the 240gbps disks to sdsusb.img, updated the files as requested, but still no go.

root@jetson-0423818076546:/opt/nvidia/l4t-usb-device-mode# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 28G 7.9G 19G 31% / devtmpfs 7.7G 0 7.7G 0% /dev tmpfs 7.8G 4.0K 7.8G 1% /dev/shm tmpfs 7.8G 29M 7.7G 1% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/nvme0n1p2 260G 224G 23G 91% /teslaflash /dev/nvme0n1p3 458G 73M 435G 1% /tesladrive tmpfs 1.6G 128K 1.6G 1% /run/user/1001

Project on hold?

Hey there,

seems like the project is pretty much on hold right now, correct? Just wondering if somebody else knows about a successor or similar project, before I start using and building/investing time on top of this :)

Cheers,

Sascha

Cant seem to install tensorflow for python 2.7, can we use python 3?

nvidia@jetson-0423818076546:/opt/Scout/alpr-unconstrained$ pip install tensorflow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.