├── .github └── FUNDING.yml ├── retrofit ├── subzero │ ├── readme.md │ ├── Seat Cushion - Lower - 2nd Row (Remove and Install).pdf │ ├── Bolster - Side - Seat - 2nd Row - LH (Remove and Replace).pdf │ ├── Back Rest Assembly - Seat - 2nd Row - LH (Remove and Install).pdf │ ├── heated-wipers.md │ ├── heated-rear-seats.md │ ├── heated-nozzles.md │ └── heated-wheel.md ├── tpms.md ├── lte.md └── pup.md ├── src ├── overwrite-files │ └── usr │ │ └── local │ │ └── bin │ │ └── nickname.sh ├── scripts │ ├── misc │ │ ├── online.sh │ │ ├── offline.sh │ │ ├── sync-screenshots-with-dropbox.sh │ │ ├── wipe-update.sh │ │ ├── save-kernel.sh │ │ ├── upload-screenshots.sh │ │ ├── save-ap-footage.sh │ │ ├── get-versions.sh │ │ ├── vnc-remote-control.sh │ │ ├── email-screenshots.sh │ │ ├── screenshot-remote-control.py │ │ ├── imgur.sh │ │ └── save-update.sh │ ├── everyBoot │ │ ├── wake-bench.sh │ │ ├── block-tesla-ssh.sh │ │ ├── copy-tokens-to-ic.sh │ │ ├── autopilot-autosteer.sh │ │ ├── tokens-to-php.sh │ │ ├── open-diag-port.sh │ │ ├── check-for-updates.sh │ │ ├── reverse-tunnel.sh │ │ ├── save-key-over-ssh.sh │ │ ├── memory-logs.sh │ │ ├── mount-modfiles.sh │ │ ├── vpn-over-cell.sh │ │ ├── create-accounts.sh │ │ ├── speed-sensitive-volume.sh │ │ ├── freedomevstart.sh │ │ └── listen-for-code.sh │ ├── everyFiveMinutes │ │ ├── add-swblock.sh │ │ ├── startstopvpn.sh │ │ ├── eggwot.sh │ │ ├── vitals-to-php.sh │ │ └── open-wifi.sh │ └── on-reboot.sh ├── tesla.ovpn ├── save-vitals.php ├── config.sh ├── save-tokens.php └── install.sh ├── dumps ├── readme.md ├── 2014.85 │ └── internaldat ├── 2015.p85dl │ └── internaldat ├── 2014.p85+ │ └── internaldat ├── 2016.p90dl │ └── internaldat ├── 2016.75d.ap2 │ └── internal.dat ├── 2018.X100D.AP3 │ └── internal.dat └── dump.sh ├── CONTRIBUTING.md ├── .gitignore ├── README.md ├── CODE_OF_CONDUCT.md └── LICENSE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: ['Lunars'] 2 | -------------------------------------------------------------------------------- /retrofit/subzero/readme.md: -------------------------------------------------------------------------------- 1 | ![](https://i.imgur.com/ZW18meO.png?1) 2 | -------------------------------------------------------------------------------- /src/overwrite-files/usr/local/bin/nickname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Old nickname.sh shows VIN, so we remove it 4 | hostname 5 | -------------------------------------------------------------------------------- /src/scripts/misc/online.sh: -------------------------------------------------------------------------------- 1 | mv /home/tesla/.Tesla/car/cell_apn.bak /home/tesla/.Tesla/car/cell_apn 2 | emit-reboot-gateway 3 | -------------------------------------------------------------------------------- /retrofit/tpms.md: -------------------------------------------------------------------------------- 1 | # TPMS 2 | 3 | internal.dat: `tpmstype 3` 4 | 5 | ![](https://i.imgur.com/v3VIdfa.png) 6 | 7 | https://static.nhtsa.gov/odi/tsbs/2016/SB-10081828-5448.pdf 8 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/wake-bench.sh: -------------------------------------------------------------------------------- 1 | # This script will wake your bench cid display 2 | curl -sL "http://192.168.90.100:4070/_data_set_value_request_?name=CD_displayState&value=2" 3 | -------------------------------------------------------------------------------- /retrofit/subzero/Seat Cushion - Lower - 2nd Row (Remove and Install).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lunars/tesla/HEAD/retrofit/subzero/Seat Cushion - Lower - 2nd Row (Remove and Install).pdf -------------------------------------------------------------------------------- /retrofit/subzero/Bolster - Side - Seat - 2nd Row - LH (Remove and Replace).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lunars/tesla/HEAD/retrofit/subzero/Bolster - Side - Seat - 2nd Row - LH (Remove and Replace).pdf -------------------------------------------------------------------------------- /retrofit/subzero/Back Rest Assembly - Seat - 2nd Row - LH (Remove and Install).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lunars/tesla/HEAD/retrofit/subzero/Back Rest Assembly - Seat - 2nd Row - LH (Remove and Install).pdf -------------------------------------------------------------------------------- /src/scripts/misc/offline.sh: -------------------------------------------------------------------------------- 1 | mv /home/tesla/.Tesla/car/cell_apn /home/tesla/.Tesla/car/cell_apn.bak 2 | touch /home/tesla/.Tesla/car/cell_apn 3 | echo "junk" >> /home/tesla/.Tesla/car/cell_apn 4 | emit-reboot-gateway 5 | -------------------------------------------------------------------------------- /src/scripts/everyFiveMinutes/add-swblock.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Prevent the car from grabbing new fw updates 4 | 5 | if grep --quiet firmware.vn.teslamotors.com /etc/hosts; then 6 | echo "Block in Place" 7 | else 8 | echo "Adding block" 9 | echo "0.0.0.0 firmware.vn.teslamotors.com" >>/etc/hosts 10 | fi 11 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/block-tesla-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Block Tesla from SSHing to car 4 | iptables -D INPUT -i tun0 -p tcp -m tcp --dport 22 -j REJECT --reject-with icmp-port-unreachable 5 | iptables -D INPUT -i tun0 -p tcp -m tcp --dport 22 -j LOG 6 | iptables -I INPUT -i tun0 -p tcp -m tcp --dport 22 -j REJECT --reject-with icmp-port-unreachable 7 | iptables -I INPUT -i tun0 -p tcp -m tcp --dport 22 -j LOG 8 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/copy-tokens-to-ic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copies the tokens from CID to IC since you can always SSH to IC 4 | function copyTokens() { 5 | scp /var/etc/saccess/tesla1 192.168.90.101:/home/tesla/tesla1 6 | scp /var/etc/saccess/tesla2 192.168.90.101:/home/tesla/tesla2 7 | } 8 | 9 | copyTokens 10 | 11 | while inotifywait -e modify /var/etc/saccess/tesla1; do 12 | copyTokens 13 | done 14 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/autopilot-autosteer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Allows autosteer at all speeds 4 | # Does not disable autopilot nag 5 | 6 | KEY="GUI_disableAutosteerRestrictions" 7 | WANTSTATE="true" 8 | 9 | while true; do 10 | STATE=$(lv $KEY | cut -d "\"" -f2) 11 | if ! [ "$STATE" = "$WANTSTATE" ]; then 12 | sdv $KEY $WANTSTATE 13 | echo "Enabling $KEY $WANTSTATE" 14 | fi 15 | sleep 60 16 | done 17 | -------------------------------------------------------------------------------- /src/tesla.ovpn: -------------------------------------------------------------------------------- 1 | client 2 | dev tun8 3 | proto udp 4 | mssfix 1260 5 | sndbuf 0 6 | rcvbuf 0 7 | remote YOURIPADDRESSHERE 1194 8 | resolv-retry 60 9 | log-append /var/log/openvpn.log 10 | nobind 11 | persist-key 12 | persist-tun 13 | script-security 2 14 | ping 10 15 | ping-restart 60 16 | auth-nocache 17 | remote-cert-tls server 18 | auth SHA512 19 | cipher AES-256-CBC 20 | setenv opt block-outside-dns 21 | key-direction 1 22 | ###CERTSHERE### 23 | -------------------------------------------------------------------------------- /dumps/readme.md: -------------------------------------------------------------------------------- 1 | # Dump your settings 2 | 3 | This will present two links to Termbin in the format of those files that you see in the dumps folders on Github 4 | 5 | ## Install 6 | 7 | ```bash 8 | bash <(curl -sL "https://raw.githubusercontent.com/Lunars/tesla/master/dumps/dump.sh?$(date +%s)") 9 | ``` 10 | 11 | ## Usage 12 | 13 | Optional argument `raw` to allow sensitive information in the dump 14 | 15 | ```bash 16 | bash ./dump.sh raw 17 | ``` 18 | -------------------------------------------------------------------------------- /src/scripts/misc/sync-screenshots-with-dropbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Use with https://github.com/andreafabrizi/Dropbox-Uploader 4 | 5 | while [ true ]; do 6 | if [ -z "$(ls -A /home/tesla/.Tesla/data/screenshots/)" ]; then 7 | continue 8 | else 9 | #echo "Not Empty" 10 | sleep 10 11 | /bin/bash /dropbox_uploader.sh upload /home/tesla/.Tesla/data/screenshots/* /Screenshots-Tesla 12 | rm -r /home/tesla/.Tesla/data/screenshots/* 13 | fi 14 | sleep 10 15 | done 16 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/tokens-to-php.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$urlToTokensPHP" =~ "yourserver" ]]; then 4 | echo "Script not yet setup, quitting" 5 | exit 1 6 | fi 7 | 8 | function copyTokens() { 9 | VIN=$(Feel free to check [issues page](https://github.com/Lunars/tesla/issues). 4 | 5 | 6 | ## 🤖 Pull Request Process 7 | 8 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 9 | build. 10 | 2. Update the README.md with details of changes to the interface, this includes new environment 11 | variables, exposed ports, useful file locations and container parameters. 12 | -------------------------------------------------------------------------------- /src/scripts/misc/wipe-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run this if you have an update you want to kill 4 | 5 | initctl stop cid-updater && rm -rf /var/spool/*-updater/* && initctl start cid-updater 6 | ssh root@ic "initctl stop ic-updater && rm -rf /var/spool/*-updater/* && initctl start ic-updater" 7 | 8 | sdv GUI_softwareUpdateSecondaryDownload Idle 9 | sdv GUI_softwareUpdatePrimaryDownload Idle 10 | sdv GUI_softwareUpdatePackageDownloadProgress 0 11 | sdv GUI_softwareUpdateProgress 0 12 | sdv GUI_softwareUpdateStatus idle 13 | -------------------------------------------------------------------------------- /src/scripts/misc/save-kernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Thanks ag 4 | 5 | rm -rf cpio 6 | rm -rf _kernel*.extracted 7 | 8 | dd if=cid-kernel.img bs=2048 skip=1 >kernel.lzf 9 | lzf -d kernel.lzf 10 | 11 | ARCHIVE=$(binwalk -D gz kernel | grep gzip | tail -1 | egrep -oe " .* " | tr -d " " | sed -e 's/0x//') 12 | cd _kernel.extracted 13 | mv ${ARCHIVE} tesla.cpio.gz && gunzip tesla.cpio.gz 14 | 15 | # Optional 16 | file * 17 | mkdir cpio 18 | cd cpio 19 | cpio -idmv <../tesla.cpio 20 | 21 | cd ../../ 22 | 23 | mv _kernel.extracted/cpio . 24 | rm -rf _kernel*.extracted 25 | rm -rf kerne* 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Linux template 3 | *~ 4 | 5 | # temporary files which can be created if a process still has a handle open of a deleted file 6 | .fuse_hidden* 7 | 8 | # KDE directory preferences 9 | .directory 10 | 11 | # Linux trash folder which might appear on any partition or disk 12 | .Trash-* 13 | 14 | # .nfs files are created when an open file is removed but is still being accessed 15 | .nfs* 16 | 17 | ### Example user template template 18 | ### Example user template 19 | 20 | # IntelliJ project files 21 | .idea 22 | *.iml 23 | out 24 | gen 25 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/open-diag-port.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -f /etc/tegraline-release ]; then 3 | touch /etc/tegraline-release 4 | fi 5 | 6 | if [ ! -f /var/etc/disable-seceth ]; then 7 | touch /var/etc/disable-seceth 8 | fi 9 | 10 | SALT="pr8d+VGYxcuRex3cg3MmrO8Sk6MHxQoBlVbd" 11 | VIN=$(cat /var/etc/vin) 12 | TOKEN=$(cat /var/etc/saccess/tesla1) 13 | 14 | make_key() { 15 | echo -n "${SALT}${VIN}${TOKEN}" | sha1sum | cut -b 1-16 16 | } 17 | 18 | KEY=$(make_key) 19 | while [ true ] 20 | do 21 | echo "key $KEY" | socat - udp-datagram:192.168.90.255:18466,broadcast 22 | sleep 10 23 | done 24 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/check-for-updates.sh: -------------------------------------------------------------------------------- 1 | currentVersion="2020.03.17" 2 | latestScript=$(curl --max-time 5 --connect-timeout 0 -s -L "https://raw.githubusercontent.com/Lunars/tesla/master/src/scripts/everyBoot/check-for-updates.sh" || exit 1) 3 | latestVersion=$(echo "${latestScript}" | cut -d '"' -f2 | head -1) 4 | 5 | if [ -n "$latestScript" ] && [ "$currentVersion" != "$latestVersion" ]; then 6 | echo "New version detected. Running update script" 7 | 8 | # Using script from source, to make sure it's the newest copy since there's an update 9 | bash <(curl -sL "https://raw.githubusercontent.com/Lunars/tesla/master/src/install.sh") 10 | fi 11 | -------------------------------------------------------------------------------- /src/scripts/everyFiveMinutes/startstopvpn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | file="$homeOfLunars/tesla.ovpn" 4 | vpn=$(awk '/^dev /' "$file" | awk '{print $2}') 5 | 6 | if [ -z "$vpn" ]; then 7 | echo "Script not yet setup, quitting" 8 | exit 1 9 | fi 10 | 11 | if grep -q "YOURIPADDRESSHERE" "$file"; then 12 | echo "Script not yet setup, quitting" 13 | exit 1 14 | fi 15 | 16 | iptables -D INPUT -i "$vpn" -p tcp --dport 22 -j ACCEPT 17 | iptables -I INPUT -i "$vpn" -p tcp --dport 22 -j ACCEPT 18 | /sbin/start-stop-daemon --start --quiet --make-pidfile --oknodo --background --pidfile /var/run/lunars-vpn.pid --exec /usr/sbin/openvpn -- --config "$file" 19 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/reverse-tunnel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set up a reverse SSH tunnel to a remote server 4 | # Make sure the user tesla (default) can log in without a password 5 | # 6 | # On that server SSH back to your car using: 7 | # ssh -p @localhost 8 | 9 | if [[ "$reverseTunnelServer" =~ "yourserver.com" ]]; then 10 | echo "Script not yet setup, quitting" 11 | exit 1 12 | fi 13 | 14 | while :; do 15 | RET=$(ps ax | grep "${nonStandardPort}:localhost:22" | grep -v "grep" | wc -l) 16 | if [ "$RET" -eq 0 ]; then 17 | ssh -N -T -R ${nonStandardPort}:localhost:22 -o ServerAliveInterval=3 -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes $reverseTunnelServer 18 | fi 19 | sleep 60 20 | done 21 | -------------------------------------------------------------------------------- /src/scripts/everyFiveMinutes/eggwot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Mode 1 shows the battery temperature level on the IC display, as a purple indicator on the same menu as the energy graph 4 | # Mode 2 does what 1 does, in addition to showing drive unit statistics on the left IC menu 5 | # Can also be used to control other sdv commands such as GUI_developerMode (values= true and false for $MODE) 6 | # From IC this command can be issued via curl -s "http://cid:4070/_data_set_value_request_?name=GUI_eggWotMode&value=$MODE" 7 | 8 | KEY="GUI_eggWotMode" 9 | STATE=$(lv $KEY | cut -d "\"" -f2) 10 | WANTSTATE="Preparing" 11 | MODE=1 12 | 13 | echo "state is" $STATE 14 | echo "state wanted is" $WANTSTATE 15 | 16 | if ! [ "$STATE" = "$WANTSTATE" ]; then 17 | sdv $KEY $MODE 18 | echo "Enabling $KEY $MODE" 19 | else 20 | echo "Already Enabled" 21 | fi 22 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/save-key-over-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Saves keys over an ssh connection by writing them to a text file on the remote 4 | # server. Does not require any web server be running on the server, only sshd. 5 | 6 | if [[ "$saveTokenOverSshServer" =~ "yourserver.com" ]]; then 7 | echo "Script not yet setup, quitting" 8 | exit 1 9 | fi 10 | 11 | function copyTokens() { 12 | TIME=$(date "+%Y-%m-%d %k:%M:%S") 13 | VIN=$(> $saveTokenOverSshFile" 19 | } 20 | 21 | copyTokens 22 | 23 | while inotifywait -e modify /var/etc/saccess/tesla1; do 24 | copyTokens 25 | done 26 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/memory-logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # mount /var/log on tmpfs to not wear down the eMMC flash chip 4 | ISTMPFS=$(/bin/mount | /bin/grep -c "/var/log type tmpfs") 5 | 6 | if [ "$ISTMPFS" == 0 ]; then 7 | mount -t tmpfs -o size=100M tmpfs /var/log 8 | 9 | #if we mount while the programs are still active and they keep their logfiles open, they keep on writing to the 10 | #(now hidden) location on the eMMC, so we need to restart or send the HUP signal (if it's properly impemented) 11 | mkdir /var/log/ntpstats /var/log/mgetty 12 | chown ntp:ntp /var/log/ntpstats/ 13 | service ntp restart 14 | pkill -HUP valhalla_server 15 | initctl restart rsyslog 16 | 17 | ssh ic "mount -t tmpfs -o size=100M tmpfs /var/log" 18 | ssh ic "mkdir /var/log/ntpstats /var/log/mgetty" 19 | ssh ic "service ntp restart" 20 | ssh ic "initctl restart rsyslog" 21 | fi 22 | -------------------------------------------------------------------------------- /src/scripts/everyFiveMinutes/vitals-to-php.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$urlToVitalsPHP" =~ "yourserver.com" ]]; then 4 | echo "Script not yet setup, quitting" 5 | exit 1 6 | fi 7 | 8 | localVitals="http://cid:4035/vitals?raw=true" 9 | vitalsPath="/usr/tesla/UI/assets/web_content/vitals" 10 | allowedURL="$urlToVitalsPHP?vin=$(/dev/null 13 | /bin/umount $bindmount 14 | done 15 | 16 | cd $saveLocation$1 17 | for modfile in $(find . -type f); do 18 | #in case the containing dir isn't there yet 19 | mkdir -p /$(dirname $modfile) 2>/dev/null 20 | #displays warnings because mounting a file 21 | /bin/mount --bind $modfile /$modfile 2>/dev/null 22 | chmod +x $modfile 2>/dev/null 23 | /bin/mount -o remount,ro /$modfile 2>/dev/null 24 | done 25 | 26 | #if theres a changed init script, reload upstart 27 | if [ -d $saveLocation$1/etc/init/ ]; then 28 | /usr/cid-slash-sbin/initctl reload-configuration 29 | fi 30 | -------------------------------------------------------------------------------- /retrofit/subzero/heated-wipers.md: -------------------------------------------------------------------------------- 1 | # Heated Wiper Area 2 | 3 | ## Config 4 | 5 | ```bash 6 | access-internal-dat.pl wiperheatinstalled 1 7 | ``` 8 | 9 | ## Parts 10 | 11 | * 1021634-01-C - Pre-ap - WINDSHIELD - LHD - HEATED WIPER AREA 12 | * 1061565-01-C - AP1 - WSHLD ASSY MONO-CAM HWA LHD MS2 13 | 14 | ## Install 15 | 16 | You need a whole new windshield for this install. 17 | 18 | Typically, when you get a chip / crack in your windshield and Tesla replaces it for you, they give you a windshield with HWA (heated wiper area) already installed at the bottom of the shield. 19 | 20 | When that's done, you can either ask them to enable the config, or enable it yourself after verifying the connections are plugged in. It's the right side A pillar. If the connector is dangling, simply plug it in. 21 | 22 | "A" pillar has 7mm bolt, screw that off then peel it back. Look for wires coming off the corner of your windshield. Follow it to a white connector, and plug it in to the only empty connector. Mine was adhered to the chasis. 23 | 24 | ![](https://i.imgur.com/rQLHQjM.png) 25 | 26 | ![](https://i.imgur.com/Jb3LWMK.png) 27 | -------------------------------------------------------------------------------- /src/scripts/everyFiveMinutes/open-wifi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # When on a wifi network, this script will allow you to ssh to the local ip 4 | # You have to be on the same wifi network as the car 5 | # Uses port $WIFIPORT for ssh 6 | # Useful if you're on the road and you open a hotspot on your phone, then connect car to phone's wifi hotspot. Now you can ssh to the car 7 | 8 | # ssh -p $WIFIPORT tesla1@192.168.1.154 9 | 10 | WIFIPORT="$nonStandardPort" 11 | PARROTIP=192.168.20.2 12 | 13 | iptables -D INPUT -i parrot -p tcp -m tcp --dport 22 -j ACCEPT 14 | iptables -I INPUT -i parrot -p tcp -m tcp --dport 22 -j ACCEPT 15 | 16 | { 17 | echo 18 | sleep 1 19 | echo 20 | sleep 1 21 | echo "iptables -t nat -D PREROUTING -i mlan0 -p tcp -m tcp --dport $WIFIPORT -j DNAT --to-destination $PARROTIP:22" 22 | sleep 1 23 | echo "iptables -t nat -I PREROUTING -i mlan0 -p tcp -m tcp --dport $WIFIPORT -j DNAT --to-destination $PARROTIP:22" 24 | sleep 1 25 | echo "iptables -D INPUT -p tcp --dport $WIFIPORT -j ACCEPT" 26 | sleep 1 27 | echo "iptables -I INPUT -p tcp --dport $WIFIPORT -j ACCEPT" 28 | sleep 1 29 | } | socat - tcp:parrot:telnet 30 | -------------------------------------------------------------------------------- /dumps/2014.85/internaldat: -------------------------------------------------------------------------------- 1 | chargertype dual 2 | airsuspension 1 3 | adaptivecruise 0 4 | frontfog 0 5 | rearfog 1 6 | corneringlamps 1 7 | homelink 1 8 | sunroof 1 9 | powerlift 1 10 | audiotype premium 11 | headlamp hid 12 | blindspot 0 13 | rhd 0 14 | intrusiontilt 0 15 | memoryseats 1 16 | memorymirrors 1 17 | ocs 0 18 | euvehicle 1 19 | interior 0 20 | exterior 7 21 | dash 1 22 | 4wd 0 23 | seatheaters 1 24 | performance 1 25 | badging 0 26 | fastcharge 1 27 | fastchargeinstalled 1 28 | spoilerInstalled 0 29 | wheelType base_19 30 | roofcolor none 31 | gpstype ublox 32 | mapregion eu 33 | nokeylessentry 0 34 | nopushtounlock 0 35 | simulatedS1 0 36 | ambientlightsinstalled 1 37 | wiperheatinstalled 1 38 | rearseatheatersinstalled 1 39 | parkassistinstalled 1 40 | headlightlevelerinstalled 0 41 | navigationallowed 1 42 | country no 43 | drlinstalled 1 44 | lightpipeinstalled 0 45 | sideMarkerInstalled 0 46 | foldingmirrors 1 47 | dimmablervmirror 1 48 | otherfastchargeallowed 0 49 | ionizertype 1 50 | twelvevbatterytype 1 51 | hvjb16aperphaseok 1 52 | tpmstype 1 53 | freeslavecharger 0 54 | steeringwheel 0 55 | dashw 0 56 | forwardradarhw 0 57 | packconfig 41 58 | numberhvilnodes 4 -------------------------------------------------------------------------------- /src/scripts/everyBoot/vpn-over-cell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script makes your VPN go over cell connection instead of wifi 4 | # Useful for when your car goes in to service and you still want to access SSH 5 | # Service center wifi does not usually let outgoing / incoming connections 6 | DHCPLEASES="/var/lib/dhcp3/dhclient.wwan0.leases" 7 | OVPN="$homeOfLunars/tesla.ovpn" 8 | 9 | if grep -q "YOURIPADDRESSHERE" $OVPN; then 10 | echo "openvpn not yet setup, quitting" 11 | exit 1 12 | fi 13 | 14 | function addVPNRoute() { 15 | VPNIP=$(awk '/^remote /' $OVPN | awk '{print $2}') 16 | CELLIP=$(ip r | grep wwan0 | grep -Pom 1 '[0-9.]{7,15}' | tail -1) 17 | 18 | service openvpn stop 19 | route delete $VPNIP >/dev/null 2>&1 20 | 21 | if [ ! -z "$CELLIP" ]; then 22 | ROUTERIP=$(grep $CELLIP -A 3 $DHCPLEASES | tail -1 | grep -Pom 1 '[0-9.]{7,15}') 23 | route add $VPNIP gw $ROUTERIP 24 | fi 25 | 26 | service openvpn start 27 | } 28 | 29 | # Called once at least on start, so that the appropriate routes can be added 30 | addVPNRoute 31 | 32 | while inotifywait -e modify $DHCPLEASES; do 33 | echo "Found cell change, updating route" 34 | addVPNRoute 35 | done 36 | -------------------------------------------------------------------------------- /src/scripts/misc/save-ap-footage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You can retrieve the footage AP auto generates when it thinks there's a crash imminent 4 | 5 | # IP to CID 6 | host="192.168.1.100" 7 | port="22" 8 | user="tesla1" 9 | 10 | # Imagemagick used to create the gif's 11 | sudo apt-get install --assume-yes imagemagick 12 | 13 | # Save the dash footage 14 | ssh -p $port $user@$host "mkdir ~/dashfootage; gwxfer gw:/DAS/ ~/dashfootage/; gwxfer gw:/EDR/DAS/ ~/dashfootage/" 15 | scp -P $port -r $user@$host:~/dashfootage ~/ 16 | cd ~/dashfootage/ 17 | 18 | # Author: Nemsoma 19 | # Summary: Rotate and create gif from png files 20 | 21 | # Delay between frames 22 | DELAY=25 23 | # The GIF filename format (see date manpage) 24 | GIF_FORMAT="+%Y-%m-%d %H:%M:%S" 25 | 26 | date -r 1234 &>/dev/null && BSD=1 27 | 28 | for d in */*; do 29 | mogrify -format png -flip -crop 320x207+0+0 +repage "${d}/*.PGM" 30 | 31 | stamp=$(echo "${d}" | cut -c -8) 32 | stamp=$((16#${stamp})) 33 | 34 | if [ -z $BSD ]; then 35 | convert -loop 0 -delay $DELAY ${d}/*.png "$(date -d @${stamp} "${GIF_FORMAT}")-$(echo ${d} | cut -d / -f 2).gif" 36 | else 37 | convert -loop 0 -delay $DELAY ${d}/*.png "$(date -r ${stamp} "${GIF_FORMAT}")-$(echo ${d} | cut -d / -f 2).gif" 38 | fi 39 | 40 | rm ${d}/*.png* 41 | done 42 | 43 | find . -type f ! -iregex '.*\.\(gif\|sh\)$' -delete 44 | find . -type d -empty -delete 45 | -------------------------------------------------------------------------------- /retrofit/subzero/heated-rear-seats.md: -------------------------------------------------------------------------------- 1 | # Heated Rear Seats 2 | 3 | ## Config 4 | 5 | ```bash 6 | access-internal-dat.pl rearseatheatersinstalled 1 7 | ``` 8 | 9 | ## Parts 10 | 11 | I don't really have part numbers for this. You need to find heated rear cushions & backs from a salvage yard or maybe you can ask Tesla nicely. 12 | 13 | 1005778-00-B - If you want occupancy detection, look for 3 silver parts on the bottom of the cushion. Typically only sold in EU, so you can buy them on ebay. The following photo does not have the detectors. 14 | 15 | ![](https://i.imgur.com/QesbQTI.png) 16 | 17 | ![](https://i.imgur.com/IMS6c45.png) 18 | 19 | You can verify if your car is compatible with rear occupancy by checking for 3 wires coming from your seat belts 20 | 21 | ![](https://i.imgur.com/FUop69C.png) 22 | 23 | You should also look for dangling wires under your rear seats, on the driver side. This is what your seat cushion plugs into to get heat. 24 | 25 | ![](https://i.imgur.com/fAEu4X7.png) 26 | 27 | ## Install 28 | 29 | 1. https://github.com/Lunars/tesla/blob/master/retrofit/subzero/Seat%20Cushion%20-%20Lower%20-%202nd%20Row%20(Remove%20and%20Install).pdf 30 | 31 | 2. https://github.com/Lunars/tesla/blob/master/retrofit/subzero/Bolster%20-%20Side%20-%20Seat%20-%202nd%20Row%20-%20LH%20(Remove%20and%20Replace).pdf 32 | 33 | 3. https://github.com/Lunars/tesla/blob/master/retrofit/subzero/Back%20Rest%20Assembly%20-%20Seat%20-%202nd%20Row%20-%20LH%20(Remove%20and%20Install).pdf 34 | -------------------------------------------------------------------------------- /src/scripts/misc/get-versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Retrieve the firmware versions installed, and determine which partition they are on 4 | 5 | 6 | PARTITIONPREFIX=$([ $(hostname) = ic ] && echo "mmcblk3p" || echo "mmcblk0p") 7 | 8 | OFFLINEMOUNTPOINT="/offline-usr" 9 | 10 | ONLINEPART=$(cat /proc/self/mounts | grep "/usr" | grep ^/dev/$PARTITIONPREFIX[12] | cut -b14) 11 | 12 | if [ "$ONLINEPART" == "1" ]; then 13 | OFFLINEPART=2 14 | elif [ "$ONLINEPART" == "2" ]; then 15 | OFFLINEPART=1 16 | else 17 | echo "Error figuring out which partition is which." 18 | exit 0 19 | fi 20 | 21 | mkdir $OFFLINEMOUNTPOINT 2>/dev/null 22 | 23 | mount -o ro /dev/$PARTITIONPREFIX$OFFLINEPART $OFFLINEMOUNTPOINT 24 | 25 | if [ ! -e "$OFFLINEMOUNTPOINT/deploy/platform.ver" ]; then 26 | echo "Error mounting offline partition." 27 | umount $OFFLINEMOUNTPOINT 2>/dev/null 28 | exit 0 29 | fi 30 | 31 | NEWVER=$(cat "$OFFLINEMOUNTPOINT/tesla/UI/bin/version.txt" | cut -d= -f2 | cut -d\- -f1) 32 | NEWCUSTVER=$(cat "$OFFLINEMOUNTPOINT/tesla/UI/bin/customerVersion.txt" | cut -d= -f2 | cut -d\- -f1) 33 | OLDVER=$(cat /usr/tesla/UI/bin/version.txt | cut -d= -f2 | cut -d\- -f1) 34 | 35 | echo "Online version: $OLDVER (/usr) /dev/$PARTITIONPREFIX$ONLINEPART" 36 | echo "Offline version: $NEWVER ($OFFLINEMOUNTPOINT) /dev/$PARTITIONPREFIX$OFFLINEPART" 37 | echo "Offline customer version: $NEWCUSTVER" 38 | echo 39 | 40 | umount $OFFLINEMOUNTPOINT 41 | rmdir $OFFLINEMOUNTPOINT 42 | 43 | exit 44 | -------------------------------------------------------------------------------- /dumps/2015.p85dl/internaldat: -------------------------------------------------------------------------------- 1 | chargertype single 2 | airsuspension 1 3 | adaptivecruise 0 4 | frontfog 1 5 | rearfog 0 6 | corneringlamps 1 7 | homelink 1 8 | sunroof 2 9 | powerlift 1 10 | audiotype premium 11 | headlamp hid 12 | blindspot 0 13 | rhd 0 14 | intrusiontilt 0 15 | memoryseats 1 16 | seattype 1 17 | memorymirrors 1 18 | ocs 1 19 | euvehicle 0 20 | interior 0 21 | exterior 12 22 | dash 6 23 | 4wd 1 24 | seatheaters 1 25 | performance 2 26 | badging 0 27 | fastcharge 1 28 | fastchargeinstalled 1 29 | spoilerinstalled 1 30 | wheeltype 19 31 | gpstype ublox 32 | mapregion us 33 | nokeylessentry 0 34 | nopushtounlock 0 35 | simulatedS1 0 36 | ambientlightsinstalled 1 37 | wiperheatinstalled 1 38 | rearseatheatersinstalled 1 39 | rearseattype 1 40 | parkassistinstalled 2 41 | headlightlevelerinstalled 0 42 | navigationallowed 1 43 | country us 44 | drlinstalled 1 45 | lightpipeinstalled 1 46 | sidemarkerinstalled 1 47 | foldingmirrors 1 48 | dimmablervmirror 1 49 | otherfastchargeallowed 0 50 | ionizertype 1 51 | twelvevbatterytype 1 52 | hvjb16aperphaseok 1 53 | tpmstype 1 54 | espinterface 2 55 | freeslavecharger 0 56 | steeringwheel 2 57 | steeringheat 1 58 | dashw 1 59 | forwardradarhw 1 60 | reardriveunittype 0 61 | autopilot 1 62 | compressortype 1 63 | xmantinstalled 1 64 | bodycontrolstype 0 65 | thbusinstalled 0 66 | auxhvactype 0 67 | exvtype 0 68 | shuttertype 0 69 | standbysupplyrequired 0 70 | epastype 0 71 | restraintcontrolstype 0 72 | nominalmass 0 73 | parksensorgeometrytype 0 74 | chassistype 0 75 | radarposition 0 76 | performanceaddon 1 77 | packconfig 70 -------------------------------------------------------------------------------- /src/scripts/on-reboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Pull in global vars 4 | mydir="${0%/*}" 5 | source "$mydir"/../config.sh 6 | 7 | function isRunning() { 8 | process=$(ps ax | grep "$1" | grep -v $$ | grep bash | grep -v grep) 9 | [ -n "$process" ] 10 | } 11 | 12 | function scriptBackground() { 13 | bash "$1" >/dev/null 2>&1 & 14 | } 15 | 16 | function beginScript() { 17 | echo "Found $1... " 18 | if ! isRunning "$1"; then 19 | echo "Starting" 20 | scriptBackground "$1" 21 | else 22 | echo "Already running" 23 | fi 24 | } 25 | 26 | function main() { 27 | echo "Starting Lunars" 28 | 29 | # Some of our scripts need CRON to work, such as the auto updater or token updater 30 | echo "Waiting for internet before continuing..." 31 | i=0 32 | while [ $i -lt 5 ]; do 33 | if check-internet parrot || check-internet wwan0 || check-internet ppp0; then 34 | echo "Found internet" 35 | break 36 | fi; 37 | 38 | ((i++)); 39 | if [[ "$i" == '5' ]]; then 40 | echo "Cancelling internet check as no connection was found within 5 minutes" 41 | break 42 | fi 43 | 44 | echo "Sleeping for 1m waiting for internet" 45 | sleep 60 46 | done 47 | 48 | echo "Continuing with Lunars startup" 49 | 50 | for scriptPath in "${scheduledScripts[@]}"; do 51 | beginScript "$scriptPath" 52 | done 53 | 54 | # Five minutes 55 | while true; do 56 | for scriptPath in "${everyFiveMinuteScripts[@]}"; do 57 | beginScript "$scriptPath" 58 | done 59 | echo "Waiting 5 minutes..." 60 | sleep 300 61 | done 62 | } 63 | 64 | main 65 | -------------------------------------------------------------------------------- /dumps/2014.p85+/internaldat: -------------------------------------------------------------------------------- 1 | chargertype single 2 | airsuspension 2 3 | adaptivecruise 0 4 | # 2018-08-29 11:20:25.752000 Toolbox lib-vehicle 2018.24.5 *** changed frontfog 0 => 1 5 | frontfog 1 6 | # access-internal-dat.pl 2018-11-02 06:17:42: Toolbox changed rearfog from 0 to 1 7 | rearfog 1 8 | corneringlamps 1 9 | homelink 1 10 | sunroof 1 11 | powerlift 1 12 | audiotype premium 13 | headlamp hid 14 | # access-internal-dat.pl 2018-11-04 05:48:06: Toolbox changed landeparture from 0 to 1 15 | landeparture 1 16 | # access-internal-dat.pl 2018-11-04 05:48:14: Toolbox changed blindspot from 0 to 1 17 | blindspot 1 18 | rhd 0 19 | intrusiontilt 0 20 | memoryseats 1 21 | memorymirrors 1 22 | ocs 1 23 | euvehicle 0 24 | interior 0 25 | exterior 1 26 | dash 6 27 | 4wd 0 28 | seatheaters 1 29 | performance 2 30 | badging 2 31 | fastcharge 1 32 | fastchargeinstalled 1 33 | spoilerinstalled 1 34 | wheeltype super_21_silver 35 | roofcolor none 36 | gpstype ublox 37 | mapregion us 38 | nokeylessentry 0 39 | nopushtounlock 0 40 | simulatedS1 0 41 | # access-internal-dat.pl 2018-11-04 05:58:14: Toolbox changed ambientlightsinstalled from 0 to 1 42 | ambientlightsinstalled 1 43 | wiperheatinstalled 1 44 | rearseatheatersinstalled 1 45 | parkassistinstalled 1 46 | headlightlevelerinstalled 0 47 | country us 48 | drlinstalled 1 49 | lightpipeinstalled 1 50 | sidemarkerinstalled 1 51 | foldingmirrors 1 52 | dimmablervmirror 1 53 | otherfastchargeallowed 0 54 | ionizertype 0 55 | # access-internal-dat.pl 2018-06-17 12:00:52: Teleforce user *** changed twelveVBatteryType from 1 to 2 56 | twelveVBatteryType 2 57 | packconfig 41 58 | -------------------------------------------------------------------------------- /retrofit/subzero/heated-nozzles.md: -------------------------------------------------------------------------------- 1 | # Heated washer nozzles 2 | 3 | ## Config 4 | 5 | ```bash 6 | # May not be an internal.dat option, did not find subzero cars with this enabled 7 | access-internal-dat.pl nozzleHeatInstalled 1 8 | 9 | # Could just be VAPI 10 | sdv VAPI_hasNozzleHeater 1 11 | ``` 12 | 13 | ## Parts 14 | 15 | * $60 - 1025202-00-C - Windshield washer nozzles with harness and hose 16 | 17 | If you have wiring conduit running alongside the water hose, you have heated nozzle capability and only need the following: 18 | 19 | * $25 - 1005404-01-E - Heated washer nozzle assembly - 2x 20 | 21 | ## Install 22 | 23 | Install is simple, remove the existing washer nozzles (clips off at the bottom, then pull the hose out of the connection to remove). And replace with your new harness & hose. 24 | 25 | The new harness will plug into your left front wheel well, where the washer fluid reservoir is. You will find a connector not going anywhere near there. This is what your new electronic hose connects to. Mine had a dummy connector plugged into it, you can remove that and plug in the new hose instead. 26 | 27 | Dummy connector: https://photos.app.goo.gl/wCh1JgcX7GPhbTDQ9 28 | 29 | Part of the new harness will run up behind the front hood 30 | 31 | ![](https://i.imgur.com/mHpsFIE.png) 32 | 33 | In this photo you can see the conduit + the hose. Conduit has a connector going into the washer nozzles. So check if your car has it. 34 | 35 | ![](https://i.imgur.com/SZDE3TW.png) 36 | 37 | ![](https://i.imgur.com/oxWa0d3.png) 38 | 39 | Non heated nozzles will only have hose, no wiring 40 | 41 | ![non-heated](https://i.imgur.com/TweD8rF.png) 42 | -------------------------------------------------------------------------------- /retrofit/pup.md: -------------------------------------------------------------------------------- 1 | # Premium Upgrades Package 2 | 3 | ## Ambient lighting 4 | 5 | https://www.teslarati.com/tesla-model-s-premium-lighting-package-review/ 6 | 7 | ![](https://i.imgur.com/4N57Vyk.jpg) 8 | 9 | ![](https://i.imgur.com/efw7xfS.jpg) 10 | 11 | ### Config 12 | 13 | ``` 14 | access-internal-dat.pl ambientlightsinstalled 1 15 | ``` 16 | 17 | ### Parts 18 | 19 | Official parts for Tesla door ambient lighting 20 | 21 | * P/N 1007955-00-F RH Front Door ($54.48) 22 | * P/N 1008121-00-F RH Rear Door ($45.98) 23 | * P/N 1002977-00-F LH Front Door ($54.48) 24 | * P/N 1007988-00-F LH Rear Door ($45.98) 25 | 26 | Or, you can connect your own LED strips to the doors 27 | 28 | * [Led strip](https://www.amazon.com/gp/product/B005GL5R56/) 29 | Make sure to get your interior nice and hot for a few hours to help the adhesive really stick. Also give it a good rub once it's hot. If you dont do this you may find them falling off every few hours like I did. 30 | 31 | Puddle lights & seat lights 32 | 33 | * [Lighting under seats & rear door puddles](https://www.amazon.com/gp/product/B079C6T6HJ/) 34 | * [To mount the lights under the front seats, shining towards the rear](https://www.abstractocean.com/foot-well-light-brackets-for-model-s-one-pair-tesla-part-1016677-00-a/#product-additional-info) 35 | * [Optional cables that plug into stock harness.](https://www.amazon.com/gp/product/B00VDOD9AA) 36 | 37 | 38 | ## Adaptive headlights 39 | 40 | ### Config 41 | 42 | ``` 43 | access-internal-dat.pl headlamp led 44 | access-internal-dat.pl turnsignal led 45 | ``` 46 | 47 | ### Parts 48 | 49 | * 1053571- 1 00-D - HD/LP ASY, SAE UP-LEVEL, RH 50 | * 1053570- 1 00-D - HD/LP ASY, SAE UP-LEVEL, LH 51 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/create-accounts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Adds your pub key to 3 users. tesla, yourUsername, and root 4 | 5 | if [[ "$keyToSaveToCar" =~ "example" ]] || [ -z "$keyToSaveToCar" ] || [ "$accountPassToSaveToCar" == "myCarIsRooted" ]; then 6 | echo "Script not yet setup, quitting" 7 | exit 1 8 | fi 9 | 10 | lastten=${keyToSaveToCar: -21} 11 | mkdir -p /home/$accountUserToSaveToCar/.ssh 2>&1 12 | mkdir -p /root/.ssh 2>&1 13 | mkdir -p /home/tesla/.ssh 2>&1 14 | chown -R $accountUserToSaveToCar /home/$accountUserToSaveToCar/.ssh 15 | 16 | if getent passwd $accountUserToSaveToCar >/dev/null 2>&1; then 17 | echo "$accountUserToSaveToCar already exists" 18 | else 19 | useradd -c "Car OWNER account DO NOT REMOVE" -s /bin/bash -u 10369 -G tesla -G root $accountUserToSaveToCar 20 | # Make this user sudo 21 | usermod -a -G admin,sudo,log $accountUserToSaveToCar 22 | mkdir /home/$accountUserToSaveToCar 2>&1 23 | chown $accountUserToSaveToCar:$accountUserToSaveToCar /home/$accountUserToSaveToCar 24 | usermod -aG sudo $accountUserToSaveToCar 25 | echo $accountUserToSaveToCar:$accountPassToSaveToCar | chpasswd 26 | fi 27 | 28 | # Add the ssh keys to each user 29 | touch /root/.ssh/authorized_keys 30 | 31 | grep --quiet "$lastten" /home/$accountUserToSaveToCar/.ssh/authorized_keys && echo "Already added key to /home/$accountUserToSaveToCar" || echo "$keyToSaveToCar" >>/home/$accountUserToSaveToCar/.ssh/authorized_keys 32 | grep --quiet "$lastten" /home/tesla/.ssh/authorized_keys && echo "Already added key to /home/tesla" || echo "$keyToSaveToCar" >>/home/tesla/.ssh/authorized_keys 33 | grep --quiet "$lastten" /root/.ssh/authorized_keys && echo "Already added key to /root" || echo "$keyToSaveToCar" >>/root/.ssh/authorized_keys 34 | -------------------------------------------------------------------------------- /src/save-vitals.php: -------------------------------------------------------------------------------- 1 | convertToData(Phar::ZIP); 36 | $zip = new ZipArchive; 37 | $res = $zip->open($zipFile); 38 | if ($res === TRUE) { 39 | $zip->extractTo($path); 40 | $zip->close(); 41 | } 42 | 43 | unlink($file); 44 | unlink($zipFile); 45 | 46 | // Fix vitals fetcher 47 | file_put_contents($path . '/assets/vehicle_vitals.js', $newData, FILE_APPEND | LOCK_EX); 48 | exit; 49 | } else { 50 | $input = @file_get_contents('php://input'); 51 | 52 | // Make sure there is actually data 53 | if (!empty($input) && isJson($input)) { 54 | // Write file being sent to vitals.json 55 | $file = 'vitals.json'; 56 | $handle = fopen($file, 'w'); 57 | fwrite($handle, $input); 58 | fclose($handle); 59 | 60 | $sum = md5_file('assets/vehicle_vitals_layout.js'); 61 | echo $sum; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /dumps/2016.p90dl/internaldat: -------------------------------------------------------------------------------- 1 | chargertype singleLimited 2 | airsuspension 3 3 | adaptivecruise 0 4 | frontfog 1 5 | rearfog 1 6 | corneringlamps 1 7 | homelink 1 8 | sunroof 2 9 | powerlift 1 10 | audiotype premium 11 | pwssupported 0 12 | pwsSpeakerType 1 13 | headlamp led 14 | blindspot 0 15 | rhd 0 16 | intrusiontilt 1 17 | memoryseats 1 18 | seattype 1 19 | seatfabrictype 0 20 | memorymirrors 1 21 | ocs 1 22 | euvehicle 0 23 | interior 0 24 | exterior 12 25 | 4wd 1 26 | seatheaters 1 27 | performance 2 28 | badging 0 29 | fastcharge 1 30 | fastChargeInstalled 2 31 | spoilerinstalled 1 32 | wheeltype 10 33 | fasciatype 1 34 | gpstype ublox 35 | mapregion us 36 | nokeylessentry 0 37 | nopushtounlock 0 38 | simulatedS1 0 39 | ambientlightsinstalled 1 40 | wiperheatinstalled 1 41 | rearseatheatersinstalled 1 42 | rearseattype 1 43 | parkassistinstalled 2 44 | headlightlevelerinstalled 0 45 | navigationallowed 1 46 | country us 47 | drlinstalled 0 48 | lightpipeinstalled 1 49 | sidemarkerinstalled 1 50 | foldingmirrors 1 51 | dimmablervmirror 1 52 | otherfastchargeallowed 0 53 | ionizertype 0 54 | twelveVBatteryType 1 55 | pumpsettype 1 56 | hvjb16aperphaseok 1 57 | tpmstype 3 58 | espinterface 2 59 | steeringwheel 3 60 | steeringheat 1 61 | steeringcolumntype 1 62 | dashw 1 63 | forwardradarhw 1 64 | reardriveunittype 0 65 | autopilot 1 66 | compressortype 3 67 | xmantinstalled 1 68 | bodycontrolstype 0 69 | thbusinstalled 0 70 | auxhvactype 0 71 | exvtype 1 72 | shuttertype 0 73 | standbysupplyrequired 1 74 | epastype 3 75 | restraintcontrolstype 0 76 | restraintshardwaretype 11 77 | numberhvilnodes 4 78 | nominalmass 0 79 | parksensorgeometrytype 1 80 | chassistype 0 81 | radarposition 1 82 | intakeairfiltertype 3 83 | airqualitysensortype 1 84 | performanceaddon 1 85 | rearfacingseats 0 86 | efficiencypackage 1 87 | tractioncontroltype 0 88 | curvelightingtype 1 89 | packconfig 75 90 | ethernettunertype 0 91 | connectivitypackage 1 92 | disablesupportforkeepawakes 0 93 | screenadhesivetype 1 94 | -------------------------------------------------------------------------------- /dumps/2016.75d.ap2/internal.dat: -------------------------------------------------------------------------------- 1 | chargertype singleLimited 2 | packconfig 80 3 | softpackconfig 0 4 | airsuspension 3 5 | brakehwtype 0 6 | adaptivecruise 0 7 | frontfog 1 8 | rearfog 0 9 | corneringlamps 1 10 | homelink 1 11 | sunroof 2 12 | powerlift 1 13 | audiotype premium 14 | pwssupported 0 15 | pwsspeakertype 0 16 | headlamp led 17 | blindspot 0 18 | rhd 0 19 | intrusiontilt 0 20 | memoryseats 1 21 | seattype 1 22 | seatfabrictype 0 23 | memorymirrors 1 24 | ocs 1 25 | euvehicle 0 26 | interior 0 27 | exterior 14 28 | 4wd 1 29 | seatheaters 1 30 | performance 1 31 | badging 0 32 | fastcharge 1 33 | fastchargeinstalled 1 34 | spoilerinstalled 0 35 | wheeltype 10 36 | fasciatype 1 37 | gpstype ublox 38 | mapregion us 39 | nokeylessentry 0 40 | nopushtounlock 0 41 | simulatedS1 0 42 | ambientlightsinstalled 1 43 | wiperheatinstalled 1 44 | rearseatheatersinstalled 1 45 | rearseattype 1 46 | parkassistinstalled 3 47 | headlightlevelerinstalled 0 48 | navigationallowed 1 49 | country us 50 | drlinstalled 0 51 | lightpipeinstalled 1 52 | sidemarkerinstalled 1 53 | foldingmirrors 1 54 | dimmablervmirror 1 55 | otherfastchargeallowed 0 56 | ionizertype 0 57 | twelveVBatteryType 1 58 | pumpsettype 1 59 | hvjb16aperphaseok 1 60 | tpmstype 3 61 | espinterface 2 62 | steeringwheel 3 63 | steeringheat 1 64 | steeringcolumntype 1 65 | steeringcolumnharness 0 66 | dashw 2 67 | forwardradarhw 1 68 | reardriveunittype 1 69 | autopilot 3 70 | compressortype 3 71 | xmantinstalled 1 72 | bodycontrolstype 0 73 | thbusinstalled 0 74 | auxhvactype 0 75 | exvtype 1 76 | shuttertype 0 77 | standbysupplyrequired 1 78 | epastype 3 79 | restraintcontrolstype 0 80 | restraintshardwaretype 11 81 | numberhvilnodes 4 82 | nominalmass 0 83 | parksensorgeometrytype 1 84 | parkpowersource 0 85 | chassistype 0 86 | radarposition 1 87 | intakeairfiltertype 3 88 | airqualitysensortype 1 89 | temperaturehumiditysensor 1 90 | performanceaddon 3 91 | rearfacingseats 0 92 | efficiencypackage 1 93 | tractioncontroltype 0 94 | curvelightingtype 1 95 | backupcameratype 1 96 | screenAdhesiveType 1 97 | -------------------------------------------------------------------------------- /retrofit/subzero/heated-wheel.md: -------------------------------------------------------------------------------- 1 | # Heated steering wheel, > Dec 2014 needs physical harness modification 2 | 3 | 4 | ## Install 5 | 6 | Wiring exists coming from dash to behind the steering column for all vehicles built after Dec 8 2014 7 | 8 | Everything is plug and play. Remove steering wheel, remove SCCM. Add new SCCM, add new steering wheel. 9 | 10 | Insert the heated contact plate into the new steering wheel (before install would help). All the wires will make sense when you go to install 11 | 12 | Pre Dec 2014 cars need additional modification since the harness plugging into SCCM does not have power and ground for the heater. 13 | 14 | For the modification you will need to remove the green Pin 6 on the yellow SCCM connector. After you remove that replace it with a new wire connected to constant 12V. 15 | 16 | Create a ground wire like above and place it in pin 7 of the SCCM connector. 17 | 18 | 19 | Link with pictures https://teslamotorsclub.com/tmc/posts/3993410/ 20 | 21 | ## Config 22 | 23 | ```bash 24 | access-internal-dat.pl steeringheat 1 25 | ``` 26 | 27 | ## Parts 28 | 29 | * $200 - 1036774-00-D - Wheel with heated component, make sure it has the wire hanging out 30 | 31 | ![](https://i.imgur.com/6AMML5Q.jpg) 32 | 33 | * $115 - Steering heater ecu and connected harness. You really only need the ecu, the wires going to and from it, and the ecu bracket that snaps onto the plate and holds the ecu + side connectors in place. You don't need this whole black plate 34 | 35 | "HEATED FUNCTION STEERING WHEEL CONTACT PLATE MODULE" 36 | 37 | ![](https://i.imgur.com/rVTehNB.jpg) 38 | 39 | * $115 - 1057354-00-B - SCCM with 5 pins on left front. Do not buy one with 3 pins in the front left connector (brown connector)! 40 | 41 | ![](https://i.imgur.com/oG38xw6.png) 42 | 43 | * $40 - 2498689 - Steering airbag wiring harness, with 5 pins in brown connector (blue and brown for heated wheel, typically). You need the white connector going into right voice switch, it has more pins than a non-heated switch connector. You also need the two black connectors that go into the ecu. You do not need the yellow connector (airbag) 44 | 45 | ![](https://i.imgur.com/KF0iur4.jpg) 46 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/speed-sensitive-volume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # minimum miles/h at which volume will start to auto adjust 4 | MIN_SPEED=10 5 | # step size in miles/h at which volume adjusts by $VOLUME_INCREMENT (8 for example will cause volume to adjust up/down every 8 mph) 6 | VOLUME_SPEED_STEP=8 7 | # amount of volume that will increase or decrease per $VOLUME_SPEED_STEP - integer value (x10000) since bash doesn't support floating point calculations 8 | # tesla default is 0.333 per scroll (GUI_audioVolumeIncrement). we use half that (x10000) to make auto volume adjustments smooth 9 | VOLUME_INCREMENT=1665 10 | 11 | function get_volume_int() { 12 | lv GUI_audioVolume | awk -F\" '{ printf "%d", $2 * 10000 }' 13 | } 14 | function get_speed_int() { 15 | lv VAPI_vehicleSpeed | awk -F\" '{ printf "%d", $2 }' 16 | } 17 | 18 | INIT_VOLUME=$(get_volume_int) 19 | PREV_VOLUME=$INIT_VOLUME 20 | INIT_SPEED=$(get_speed_int) 21 | PREV_SPEED=$INIT_SPEED 22 | 23 | while true; do 24 | CURRENT_VOLUME=$(get_volume_int) 25 | CURRENT_SPEED=$(get_speed_int) 26 | if ((PREV_VOLUME != CURRENT_VOLUME)); then 27 | INIT_VOLUME=$CURRENT_VOLUME 28 | PREV_VOLUME=$INIT_VOLUME 29 | INIT_SPEED=$CURRENT_SPEED 30 | PREV_SPEED=$INIT_SPEED 31 | elif ((CURRENT_VOLUME > 0 && (CURRENT_SPEED > MIN_SPEED || PREV_SPEED >= MIN_SPEED))); then 32 | SPEED_DIFF=$((CURRENT_SPEED - PREV_SPEED)) 33 | # avoid volume adjustments while driving at somewhat constant speed and minimize sdv calls 34 | if ((SPEED_DIFF > 3 || SPEED_DIFF < -3)); then 35 | OFFSET_CURRENT_SPEED=$((CURRENT_SPEED > MIN_SPEED ? CURRENT_SPEED - MIN_SPEED : 0)) 36 | OFFSET_INIT_SPEED=$((INIT_SPEED > MIN_SPEED ? INIT_SPEED - MIN_SPEED : 0)) 37 | NEW_VOLUME=$((INIT_VOLUME + (VOLUME_INCREMENT * ((OFFSET_CURRENT_SPEED - OFFSET_INIT_SPEED) / VOLUME_SPEED_STEP)))) 38 | if ((NEW_VOLUME <= 0)); then 39 | NEW_VOLUME=$VOLUME_INCREMENT 40 | fi 41 | sdv GUI_audioVolume $(echo $NEW_VOLUME | awk '{printf "%.4f", $1 / 10000}') 42 | PREV_VOLUME=$(get_volume_int) 43 | PREV_SPEED=$CURRENT_SPEED 44 | fi 45 | fi 46 | if ((CURRENT_SPEED == 0)) && [[ $(lv VAPI_driverPresent) != '"true"' ]]; then 47 | /bin/sleep 60 48 | else 49 | /bin/sleep 1.5 50 | fi 51 | done 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Welcome to the Tesla Jailbreak Repo 👋

2 |

3 | Version 4 | 5 | Documentation 6 | 7 |

8 | 9 | > Helpful tools, scripts, and information about what you can do with root access to your Tesla Model S / X. 10 | 11 | ## Prerequisite 12 | 13 | You must have already rooted your Tesla. This is the only prerequisite. 14 | 15 | These scripts were designed for MCU1, Tegra. They are not guaranteed to work on Intel MCU2 16 | 17 | ## Install 18 | 19 | ```sh 20 | # Connect to your Tesla via SSH 21 | ssh tesla1@cid 22 | sudo su 23 | 24 | # Run the install script which downloads this repo and creates the cron entry 25 | bash <(curl -sL "https://raw.githubusercontent.com/Lunars/tesla/master/src/install.sh") 26 | ``` 27 | 28 | ## Updating 29 | 30 | Lunars will automatically check for updates when your car boots up. So hold the two scroll wheels to reboot and it will check on boot up. 31 | 32 | Or, you can simply run the install steps. Lunars will automatically know to update your current installation. 33 | 34 | During update, only the following will be preserved. Any changes to the lunars directory otherwise will be wiped and updated to the latest Github copy. 35 | 36 | 1. config.sh # New scripts will automatically be added and commented out by default 37 | 2. tesla.ovpn 38 | 3. overwrite-files 39 | 40 | ## Usage 41 | 42 | Fill in the variables on [/var/lunars/config.sh](https://github.com/Lunars/tesla/blob/master/src/config.sh) and uncomment the scripts you want to run. Some scripts are already enabled by default. 43 | 44 | ## 🤝 Contributing 45 | 46 | Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/Lunars/tesla/issues). 47 | 48 | ## Show your support 49 | 50 | [Consider sponsoring](https://github.com/sponsors/Lunars) to help future updates. 51 | Give a ⭐️ if this project helped you! 52 | 53 | ## 📝 License 54 | 55 | This project is licensed under the [GNU General Public License v3.0](https://github.com/Lunars/tesla/blob/master/LICENSE). 56 | -------------------------------------------------------------------------------- /src/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin 4 | 5 | # Changed from /home/ because a factory reset will wipe out Lunars in /home/ but will remain in /var/ 6 | export homeOfLunars="/var/lunars" 7 | 8 | ## create-accounts.sh 9 | # Recommend you fill this out for easier SSH to your car 10 | export keyToSaveToCar="ssh-rsa first example" 11 | export accountUserToSaveToCar="yourUsername" 12 | export accountPassToSaveToCar="myCarIsRooted" 13 | 14 | ## reverse-tunnel.sh 15 | # Could be used on other files in the future 16 | export nonStandardPort=$(cut -c 14-17 filename)) { 12 | $fh = fopen($this->filename, 'w') or die("Can't create file"); 13 | } 14 | 15 | if (empty($_GET['s1']) || empty($_GET['s2'])) { 16 | $this->showLastKey(); 17 | } else { 18 | $this->saveKeys(); 19 | } 20 | } 21 | 22 | function showLastKey() 23 | { 24 | $str_data = file_get_contents($this->filename); 25 | $decoded = json_decode($str_data); 26 | if (!empty($_GET['car'])) { 27 | $decoded->tokens = array_filter((array)$decoded->tokens, function ($v) { 28 | return $v->car === $_GET['car']; 29 | }); 30 | } 31 | 32 | if (!empty($decoded)) { 33 | $last = end($decoded->tokens); 34 | if ($last) { 35 | $last->saved_date = date('Y-m-d G:i', $last->saved_date); 36 | } 37 | 38 | header('Content-Type: application/json'); 39 | echo json_encode($last, JSON_PRETTY_PRINT); 40 | exit; 41 | } 42 | } 43 | 44 | function saveKeys() 45 | { 46 | $str_data = file_get_contents($this->filename); 47 | $decoded = json_decode($str_data, true); 48 | if (empty($decoded)) $decoded = []; 49 | if (empty($decoded['tokens'])) $decoded['tokens'] = []; 50 | 51 | // Remove duplicate tokens, in case the cron runs often 52 | $decoded['tokens'] = array_filter($decoded['tokens'], function ($v) { 53 | return $v['tesla1'] != $_GET['s1'] && $v['tesla2'] != $_GET['s2']; 54 | }); 55 | $newTokens = ['tesla1' => $_GET['s1'], 'tesla2' => $_GET['s2'], 'saved_date' => strtotime('now')]; 56 | if (!empty($_GET['car'])) { 57 | $newTokens['car'] = $_GET['car']; 58 | } 59 | if (!empty($_GET['unlock_token'])) { 60 | $newTokens['unlock_token'] = $_GET['unlock_token']; 61 | } 62 | 63 | array_push($decoded['tokens'], $newTokens); 64 | 65 | // format the data 66 | $formattedData = json_encode($decoded); 67 | 68 | // open or create the file 69 | $handle = fopen($this->filename, 'w+'); 70 | 71 | // write the data into the file 72 | fwrite($handle, $formattedData); 73 | 74 | // close the file 75 | fclose($handle); 76 | 77 | echo strlen($str_data) !== strlen($formattedData) ? 'New keys saved.' : 'These keys already exist. No changes made.'; 78 | } 79 | } 80 | 81 | new TeslaKeys(); 82 | -------------------------------------------------------------------------------- /src/scripts/misc/vnc-remote-control.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This lets you control your MCU remotely from your computer 4 | # Clicking inside the VNC client routes the click to your MCU 5 | 6 | # Downloads a 2.3mb rootfs and chroots to it to install x11vnc 7 | # I use reverse shell to forward port 5900, then connect localhost:5900 8 | 9 | # eg https://i.imgur.com/WRb8MFv.png 10 | 11 | # Don't run me inside chroot 12 | [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ] && exit 13 | 14 | CHROOT="/home/tesla/alpine3.11" 15 | 16 | function mountStuff() { 17 | mount -o remount,exec,suid,symfollow /home # need this to allow execution on /home 18 | mount -o bind /dev ${CHROOT}/dev 19 | mount -o bind /proc ${CHROOT}/proc 20 | mount -t sysfs archsys ${CHROOT}/sys 21 | mount -o bind /tmp ${CHROOT}/tmp 22 | mount -t devpts archdevpts ${CHROOT}/dev/pts 23 | mount /var -o remount,exec,suid,symfollow 24 | mount -o bind /var ${CHROOT}/var 25 | } 26 | 27 | if [ ! -d "$CHROOT" ]; then 28 | ARCH=$(uname -m) 29 | ALPINE_URI="http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/$ARCH/alpine-minirootfs-3.11.3-$ARCH.tar.gz" 30 | curl -O ${ALPINE_URI} 31 | mkdir -p ${CHROOT} 32 | tar -zxvf $(basename ${ALPINE_URI}) -C ${CHROOT} 33 | mountStuff 34 | cat < /var/captureClicks.sh << 'EOF' 53 | #!/bin/bash 54 | EOF << "VERTICAL_DISPLAY=${VERTICAL_DISPLAY}" << 'EOF' 55 | 56 | while read line; do 57 | if [[ "$line" == *ButtonPress* ]]; then 58 | y=$(echo $line | cut -d " " -f 3) 59 | x=$(echo $line | cut -d " " -f 4) 60 | 61 | if [ "$VERTICAL_DISPLAY" == true ]; then 62 | x=$((1200 - $x)) 63 | fi 64 | 65 | curl -s "http://cid:4070/injectMouseEvent?action=down&x=$x&y=$y&id=0" 66 | sleep 0.1 67 | curl -s "http://cid:4070/injectMouseEvent?action=release&x=$x&y=$y&id=0" 68 | fi 69 | done <"${1:-/dev/stdin}" 70 | EOF 71 | fi 72 | 73 | cat < 27 | 28 |
29 |

Hello Master,

30 |

Please see the attached screen shots:

31 |

CID

32 | 33 |

IC

34 | 35 |
36 | 37 | " >$m_file 38 | 39 | mail_from="Your Tesla <$m_from>" 40 | mail_to="The Master <$m_to>" 41 | mail_subject="Requested Screenshots" 42 | mail_reply_to="Your Tesla <$m_from>" 43 | mail_cc="" 44 | 45 | function add_file() { 46 | echo "--MULTIPART-MIXED-BOUNDARY 47 | Content-Type: $1 48 | Content-Transfer-Encoding: base64" >>"$m_data" 49 | 50 | if [ ! -z "$2" ]; then 51 | echo "Content-Disposition: inline 52 | Content-Id: <$2>" >>"$m_data" 53 | else 54 | echo "Content-Disposition: attachment; filename=$4" >>"$m_data" 55 | fi 56 | echo "$3 57 | 58 | " >>"$m_data" 59 | } 60 | 61 | message_base64=$(cat $m_file | base64) 62 | 63 | echo "From: $mail_from 64 | To: $mail_to 65 | Subject: $mail_subject 66 | Reply-To: $mail_reply_to 67 | Cc: $mail_cc 68 | MIME-Version: 1.0 69 | Content-Type: multipart/mixed; boundary=\"MULTIPART-MIXED-BOUNDARY\" 70 | 71 | --MULTIPART-MIXED-BOUNDARY 72 | Content-Type: multipart/alternative; boundary=\"MULTIPART-ALTERNATIVE-BOUNDARY\" 73 | 74 | --MULTIPART-ALTERNATIVE-BOUNDARY 75 | Content-Type: text/html; charset=utf-8 76 | Content-Transfer-Encoding: base64 77 | Content-Disposition: inline 78 | 79 | $message_base64 80 | --MULTIPART-ALTERNATIVE-BOUNDARY--" >"$m_data" 81 | 82 | image_base64=$(cat $CIDPATH | base64) 83 | add_file "image/png" "png_cid.png" "$image_base64" 84 | image_base64=$(cat $ICPATH | base64) 85 | add_file "image/png" "png_ic.png" "$image_base64" 86 | 87 | echo "--MULTIPART-MIXED-BOUNDARY--" >>"$m_data" 88 | 89 | curl -u $m_usr:$m_pwd -n --ssl-reqd --mail-from "<$m_from>" --mail-rcpt "<$m_to>" --url $server -T $m_data 90 | 91 | rm $m_file 92 | rm $m_data 93 | rm $CIDPATH 94 | rm $ICPATH 95 | -------------------------------------------------------------------------------- /dumps/2018.X100D.AP3/internal.dat: -------------------------------------------------------------------------------- 1 | chargertype single 2 | packconfig 79 3 | frontdoorlatchtype 1 4 | chargercrash 1 5 | airsuspension 3 6 | brakehwtype 1 7 | adaptivecruise 0 8 | frontfog 1 9 | rearfog 1 10 | corneringlamps 1 11 | falconCapSensorInstalled 1 12 | powerLiftGateStrutType 0 13 | homelink 3 14 | sunroof 0 15 | powerlift 1 16 | audiotype base 17 | pwssupported 0 18 | pwsspeakertype 0 19 | headlamp led 20 | blindspot 0 21 | rhd 0 22 | intrusiontilt 0 23 | memoryseats 2 24 | seattype 0 25 | seatfabrictype 0 26 | rearseatcontrollermask 5 27 | memorymirrors 1 28 | ocs 1 29 | euvehicle 0 30 | interior 0 31 | exterior 11 32 | dash 6 33 | 4wd 1 34 | seatheaters 1 35 | performance 1 36 | performanceaddon 3 37 | badging 0 38 | # access-internal-dat.pl 2018-09-25 22:10:28: changed fastcharge from 2 to 1 39 | fastcharge 1 40 | # access-internal-dat.pl 2019-06-19 22:25:05: changed fastChargeInstalled from 1 to 3 41 | fastChargeInstalled 3 42 | spoilerinstalled 1 43 | # access-internal-dat.pl 2020-12-23 02:27:32: changed wheeltype from 13 to 21 44 | wheeltype 21 45 | fasciatype 0 46 | screenadhesivetype 1 47 | gpstype ublox 48 | mapregion eu 49 | nokeylessentry 0 50 | nopushtounlock 0 51 | simulatedS1 0 52 | ambientlightsinstalled 1 53 | wiperheatinstalled 0 54 | rearseatheatersinstalled 0 55 | rearseattype 3 56 | frontseatventilationtype 0 57 | frontdooractuationtype 1 58 | thirdrowseattype 1 59 | parkassistinstalled 3 60 | headlightlevelerinstalled 0 61 | navigationallowed 1 62 | country us 63 | drlinstalled 1 64 | lightpipeinstalled 1 65 | sidemarkerinstalled 1 66 | foldingmirrors 1 67 | dimmablervmirror 1 68 | otherfastchargeallowed 1 69 | ionizertype 0 70 | twelvevbatterytype 3 71 | pumpsettype 1 72 | hvjb16aperphaseok 1 73 | tpmstype 3 74 | espinterface 2 75 | steeringwheel 3 76 | steeringheat 0 77 | steeringcolumntype 0 78 | steeringcolumnharness 1 79 | # access-internal-dat.pl 2019-11-19 13:39:23: changed dashw from 3 to 4 80 | dashw 4 81 | forwardradarhw 2 82 | reardriveunittype 1 83 | # access-internal-dat.pl 2019-08-11 11:29:24: changed autopilot from 2 to 3 84 | autopilot 3 85 | compressortype 2 86 | xmantinstalled 0 87 | bodycontrolstype 1 88 | thbusinstalled 1 89 | auxhvactype 1 90 | exvtype 1 91 | shuttertype 1 92 | standbysupplyrequired 1 93 | epastype 4 94 | falconinwardussinstalled 2 95 | restraintcontrolstype 1 96 | restraintshardwaretype 1 97 | numberhvilnodes 4 98 | nominalmass 1 99 | parksensorgeometrytype 2 100 | parkpowersource 1 101 | chassistype 1 102 | radarposition 2 103 | radiatorbypassvalvetype 1 104 | modevalvetype 1 105 | intakeairfiltertype 2 106 | airqualitysensortype 1 107 | incartempsensortype 1 108 | temperaturehumiditysensor 1 109 | towpackage 1 110 | efficiencypackage 0 111 | tractioncontroltype 0 112 | curvelightingtype 1 113 | backupcameratype 1 114 | efusetype 1 115 | # access-internal-dat.pl 2019-11-07 12:59:48: changed disablesupportforkeepawakes from default to 1 116 | # access-internal-dat.pl 2019-11-20 09:25:18: changed disablesupportforkeepawakes from 1 to 0 117 | disablesupportforkeepawakes 0 118 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at russell@deephire.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /src/scripts/misc/screenshot-remote-control.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import random 3 | from http.server import BaseHTTPRequestHandler 4 | from urllib import parse 5 | from requests import get 6 | import time 7 | import base64 8 | from os import system, remove 9 | from urllib import parse 10 | 11 | # Visit http://:4071/ to view your screen 12 | # Click anywhere on the image to send the same click to your screen 13 | # This is a poor man's remote control, I recommend you use vnc-remote-control.sh instead 14 | 15 | class GetHandler(BaseHTTPRequestHandler): 16 | 17 | def do_GET(self): 18 | 19 | # Wake screen 20 | system('tap-tap') 21 | 22 | # Get click X,Y 23 | params = dict(parse.parse_qsl(parse.urlsplit(self.path).query)) 24 | if params.get("x", None): 25 | get("http://cid:4070/injectMouseEvent?action=%s&x=%s&y=%s&id=%s" % ("down",params["x"],params["y"],0)) 26 | get("http://cid:4070/injectMouseEvent?action=%s&x=%s&y=%s&id=%s" % ("release",params["x"],params["y"],0)) 27 | time.sleep(10) 28 | 29 | # Get screenshot to data uri 30 | ss_url = 'http://cid:4070/screenshot' 31 | ss_file = get(url=ss_url) 32 | ss_file = ss_file.json()['_rval_'] 33 | time.sleep(10) 34 | img = open(ss_file, "rb").read() 35 | plot_bytes_encode = str(base64.b64encode(img)) 36 | plot_bytes_encode = plot_bytes_encode[0:-1] 37 | plot_bytes_encode_fin = plot_bytes_encode[2:] 38 | stringpic = "data:image/png;base64," + plot_bytes_encode_fin 39 | 40 | self.send_response(200) 41 | self.send_header('Content-Type', 'text/html') 42 | self.end_headers() 43 | 44 | self.wfile.write( 45 | bytes(r""" 46 | 47 | 48 | 49 | 50 | 51 | 52 | Lunars VNC 53 | 54 | 55 | 56 | 65 | 66 | 67 | 68 | cid 69 | 70 | 71 | 72 | """, "utf8")) 73 | 74 | remove(ss_file) 75 | 76 | 77 | if __name__ == '__main__': 78 | 79 | print('configuring iptables for port 4071') 80 | system('/usr/sbin/iptables -D INPUT -i parrot -p tcp -m tcp --dport 4071 -j ACCEPT') 81 | system('/usr/sbin/iptables -I INPUT -i parrot -p tcp -m tcp --dport 4071 -j ACCEPT') 82 | system('{ echo; sleep 1; echo; sleep 1; echo "iptables -t nat -D PREROUTING -i mlan0 -p tcp -m tcp --dport 4071 -j DNAT --to-destination 192.168.20.2:4071"; sleep 1; echo "iptables -t nat -I PREROUTING -i mlan0 -p tcp -m tcp --dport 4071 -j DNAT --to-destination 192.168.20.2:4071"; sleep 1; echo "iptables -D INPUT -p tcp --dport 4071 -j ACCEPT"; sleep 1; echo "iptables -I INPUT -p tcp --dport 4071 -j ACCEPT"; sleep 1; } | socat - tcp:parrot:telnet') 83 | 84 | from http.server import HTTPServer 85 | server = HTTPServer(('', 4071), GetHandler) 86 | print('Starting server, ctrl-c to stop') 87 | server.serve_forever() 88 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/freedomevstart.sh: -------------------------------------------------------------------------------- 1 | # Credits to https://github.com/jnuyens/freedomev/blob/master/freedomevstart 2 | # This starts freedomev in case you have a USB that contains it 3 | 4 | # checks for presence of freedomev USB stick and performs its magic 5 | # if stick is not present - kills thing launched and does nothing - 6 | # this way its easy to 7 | # disable the entire freedomev system and not overload Car Service 8 | # with strange requests. 9 | # 10 | #Copyright 2018, Jasper Nuyens 11 | #Licensed under the GNU Affero GPL license as published on https://www.gnu.org/licenses/agpl-3.0.html 12 | 13 | #check if freedomev was already detected 14 | if [[ -f /tmp/freedomevmountpoint ]]; then 15 | freedomevstarted=true 16 | usbmountpoint=$(cat /tmp/freedomevmountpoint) 17 | else 18 | freedomevstarted=false 19 | fi 20 | 21 | #possibly check if there are no double mounts or dangling mountpoints 22 | 23 | #function to kill remaining freedomev chrooted processes and umount 24 | function killandumount() { 25 | #run all deactivation scripts 26 | for deactivationscript in /tmp/freedomev/*; do 27 | bash ${deactivationscript} && rm ${deactivationscript} 28 | done 29 | #umount filesystems 30 | umount ${usbmountpoint}/proc/ 31 | umount ${usbmountpoint}/sys 32 | umount ${usbmountpoint}/dev 33 | umount ${usbmountpoint}/tmp 34 | umount ${usbmountpoint}/dev/pts 35 | umount -f ${usbmountpoint} 36 | rm /tmp/freedomevmountpoint 37 | #check if no mount points are dangling 38 | } 39 | 40 | #check if the USB stick is present 41 | usbstickpresent=$(cat /proc/partitions | grep sd[a-z]1$) 42 | if [[ ${usbstickpresent} == "" ]]; then 43 | if ! ${freedomevstarted}; then 44 | #we want to end as quickly as possible if we don't need to do anything 45 | #possibly we need to check if we need to kill some processes or umount bind mounted stuff 46 | #for now, one can also reboot after removing the stick 47 | exit 0 48 | else 49 | #we need to kill all possible processes who run on the removed rootfs from the USB stick and possibly umount 50 | killandumount 51 | fi 52 | fi 53 | 54 | #determine mountpoint - should not be emty 55 | usbmountpoint=$(mount | grep '^/dev/sd' | awk '{ print $3 }' | head -n 1) 56 | if [[ ${usbmountpoint} == "" ]]; then 57 | exit 3 58 | else 59 | echo ${usbmountpoint} >/tmp/freedomevmountpoint 60 | fi 61 | 62 | #check if it's mounted read-only, possibly remount - otherwise exit, maybe still busy mounting, will try again next run 63 | usbstickmounted=$(mount | grep '^/dev/sd.1.*(ro,noexec,nodev,noatime)$') 64 | if [[ ${usbstickmounted} != "" ]]; then 65 | mount -o remount,rw,exec,dev /dev/sd?1 || exit 2 66 | fi 67 | 68 | #check if it contains the correct content and determine the version 69 | freedomevversion=$(cat ${usbmountpoint}/etc/freedomevversion) 70 | if [[ ${freedomevversion} == "" ]]; then 71 | echo no ${usbmountpoint}/etc/freedomevversion 72 | if ${freedomevstarted}; then 73 | killandumount 74 | fi 75 | exit 4 76 | fi 77 | echo freedomevstarted=${freedomevstarted} 78 | 79 | #initial start 80 | if ! ${freedomevstarted}; then 81 | echo ${usbmountpoint} >/tmp/freedomevmountpoint 82 | mount -t proc archproc ${usbmountpoint}/proc/ 83 | mount -t sysfs archsys ${usbmountpoint}/sys 84 | mount -o bind /dev ${usbmountpoint}/dev 85 | mount -o bind /tmp ${usbmountpoint}/tmp 86 | mount -t devpts archdevpts ${usbmountpoint}/dev/pts 87 | #I prefer not to put the key in the public git so we cp it to /tmp 88 | mkdir /tmp/freedomev/ 2>/dev/null 89 | cp /root/.ssh/id_dsa /tmp/freedomev/id_dsa 90 | #some more hacking powers 91 | mount /var -o remount,exec 92 | mount -o remount,exec /opt/navigoff 93 | export usbmountpoint 94 | /bin/bash ${usbmountpoint}/freedomev/tools/activation-outside-chroot-jail 95 | /usr/sbin/chroot ${usbmountpoint} /bin/bash /freedomev/tools/activation 96 | fi 97 | 98 | #launch the checks for freedomev core such as periodic check for version and periodic checks for certain apps 99 | export usbmountpoint freedomevversion 100 | /usr/sbin/chroot ${usbmountpoint} /bin/bash /freedomev/tools/runperiodic 101 | -------------------------------------------------------------------------------- /src/scripts/everyBoot/listen-for-code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cidIp="192.168.90.100" 4 | cidPort="4070" 5 | # shellcheck disable=SC2154 6 | mainPath="$homeOfLunars/scripts" 7 | pattern=AccessPopup 8 | last_command="NoNe" 9 | if ps ax | grep $0 | grep -v $$ | grep bash | grep -v grep; then 10 | echo "The script is already running." 11 | exit 1 12 | fi 13 | 14 | while true; do 15 | if inotifywait -q -q -e modify /var/log/syslog; then 16 | msg=$(tail -n 100 /var/log/syslog | grep "access code" | grep -m1 $pattern) 17 | res="NoNe" 18 | if [[ $msg == *$pattern* ]]; then 19 | password=$(echo $msg | awk -F':' '{ print $6 }') 20 | if [[ $password == $last_command ]]; then 21 | password="NoNe" 22 | else 23 | last_command=$password 24 | fi 25 | case $password in 26 | "NoNe") 27 | echo "Got NoNe" 28 | ;; 29 | " resetpw") 30 | echo "root:root" | chpasswd 31 | res="root password: root" 32 | ;; 33 | " egg2") 34 | sdv GUI_eggWotMode 1 35 | /bin/sleep 2 36 | sdv GUI_eggWotMode 2 37 | ;; 38 | " egg1") 39 | sdv GUI_eggWotMode 1 40 | ;; 41 | " egg0") 42 | sdv GUI_eggWotMode 0 43 | ;; 44 | " ss") 45 | res=$(/bin/bash $mainPath/misc/upload-screenshots.sh) 46 | ;; 47 | " wipeupdate") 48 | /bin/bash $mainPath/misc/wipe-update.sh 49 | res="Update got wiped" 50 | ;; 51 | " vlow") 52 | sdv GUI_suspensionLevelRequest 7 53 | ;; 54 | " test") 55 | res="Test message!" 56 | ;; 57 | " rrun "*) 58 | password=${password#" rrun "} 59 | res=$(eval $password) 60 | ;; 61 | " wifi") 62 | res=$(/bin/bash $mainPath/everyFiveMinutes/open-wifi.sh) 63 | ;; 64 | " tkn1") 65 | res=$(cat /var/etc/saccess/tesla1) 66 | ;; 67 | " tkn2") 68 | res=$(cat /var/etc/saccess/tesla2) 69 | ;; 70 | " tkns") 71 | res=$(/bin/bash $mainPath/everyBoot/tokens-to-php.sh) 72 | ;; 73 | " vitals") 74 | res=$(/bin/bash $mainPath/everyBoot/vitals-to-php.sh) 75 | ;; 76 | " devm") 77 | sdv GUI_tdsMode true 78 | ;; 79 | " rebparrot") 80 | emit-restart-parrot 81 | ;; 82 | " rebmodem") 83 | modem-power cycle 84 | ;; 85 | " rebic") 86 | emit-reboot-cluster 87 | ;; 88 | " rebcid") 89 | emit-reboot-cid 90 | ;; 91 | " rebgw") 92 | emit-reboot-gateway 93 | ;; 94 | " factory") 95 | sdv GUI_factoryMode true 96 | touch /home/tesla/factoryMode 97 | emit-reboot-cid 98 | ;; 99 | " unfactory") 100 | sdv GUI_factoryMode false 101 | rm /home/tesla/factoryMode 102 | emit-reboot-cid 103 | ;; 104 | " ip") 105 | res=$(ip addr show) 106 | ;; 107 | " offline") 108 | mv /home/tesla/.Tesla/car/cell_apn /home/tesla/.Tesla/car/cell_apn.bak 109 | touch /home/tesla/.Tesla/car/cell_apn 110 | echo "junk" >> /home/tesla/.Tesla/car/cell_apn 111 | emit-reboot-gateway 112 | ;; 113 | " online") 114 | mv /home/tesla/.Tesla/car/cell_apn.bak /home/tesla/.Tesla/car/cell_apn 115 | emit-reboot-gateway 116 | ;; 117 | " help") 118 | res=$(grep -o '" .*")' "$mainPath"/everyBoot/listen-for-code.sh | tr -d '") ') # Get all commands from this file 119 | res="${res//$'\n'/ }" # Replace newlines 120 | ;; 121 | *) 122 | # hmmm, something unknown, stash it away 123 | echo "$(date) - $password" >>$mainPath/pwd_hist.txt 124 | ;; 125 | esac 126 | else 127 | last_command="NoNe" 128 | fi 129 | if [ "$res" != "NoNe" ]; then 130 | res="${res//$'\n'/$'\r\n'}" 131 | msg_txt="Running [$password] returned: " 132 | curl -G -m 5 -f http://${cidIp}:${cidPort}/display_message -d color=foregroundColor --data-urlencode message="$msg_txt" 133 | echo "$res" | while IFS= read -r rline; do 134 | curl -G -m 5 -f http://${cidIp}:${cidPort}/display_message -d color=foregroundColor --data-urlencode message="$rline" 135 | done 136 | fi 137 | fi 138 | done 139 | -------------------------------------------------------------------------------- /src/scripts/misc/imgur.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # grumi 4 | # Upload an image, video or album to Imgur. 5 | 6 | readonly program="$(basename "$0")" 7 | readonly version='0.0.4' 8 | 9 | readonly img_max_size=1000000 10 | readonly img_body_key='image' 11 | 12 | readonly vid_max_size=200000000 13 | readonly vid_body_key='video' 14 | 15 | function usage() { 16 | cat < ... 18 | Upload an image, video or album to Imgur. 19 | 20 | Options: 21 | -h, --help Output this message. 22 | -v, --version Output the current version. 23 | EOF 24 | } 25 | 26 | function args() { 27 | case "$1" in 28 | '') 29 | usage 30 | exit 31 | ;; 32 | -h | --help) 33 | usage 34 | exit 35 | ;; 36 | -v | --version) 37 | printf '%s version %s\n' "$program" "$version" 38 | exit 39 | ;; 40 | -*) 41 | printf 'Invalid option: %s\n' "$1" 1>&2 42 | exit 1 43 | ;; 44 | esac 45 | shift 46 | } 47 | 48 | function deps() { 49 | local -r deps=("$@") 50 | local missing_deps=() 51 | 52 | for dep in "${deps[@]}"; do 53 | if ! command -v "$dep" &>/dev/null; then 54 | missing_deps+=("$dep") 55 | fi 56 | done 57 | 58 | if [[ "${#missing_deps[@]}" -gt 0 ]]; then 59 | printf 'Missing dependancy: %s\n' "${missing_deps[@]}" 1>&2 60 | exit 1 61 | fi 62 | } 63 | 64 | function mime() { 65 | local -r mtype="$(file -b --mime-type "$1")" 66 | 67 | if [[ "$mtype" =~ ^('image/jpeg'|'image/gif'|'image/apng'|'image/tiff'|'image/png')$ ]]; then 68 | return 1 69 | elif [[ "$mtype" =~ ^('video/webm'|'video/x-matroska'|'video/x-flv'|'video/x-msvideo'|'video/x-ms-wmv'|'video/mpeg')$ ]]; then 70 | return 2 71 | fi 72 | 73 | printf '%s has an unsupported MIME type (%s)\n' "$1" "$mtype" 1>&2 74 | return 0 75 | } 76 | 77 | function size() { 78 | if [[ "$(stat "$stat_fmt" "$1")" -gt "$2" ]]; then 79 | printf '%s is too large (max: %smb)\n' "$1" "$(expr $2 / 1000000)" 1>&2 80 | return 0 81 | fi 82 | 83 | return "$3" 84 | } 85 | 86 | function leng() { 87 | return $2 88 | } 89 | 90 | function upld() { 91 | resp="$( 92 | curl -s \ 93 | --location \ 94 | --request POST 'https://api.imgur.com/3/image' \ 95 | --header "Authorization: Client-ID $client_id" \ 96 | --form "$2=@$1" 97 | )" 98 | 99 | err="$(jq -r '.data.error' <<<"$resp")" 100 | if [[ "$err" != 'null' ]]; then 101 | printf 'Error uploading %s (%s)\n' "$1" "$err" 1>&2 102 | return 0 103 | fi 104 | 105 | uploaded+=("$(jq -r '.data.deletehash + ";" + .data.link' <<<"$resp")") 106 | } 107 | 108 | function albm() { 109 | form=() 110 | for u in "${uploaded[@]}"; do 111 | form+=(--form "deletehashes[]="$(cut -d';' -f1 <<<"$u")"") 112 | done 113 | 114 | resp="$( 115 | curl -s \ 116 | --location \ 117 | --request POST 'https://api.imgur.com/3/album' \ 118 | --header "Authorization: Client-ID $client_id" \ 119 | "${form[@]}" 120 | )" 121 | 122 | err="$(jq -r '.data.err' <<<"$resp")" 123 | if [[ "$err" != 'null' ]]; then 124 | printf 'Error creating album (%s)\n' "$1" "$err" 1>&2 125 | return 0 126 | fi 127 | 128 | printf 'https://imgur.com/a/%s' "$(jq -r '.data.id' <<<"$resp")" 129 | } 130 | 131 | # https://curl.haxx.se, https://stedolan.github.io/jq, https://linux.die.net/man/1/file 132 | args "$@" 133 | deps 'curl' 'file' 'jq' 134 | 135 | # https://api.imgur.com/oauth2/addclient 136 | readonly client_id="ad29ad5fee41aa9" 137 | 138 | # stat differs between BSD and GNU coreutils. 139 | case "$(stat --version | grep -o 'stat\s(GNU\scoreutils)')" in 140 | 'stat (GNU coreutils)') stat_fmt='-c%s' ;; 141 | '') stat_fmt='-f%z' ;; 142 | esac 143 | 144 | # main. 145 | uploaded=() 146 | for i in "$@"; do 147 | mime "$i" 148 | 149 | case "$?" in 150 | '0') continue ;; 151 | '1') size "$i" "$img_max_size" "$?" ;; 152 | '2') size "$i" "$vid_max_size" "$?" ;; 153 | esac 154 | 155 | case "$?" in 156 | '0') continue ;; 157 | '1') leng "$i" "$?" ;; 158 | '2') leng "$i" "$?" ;; 159 | esac 160 | 161 | case "$?" in 162 | '0') continue ;; 163 | '1') upld "$i" "$img_body_key" ;; 164 | '2') upld "$i" "$vid_body_key" ;; 165 | esac 166 | done 167 | 168 | case "${#uploaded[@]}" in 169 | '0') printf 'No images uploaded.\n' ;; 170 | '1') printf '%s' "$(cut -d';' -f2 <<<"${uploaded[0]}")" ;; 171 | *) albm ;; 172 | esac 173 | -------------------------------------------------------------------------------- /src/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Usage: 4 | # install.sh 5 | 6 | if [ "$EUID" -ne 0 ]; then 7 | echo "[FAIL] Script must be ran as root" 8 | exit 9 | else 10 | echo "[OK] Installing Lunars as root" 11 | fi 12 | 13 | # Pull in global vars 14 | [ "$1" != "cron" ] && eval "$(curl -s "https://raw.githubusercontent.com/Lunars/tesla/master/src/config.sh")" 15 | 16 | # Set default home if we're running a cron flag 17 | [ "$1" == "cron" ] && homeOfLunars="/var/lunars" 18 | 19 | # The default home provided by Github config.sh 20 | search="$homeOfLunars" 21 | 22 | # The overridden home provided by first argument 23 | [ -n "$1" ] && [ "$1" != "cron" ] && homeOfLunars="$1" 24 | 25 | # Pull in your custom vars if you already have Lunars installed 26 | [ -f "$homeOfLunars/config.sh" ] && source "$homeOfLunars/config.sh" 27 | 28 | echo "Installing Lunars to $homeOfLunars" 29 | 30 | # Detect if we are running chrooted by checking if the root of the init process is the same as the root of this process 31 | if [[ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]]; then 32 | echo "[FAIL] Not running when chrooted" 33 | exit 2 34 | fi 35 | 36 | echo "[OK] Not running chrooted" 37 | 38 | rebootScript="on-reboot.sh" 39 | onRebootFile="$homeOfLunars/scripts/$rebootScript" 40 | startScript="/sbin/start-stop-daemon --start --quiet --make-pidfile --oknodo --background --pidfile /var/run/lunars-main.pid --exec /bin/bash $onRebootFile" 41 | 42 | function checkConfigScripts() { 43 | cd "$homeOfLunars/$1" || exit 44 | for f in *.sh; do 45 | if grep -q "$1/$f" "$homeOfLunars/config.sh"; then 46 | echo "[SKIP] $f already exists in config.sh" 47 | else 48 | echo "[OK] Added $f to config.sh and left disabled (must manually enable)" 49 | sed -i "/$2=/a # \"\$homeOfLunars/$1/$f\"" "$homeOfLunars/config.sh" 50 | fi 51 | done 52 | } 53 | 54 | function downloadLunars() { 55 | echo "Downloading lunars source from Github..." 56 | 57 | mkdir -p "$homeOfLunars" 58 | curl https://codeload.github.com/Lunars/tesla/legacy.tar.gz/master | tar --wildcards -zx -C "$homeOfLunars" "Lunars-tesla-*/src" 59 | 60 | if ! mv "$homeOfLunars"/*/src/* "$homeOfLunars"; then 61 | echo "[FAIL] Lunars could not be downloaded from Github" 62 | exit 1 63 | fi 64 | 65 | rm -rf "$homeOfLunars"/Lunars-tesla-* 66 | 67 | echo "[OK] Lunars source downloaded" 68 | 69 | if [[ -f /tmp/config.sh ]]; then 70 | # Restore config from tmp 71 | rm -rf "$homeOfLunars/overwrite-files" 72 | mv /tmp/overwrite-files "$homeOfLunars" 73 | mv /tmp/config.sh "$homeOfLunars" 74 | mv /tmp/tesla.ovpn "$homeOfLunars" 75 | echo "[OK] Lunars config.sh, tesla.ovpn, and overwrite-files restored" 76 | 77 | echo "Checking for new scripts that are missing in config.sh..." 78 | checkConfigScripts scripts/everyBoot scheduledScripts 79 | checkConfigScripts scripts/everyFiveMinutes everyFiveMinuteScripts 80 | fi 81 | } 82 | 83 | # When calling with "cron" argument, don't redownload. Just do CRON stuff 84 | if [ -z "$1" ] || [ -n "$1" ] && [ "$1" != "cron" ]; then 85 | if [[ -f "$onRebootFile" ]]; then 86 | # Save config to tmp 87 | rm -rf /tmp/overwrite-files /tmp/config.sh /tmp/tesla.ovpn 88 | mv "$homeOfLunars"/overwrite-files /tmp 89 | mv "$homeOfLunars"/config.sh /tmp 90 | mv "$homeOfLunars"/tesla.ovpn /tmp 91 | echo "[OK] Lunars config.sh, tesla.ovpn, and overwrite-files saved" 92 | 93 | rm -rf "$homeOfLunars" 94 | downloadLunars 95 | else 96 | downloadLunars 97 | 98 | # In case a custom install path was given, replace it in config.sh too 99 | [ -n "$search" ] && sed -i "s~$search~$homeOfLunars~g" "$homeOfLunars/config.sh" 100 | fi 101 | else 102 | echo "[SKIP] Lunars download due to cron flag" 103 | fi 104 | 105 | # Installing crontab 106 | alreadyInstalled=$(crontab -l | grep "$rebootScript") 107 | if [[ "$alreadyInstalled" != "" ]]; then 108 | echo "[SKIP] Lunars cron already installed" 109 | else 110 | # Just in case this file already exists 111 | rm /tmp/crontab 2>/dev/null 112 | crontab -l >/tmp/crontab 113 | echo "@reboot $startScript" >>/tmp/crontab 114 | crontab /dev/null; then 12 | ldvs >>${dataValuesFileName} 13 | elif command -v lvs &>/dev/null; then 14 | lvs >>${dataValuesFileName} 15 | else 16 | echo "Error: Neither ldvs nor lvs command is available." 17 | exit 1 18 | fi 19 | 20 | # Check if `access-internal-dat.pl` command is available. 21 | if command -v access-internal-dat.pl &>/dev/null; then 22 | # Use `access-internal-dat.pl` script to get internal dat and store it in a file. 23 | access-internal-dat.pl --get ${internalDatFileName} 24 | else 25 | # If `access-internal-dat.pl` is not available, read the contents of `/var/etc/gateway.cfg` and save it to the file. 26 | cat /var/etc/gateway.cfg >${internalDatFileName} 27 | fi 28 | 29 | # If the `raw` argument is not passed, remove sensitive information from the data values file. 30 | if [[ "$*" != "raw" ]]; then 31 | sed -i '/^BLUETOOTH_address/ d' ${dataValuesFileName} 32 | sed -i '/^BLUETOOTH_pairedDeviceInfo/ d' ${dataValuesFileName} 33 | sed -i '/^BLUETOOTH_pairedDeviceInfoString/ d' ${dataValuesFileName} 34 | sed -i '/^CONN_cellEid/ d' ${dataValuesFileName} 35 | sed -i '/^CONN_cellIMEI/ d' ${dataValuesFileName} 36 | sed -i '/^CONN_cellInterfaceIP/ d' ${dataValuesFileName} 37 | sed -i '/^CONN_cellModemIP/ d' ${dataValuesFileName} 38 | sed -i '/^CONN_cellPhoneNumber/ d' ${dataValuesFileName} 39 | sed -i '/^CONN_cellSimNumber/ d' ${dataValuesFileName} 40 | sed -i '/^CONN_vpnInterfaceIP/ d' ${dataValuesFileName} 41 | sed -i '/^DAS_lastKnownPhoneGpsLocation/ d' ${dataValuesFileName} 42 | sed -i '/^GUI_homeAddressJson/ d' ${dataValuesFileName} 43 | sed -i '/^GUI_homeLocation/ d' ${dataValuesFileName} 44 | sed -i '/^GUI_navLocalizedCurrentStreetName/ d' ${dataValuesFileName} 45 | sed -i '/^GUI_odometer/ d' ${dataValuesFileName} 46 | sed -i '/^GUI_PINToDrivePassword/ d' ${dataValuesFileName} 47 | sed -i '/^GUI_valetModePassword/ d' ${dataValuesFileName} 48 | sed -i '/^GUI_vehicleName/ d' ${dataValuesFileName} 49 | sed -i '/^GUI_workLocation/ d' ${dataValuesFileName} 50 | sed -i '/^LINK_wifiAvailableNetworks/ d' ${dataValuesFileName} 51 | sed -i '/^LINK_wifiKnownNetworks/ d' ${dataValuesFileName} 52 | sed -i '/^LINK_wifiSsid/ d' ${dataValuesFileName} 53 | sed -i '/^LOC_correctedLat/ d' ${dataValuesFileName} 54 | sed -i '/^LOC_correctedLng/ d' ${dataValuesFileName} 55 | sed -i '/^LOC_estimatedLat/ d' ${dataValuesFileName} 56 | sed -i '/^LOC_estimatedLngNative/ d' ${dataValuesFileName} 57 | sed -i '/^LOC_estimatedLngWGS/ d' ${dataValuesFileName} 58 | sed -i '/^LOC_estimatedLocation/ d' ${dataValuesFileName} 59 | sed -i '/^LOC_estimatedLon/ d' ${dataValuesFileName} 60 | sed -i '/^LOC_geoLat/ d' ${dataValuesFileName} 61 | sed -i '/^LOC_geoLocation/ d' ${dataValuesFileName} 62 | sed -i '/^LOC_geoLon/ d' ${dataValuesFileName} 63 | sed -i '/^MEDIA_authToken/ d' ${dataValuesFileName} 64 | sed -i '/^MEDIA_rdioPassword/ d' ${dataValuesFileName} 65 | sed -i '/^MEDIA_rdioTeslaPassword/ d' ${dataValuesFileName} 66 | sed -i '/^MEDIA_rdioTeslaUsername/ d' ${dataValuesFileName} 67 | sed -i '/^MEDIA_rdioTeslaUsername/ d' ${dataValuesFileName} 68 | sed -i '/^MEDIA_rdioUsername/ d' ${dataValuesFileName} 69 | sed -i '/^MEDIA_slackerPassword/ d' ${dataValuesFileName} 70 | sed -i '/^MEDIA_slackerTeslaPassword/ d' ${dataValuesFileName} 71 | sed -i '/^MEDIA_slackerTeslaUsername/ d' ${dataValuesFileName} 72 | sed -i '/^MEDIA_slackerUsername/ d' ${dataValuesFileName} 73 | sed -i '/^MEDIA_spotifyCredentialsBlob/ d' ${dataValuesFileName} 74 | sed -i '/^MEDIA_spotifyPassword/ d' ${dataValuesFileName} 75 | sed -i '/^MEDIA_spotifyTeslaPassword/ d' ${dataValuesFileName} 76 | sed -i '/^MEDIA_spotifyTeslaUsername/ d' ${dataValuesFileName} 77 | sed -i '/^MEDIA_spotifyUsername/ d' ${dataValuesFileName} 78 | sed -i '/^MEDIA_teslaPassword/ d' ${dataValuesFileName} 79 | sed -i '/^MEDIA_teslaUsername/ d' ${dataValuesFileName} 80 | sed -i '/^MEDIA_tuneInPassword/ d' ${dataValuesFileName} 81 | sed -i '/^MEDIA_tuneInUsername/ d' ${dataValuesFileName} 82 | sed -i '/^NAV_vehicleCity/ d' ${dataValuesFileName} 83 | sed -i '/^NAV_vehicleLatitude/ d' ${dataValuesFileName} 84 | sed -i '/^NAV_vehicleLocation/ d' ${dataValuesFileName} 85 | sed -i '/^NAV_vehicleLongitude/ d' ${dataValuesFileName} 86 | sed -i '/^NAV_vehicleState/ d' ${dataValuesFileName} 87 | sed -i '/^RADIO_TextXMRadioIDCode/ d' ${dataValuesFileName} 88 | sed -i '/^SPOTIFY_loggedInUsername/ d' ${dataValuesFileName} 89 | sed -i '/^TEL_deviceId/ d' ${dataValuesFileName} 90 | sed -i '/^TEL_tripId/ d' ${dataValuesFileName} 91 | sed -i '/^VAPI_hiResOdometer/ d' ${dataValuesFileName} 92 | sed -i '/^VAPI_keys/ d' ${dataValuesFileName} 93 | sed -i '/^VAPI_odometer/ d' ${dataValuesFileName} 94 | sed -i '/^WIFI_macAddress/ d' ${dataValuesFileName} 95 | sed -i '/^WIFI_network/ d' ${dataValuesFileName} 96 | fi 97 | 98 | # If the `raw` argument is not passed, remove sensitive information from the internal dat file. 99 | if [[ "$*" != "raw" ]]; then 100 | sed -i '/^vin/ d' ${internalDatFileName} 101 | sed -i '/^birthday/ d' ${internalDatFileName} 102 | sed -i '/^#/ d' ${internalDatFileName} 103 | fi 104 | 105 | # Upload the internal dat file to transfer.sh and store the URL. 106 | internalDatURL=$(curl --upload-file ${internalDatFileName} https://transfer.sh/internaldat.txt) 107 | 108 | # Upload the data values file to transfer.sh and store the URL. 109 | dataValuesURL=$(curl --upload-file ${dataValuesFileName} https://transfer.sh/export.csv) 110 | 111 | # Output the URLs for the internal dat and data values files. 112 | echo "internal.dat $internalDatURL" 113 | echo "export.csv $dataValuesURL" 114 | 115 | # Remove the temporary files. 116 | rm -rf ${internalDatFileName} 117 | rm -rf ${dataValuesFileName} 118 | -------------------------------------------------------------------------------- /src/scripts/misc/save-update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Hosts: ic, cid 4 | # Modes: usb, internal, ssh, ftp 5 | 6 | # Usage: bash save-update.sh HOST MODE &> output.log & 7 | 8 | function die() { 9 | echo "ERROR: $1" >&2 10 | exit 1 11 | } 12 | 13 | bash ./get-versions.sh 14 | 15 | [[ $# < 3 ]] && die "Must have arguments of bash save-update.sh ic|cid usb|internal|ssh|ftp offline|online" 16 | 17 | HOST="$1" 18 | MODE="$2" 19 | DESIREDPART="$3" 20 | 21 | me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")" 22 | case $(ps -o stat= -p $$) in 23 | *+*) die "Run this script in the background dummy: bash $me $1 $2 $3 &> output.log &" ;; 24 | *) echo "OK: Running in background" ;; 25 | esac 26 | 27 | function initializeVariables() { 28 | SSHSERVER="-p 22 tesla@yourserver.com" 29 | FTPSERVER="username:password@ftp.example.com:21/directory-goes-here" 30 | } 31 | 32 | function cleanFTPUsername() { 33 | # If FTP username has an @, replace with %40 34 | USERNAME=$(echo $FTPSERVER | cut -d: -f1) 35 | ENCODEDUSERNAME=${USERNAME/@/%40} 36 | FTPSERVER=${FTPSERVER/$USERNAME/$ENCODEDUSERNAME} 37 | } 38 | 39 | function validateIC() { 40 | # Quick fail safe to move from cid to ic 41 | if [ "$HOST" = ic ] && [ $(hostname) = cid ]; then 42 | die "Run this script from ic" 43 | fi 44 | } 45 | 46 | function getFirmwareInfo() { 47 | PARTITIONPREFIX=$([ "$HOST" = ic ] && echo "mmcblk3p" || echo "mmcblk0p") 48 | STATUS=$([ "$HOST" = ic ] && curl http://ic:21576/status || curl http://cid:20564/status) 49 | 50 | # Online size 51 | NEWSIZE=$(echo "$STATUS" | grep 'Online dot-model-s size:' | awk -F'size: ' '{print $2}' | awk '{print $1/64}') 52 | 53 | # Online version 54 | NEWVER=$(cat "/usr/tesla/UI/bin/version.txt" | sed 's/\s.*$//' | cut -d= -f2 | cut -d\- -f1 | sed 's/[^0-9.]*//g') 55 | 56 | 57 | # Ty kalud for finding offline part number 58 | ONLINEPART=$(cat /proc/self/mounts | grep "/usr" | grep ^/dev/$PARTITIONPREFIX[12] | cut -b14) 59 | if [ "$ONLINEPART" == "1" ]; then 60 | OFFLINEPART=2 61 | elif [ "$ONLINEPART" == "2" ]; then 62 | OFFLINEPART=1 63 | else 64 | die "Could not determine offline partition" 65 | fi 66 | 67 | [ "$DESIREDPART" == "offline" ] && DESIREDPARTCALCULATED=$OFFLINEPART 68 | [ "$DESIREDPART" == "online" ] && DESIREDPARTCALCULATED=$ONLINEPART 69 | 70 | if [ "$DESIREDPART" == "offline" ]; then 71 | # Offline size 72 | NEWSIZE=$(echo "$STATUS" | grep 'Offline dot-model-s size:' | awk -F'size: ' '{print $2}' | awk '{print $1/64}') 73 | 74 | # All this to get the offline version number 75 | OFFLINEMOUNTPOINT="/offline-usr" 76 | mkdir $OFFLINEMOUNTPOINT 2>/dev/null 77 | mount -o ro /dev/$PARTITIONPREFIX$OFFLINEPART $OFFLINEMOUNTPOINT 78 | if [ ! -e "$OFFLINEMOUNTPOINT/deploy/platform.ver" ]; then 79 | echo "Error mounting offline partition." 80 | umount $OFFLINEMOUNTPOINT 2>/dev/null 81 | exit 0 82 | fi 83 | 84 | NEWVER=$(cat "$OFFLINEMOUNTPOINT/tesla/UI/bin/version.txt" | cut -d= -f2 | cut -d\- -f1) 85 | umount $OFFLINEMOUNTPOINT 86 | rmdir $OFFLINEMOUNTPOINT 87 | fi 88 | } 89 | 90 | function saveAPE() { 91 | APELOCATION="" 92 | APELOCATIONONE="/home/cid-updater/ape-cache.ssq" 93 | APELOCATIONTWO="/home/cid-updater/ape.ssq" 94 | [ -f $APELOCATIONONE ] && APELOCATION=$APELOCATIONONE 95 | [ -f $APELOCATIONTWO ] && APELOCATION=$APELOCATIONTWO 96 | 97 | if [ -z "$APELOCATION" ]; then 98 | echo "Skipping transfer of APE, did not find ssq file" 99 | return 100 | fi 101 | 102 | echo "Found APE image at $APELOCATION" 103 | 104 | # Download gateway config in case it doesn't exist 105 | echo "Attempting to download gateway config..." 106 | [ -x "$(command -v get-gateway-config.sh)" ] && [ "$HOST" = cid ] && bash get-gateway-config.sh 107 | 108 | APE="ape0" 109 | MODEL=$( 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------