CyberSnek

Pwnagotchi Build Guide

Apr 20th, 2022 (edited)
3,866
3
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 20.71 KB | None | 3 0
  1. *** Pwnagotchi Build Guide ***
  2. # Description:
  3. # My collective notes for building my pwnagotchi
  4. #
  5. # Last Updated: April 2022
  6.  
  7. *** Hardware: ***
  8.    * Raspberry Pi 4b
  9.    * Waveshare 3.7 e-ink display
  10.    * PiSugar 3 Plus 5000 mAh UPS
  11.    * Panda Wireless PAUN09 Wifi Adapter
  12.    * DIYmall VK-172 USB GPS Dongle (U-blox 7)
  13.    * Samsung EVO Micro SDXC 256GB (UHD, UHS-I, U3, A2, V30)
  14.  
  15. *** Kudos and Special Thanks: ***
  16. # Reddit User "u/panoptyk", for their "Guerrilla guide to Pwnagotchi [v1.5.5/2022]:
  17. #   Link: https://www.reddit.com/r/pwnagotchi/comments/sl2rv1/guerrilla_guide_to_pwnagotchi_v1552022/?utm_source=share&utm_medium=web2x&context=3
  18. #
  19. # Junohea (Wark#8463) on the "Pwnagotchi Unofficial" Discord, for their guidance on configuring an external wifi adapter.
  20. #
  21. # Reddit User "u/Capt_Panic" on Reddit and Discord, for their contributions to this guide.
  22. #   Link: https://www.reddit.com/r/pwnagotchi/comments/ubnlde/comment/i6gg8sj/?utm_source=share&utm_medium=web2x&context=3
  23. #
  24. # The Pwnagotchi Reddit Community:
  25. #   Link: https://www.reddit.com/r/pwnagotchi/
  26. #
  27. # The "Pwnagotchi Unofficial" Discord Community:
  28. #   Link: https://discord.gg/8fV5Ka32
  29. #
  30. # GaelicThunder on GitHub, for their Exp Plugin:
  31. #   Link: https://github.com/GaelicThunder/Experience-Plugin-Pwnagotchi
  32. #
  33. # Hanna.Diamond on GitHub, for their Age Plugin and Waveshare 3.7" e-ink display Plugin:
  34. #   Link: https://github.com/hannadiamond/pwnagotchi-plugins
  35.  
  36. *** Build Instructions Below: ***
  37.  
  38. Step 1) Download Pwnagotchi image from pwnagotchi.ai
  39.  #      Note: version 1.5.5 is the latest version as of April 2022
  40.  #            Many have recommended instead to flash version 1.5.3
  41.  #            in order to avoid reported bugs regarding AI mode not starting.
  42.  #            once installed, version 1.5.3 will automatically update to 1.5.5
  43.  #            with an established internet connection (host connection sharing or bt-tether)
  44.  Download version 1.5.3 to avoid having to fix AI Mode.
  45.      # Remediation guidance for v1.5.5 AI Mode bug is available from u/panoptyk on Reddit. See Link in Kudos section above.
  46.  
  47. Step 2) Flash pwnagotchi image to microSD.
  48.  #      Note: Recommended to use "balenaEtcher" to flash the image.
  49.  #            Several tutorials exist online (Google or YouTube) that
  50.  #            provide instructions for flashing an image to a microSD.
  51.  
  52. Step 3) Build your initial config.toml
  53.  #      Note: your initial config.toml will contain the baseline configuration
  54.  #            for your pwnagotchi, such as the name of the device. It is recommended to avoid
  55.  #            trying to configure all of your plugins at this stage, and only focus on the
  56.  #            essential plugins, such as 'bt-tether'.
  57.  
  58. ######## start of config.toml ########
  59.  
  60. #Main settings
  61. main.name = "pwnagotchi"
  62. main.lang = "en"
  63. main.custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/"
  64. main.whitelist = [
  65.   "Other...",
  66. ]
  67.  
  68. #Reporting results to PwnGRID
  69. main.plugins.grid.enabled = true
  70. main.plugins.grid.report = true
  71. main.plugins.grid.exclude = [
  72.   "Other..."
  73. ]
  74.  
  75. #Display configuration
  76. ui.display.enabled = false #set to false for now
  77. ui.display.type = "waveshare37inch" #"waveshare37inch" doesn't exist (yet). To be created later...
  78. ui.display.color = "black"
  79.  
  80. #Reduce Writes to preserve SD Lifespan
  81. fs.memory.enabled = true
  82. fs.memory.mounts.log.enabled = true
  83. fs.memory.mounts.data.enabled = true
  84.  
  85. #bt-tether settings
  86. main.plugins.bt-tether.enabled = true
  87. main.plugins.bt-tether.devices.ios-phone.enabled = true
  88. main.plugins.bt-tether.devices.ios-phone.search_order = 1
  89. main.plugins.bt-tether.devices.ios-phone.mac = "CH:AN:GE:XX:MM:EE" #mobile Bluetooth MAC
  90. main.plugins.bt-tether.devices.ios-phone.ip = "172.20.10.6" #custom static IP for iPhone PAN
  91. main.plugins.bt-tether.devices.ios-phone.netmask = 24
  92. main.plugins.bt-tether.devices.ios-phone.interval = 1
  93. main.plugins.bt-tether.devices.ios-phone.scantime = 10
  94. main.plugins.bt-tether.devices.ios-phone.max_tries = 10
  95. main.plugins.bt-tether.devices.ios-phone.share_internet = true
  96. main.plugins.bt-tether.devices.ios-phone.priority = 1
  97.  
  98. ######## end of config.toml ########
  99.  
  100. Step 4) Copy config.toml to MicroSD (boot)
  101.  #       Note: Insert the microSD card flashed in Step 3.
  102.  Open the new drive titled "boot", and copy over your config.toml
  103.  
  104. Step 5) Boot pwnagotchi for the first time, connected via USB (will boot into MANU Mode).
  105.  #       WARNING: BE PATIENT. The First boot will take longer than average due to key generation.
  106.  #       NOTE: If you specified settings for bt-tether plugin, ensure your mobile device is
  107.  #             nearby and listening for new bluetooth devices to pair.
  108.  #             Ensure Internet sharing via Personal Hotspot is enabled.
  109.  Your mobile device will be prompted to pair with your pwnagotchi.
  110.  
  111. Step 6) Configure host Internet sharing (macOS)
  112.  # This guide will cover host internet sharing for macOS only. Windows host internet sharing is available from u/panoptyk on Reddit. See Link in Kudos section above.
  113.  # ETH0 Instructions for Internet access via onboard ethernet port can be found via the following link, thanks to u/Capt_Panic on Reddit: https://reddit.com/r/pwnagotchi/comments/ucig3u/configuring_pi_3_b_for_pnwagotchi_for_nic/
  114.  ** On pwnagotchi: **
  115.   ssh pi@10.0.0.2
  116.      # type "yes" if prompted to accept the ssh key for this not-yet known host.
  117.      # default password: "raspberry" (to be changed later)
  118.      # Note: If you receive "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!":
  119.            # This is due to a previous ssh entry conflicting with your pwnagtochi's IP/hostname.
  120.            sudo nano /Users/{user}/.ssh/known_hosts
  121.            # comment-out or delete lines resembling your raspberry pi IP or hostname
  122.  
  123.   sudo nano /etc/resolv.conf
  124.        # modify "nameserver 127.0.0.1" to be "nameserver 1.1.1.1"
  125.  
  126.   sudo nano /etc/network/interfaces.d/usb0-cfg
  127.        # add "dns-nameservers 1.1.1.1" under the gateway line"
  128.  
  129.   sudo nano /etc/dnsmasq.conf
  130.        # add "server=1.1.1.1@usb0"
  131.  
  132.   sudo systemctl disable dnsmasq
  133.  
  134.   sudo chattr +i /etc/resolv.conf
  135.       # make file immutable
  136.  
  137.  ** On host macOS system: **
  138.       # Manually configure network device (RNDIS/Ethernet Gadget) IPv4 to support
  139.       # default IP addressing.
  140.         "IPv4 Address: 10.0.0.1"
  141.         "Subnet Mask: 255.255.255.0"
  142.         "Router: 10.0.0.1"
  143.  
  144.   sudo ./macos_connection_share.sh
  145.       # Note: Internet sharing scripts obtained from pwnagotchi.ai.
  146.       #       More scripts are available for Windows and Linux OS at pwnagotchi.ai
  147.       #
  148.       # The Raspberry Pi 4b comes equiped with a Ethernet Port, allowing most users the ability to directly connect
  149.       # their pwnagotchi to their home router, or to their computer via the CAT 5 port. This is a far simpler method
  150.       # of obtaining internet access than the instructions I provide below. However, if you are like me, the method below
  151.       # provides you the ability to quickly connect your rpi to your comptuer on-the-go via a USB C cable.
  152.       #
  153.       # Troubleshooting:
  154.         Unable to ping 1.1.1.1 from pwnagotchi with macOS host sharing:
  155.         # "sudo pfctl -sn" may sometimes report the following:
  156.           # nat on en0 inet from 10.0.0.0/24 to any -> (en0) round-robin
  157.           # Fix via: "sudo echo "nat on en0 from en6:network to any -> en0" | sudo pfctl -f -"
  158.           # The above cmd sets proper nat direction (rather than round-robin DNS).
  159.  
  160. Step 7) Install waveshare 3.7 e-ink display
  161.  cd ~
  162.  sudo mkdir /usr/local/share/pwnagotchi/custom-plugins/
  163.       #make custom-plugins directory defined in config.toml, if not done so already.
  164.      
  165.  sudo mkdir /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/libs/waveshare/v37inch
  166.  
  167.  sudo git clone https://github.com/hannadiamond/pwnagotchi-plugins.git
  168.  
  169.  cd ./pwnagotchi-plugins/waveshare_37inch/
  170.  
  171.  sudo cp -r /home/pi/pwnagotchi-plugins/waveshare_37inch/v37inch/. /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/libs/waveshare/v37inch
  172.  
  173.  sudo cp waveshare37inch.py /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw
  174.  
  175.  sudo nano /etc/pwnagotchi/config.toml
  176.       #set: ui.display.enabled = true
  177.       #set: ui.display.type = "waveshare37inch"
  178.  
  179.  sudo nano /usr/local/lib/python3.7/dist-packages/pwnagotchi/utils.py
  180.  #Locate "def load_config" and add the following:
  181.  elif config['ui']['display']['type'] in ('ws_37inch', 'ws37inch', 'waveshare_37inch', 'waveshare37inch'):
  182.     config['ui']['display']['type'] = 'waveshare37inch'
  183.  
  184.  sudo nano /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/display.py
  185.  #Add the following:
  186.  def is_waveshare37inch(self):
  187.    return self.implementation.name == 'waveshare37inch'
  188.  
  189.  sudo nano /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/components.py
  190.  #Locate "class LabeledValue" and REPLACE "def draw" with:
  191.      def draw(self, canvas, drawer):
  192.         if self.label is None:
  193.             drawer.text(self.xy, self.value, font=self.label_font, fill=self.color)
  194.         else:
  195.             pos = self.xy
  196.             drawer.text(pos, self.label, font=self.label_font, fill=self.color)
  197.             drawer.text((pos[0] + self.label_spacing + self.label_font.getsize(self.label)[0], pos[1]), self.value, font=self.text_font, fill=self.color)
  198.  
  199.  sudo nano /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/__init__.py
  200.  #Add the following:
  201.  from pwnagotchi.ui.hw.waveshare37inch import Waveshare37inch
  202.  #Also, add the following into the elif block of the code:
  203.  elif config['ui']['display']['type'] == 'waveshare37inch':
  204.     return Waveshare37inch(config)
  205.    
  206.  sudo systemctl restart pwnagotchi.service #to initialize new waveshare 3.7 display.
  207.     # Troubleshooting: If the screen does not come on:
  208.     # Just SSH into your pwnagotchi via USB and check your work from the beginning of step 7.
  209.     # I typically add the waveshare37 code snippets right between the sections for "waveshare27" and
  210.     # "waveshare29" in their respective sections within each script being modified.
  211.  
  212. Step 8) Install & Configure Wireless adapter
  213.  lsusb #ensure wifi adapter is plugged in and detected
  214.  iw dev #ensure wlan1 is observed with mon0 under phy#1
  215.  sudo nano /boot/config.txt
  216.    # Find the following line:
  217.      # Additional overlays and parameters are documented /boot/overlays/README
  218.    # Add the following line under it:
  219.      dtoverlay=disable-wifi #disables the onboard wifi, allowing our adapter to operate as wlan0
  220.  
  221.  sudo nano /usr/bin/pwnlib
  222.  #locate and replace the contents of "start_monitor_interface with the following:
  223.    #rename adapter and bring up as mon0 in monitor mode
  224.    ip link set wlan0 down
  225.    ip link set wlan0 name mon0
  226.    iw dev mon0 set type monitor
  227.    ip link set mon0 up
  228.    #add a mon1 interface from the same adapter
  229.    iw phy "$(iw phy | head -1 | cut -d" " -f2)" interface add mon1 type monitor
  230.    
  231.  sudo nano /etc/systemd/system/pwngrid-peer.service
  232.   # update the service launch param. Replace "mon0" with "mon1"
  233.   # Everything else continues to use mon0, bettercap accepts it and works fine. Pwngrid works fine on the mon1 interface.
  234.  
  235.  sudo reboot #allow all changes to take affect.
  236.  
  237. Step 9) Install custom plugins
  238.  #Consider this step OPTIONAL, unless you would like these custom plugins. Otherwise, proceed to Step 10.
  239.  cd ~
  240.  sudo mkdir /usr/local/share/pwnagotchi/custom-plugins/
  241.       #make custom-plugins directory defined in config.toml, if not done so already.
  242.  
  243.  Step 9.1) aircrackonly plugin
  244.   sudo pwnagotchi plugins install aircrackonly
  245.   sudo nano /etc/pwnagotchi/config.toml
  246.        # add the following lines to config.toml:
  247.          main.plugins.aircrackonly.enabled = true
  248.          main.plugins.aircrackonly.face = "(>.<)"
  249.        
  250.  Step 9.2) Exp plugin #Generates an "experiance" level and progress bar for your pwnagotchi.
  251.   #Copy exp.py from git: https://github.com/GaelicThunder/Experience-Plugin-Pwnagotchi
  252.   sudo nano /usr/local/share/pwnagotchi/custom-plugins/exp.py #paste contents of exp.py from github to exp.py on your pwnagotchi.
  253.   sudo nano /etc/pwnagotchi/config.toml
  254.   #add the following to your config.toml. Please note that the positions have been adjusted to accomodate the waveshare 3.7 display.
  255.     main.plugins.exp.enabled = true
  256.     main.plugins.exp.lvl_x_coord = 0
  257.     main.plugins.exp.lvl_y_coord = 210
  258.     main.plugins.exp.exp_x_coord = 0
  259.     main.plugins.exp.exp_y_coord = 228
  260.  
  261.  Step 9.3) Age plugin #Generates the pwnagotchi's "age" and "strength".
  262.   #Copy exp.py from git: https://github.com/hannadiamond/pwnagotchi-plugins/blob/main/plugins/age.py
  263.   sudo nano /usr/local/share/pwnagotchi/custom-plugins/age.py #paste contents of exp.py from github to exp.py on your pwnagotchi.
  264.   sudo nano /etc/pwnagotchi/config.toml
  265.   #add the following to your config.toml. Please note that the positions have been adjusted to accomodate the waveshare 3.7 display.
  266.     main.plugins.age.enabled = true
  267.     main.plugins.age.age_x_coord = 0
  268.     main.plugins.age.age_y_coord = 56
  269.     main.plugins.age.str_x_coord = 125
  270.     main.plugins.age.str_y_coord = 56
  271.    
  272.  Step 9.4) GPS plugin #Uses the Ublox-7 USB GPS dongle to capture the GPS coordinates for a collected handshake.
  273.     #NOTE: Many people believe the GPS plugin should always communicate the current GPS coordinates. This is not true. the GPS coordinates will only update on the display when a handshake has been obtained.
  274.     #Troubleshooting: If the GPS dongle does not appear to be functioning, it is likely that the device is unable to capture a location (or has yet to capture a handshake. Try changing your physical location (i.e. go outside, walk around the house, down the street, etc).
  275.   lsusb #confirm the gps dongle is detected as plugged in.
  276.   sudo pwnagotchi plugins install gps
  277.   sudo nano /etc/pwnagotchi/config.toml
  278.   #add the following to your config.toml. Please note that the positions have been adjusted to accomodate the waveshare 3.7 display.
  279.     main.plugins.gps.enabled = true
  280.     main.plugins.gps.speed = 19200
  281.     main.plugins.gps.device = "/dev/ttyACM0" #gps dongle location
  282.     main.plugins.gps.position = "225,194" #adjusted to support waveshare 3.7
  283.     main.plugins.gps.linespacing = 18 #adjusted to support waveshare 3.7
  284.    
  285.  Step 9.5) PiSugar Plugin
  286.   #Ensure PiSugar Power Manager is installed:
  287.   curl http://cdn.pisugar.com/release/Pisugar-power-manager.sh | sudo bash
  288.   cd /usr/local/share/pwnagotchi/custom-plugins/
  289.   sudo nano pisugar2.py
  290.   #locate and modify the following contents of 'def on_ui_setup':
  291.         def on_ui_setup(self, ui):
  292.         ui.add_element(
  293.             "bat",
  294.             LabeledValue(
  295.                 color=BLACK,
  296.                 label="BAT",
  297.                 value="0%",
  298.                 position=(ui.width() / 2 + 30, 0),
  299.                 label_font=fonts.Bold,
  300.                 text_font=fonts.Medium,
  301.             ),
  302.         )
  303.  
  304.  Step 9.6) memtemp Plugin
  305.   sudo pwnagotchi plugins install memtemp
  306.   sudo nano /etc/pwnagotchi/config.toml
  307.   #add the following to your config.toml. Please note that the positions have been adjusted to accomodate the waveshare 3.7 display.
  308.     main.plugins.memtemp.enabled = true
  309.     main.plugins.memtemp.scale = "celsius"
  310.     main.plugins.memtemp.orientation = "vertical" #adjusted for preference on waveshare 3.7
  311.     main.plugins.memtemp.position = "382,194" #adjusted to support waveshare 3.7
  312.     main.plugins.memtemp.linespacing = 18 #adjusted to support waveshare 3.7
  313.    
  314.  Step 9.7) customize bt-tether display position #to accomodate waveshare 3.7
  315.   cd /usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default
  316.   sudo nano bt-tether.py
  317.   #locate and modify the following under 'def pn_ui_setup':
  318.     def on_ui_setup(self, ui):
  319.         with ui._lock:
  320.             ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 28$
  321.                            label_font=fonts.Bold, text_font=fonts.Medium))
  322.    
  323.   sudo systemctl restart pwnagotchi.service #reload pwnagotchi with new plugins
  324.  
  325. Step 10) Update everything. #OPTIONAL. I'm just obsessive about updating everything...
  326.  sudo pwnagotchi plugins update
  327.  sudo pwnagotchi plugins upgrade
  328.  sudo apt-get update --allow-releaseinfo-change
  329.       #Troubleshooting: Some repos for "re4son-kernel.com/re4son kali-pi" might present an error resembling the following: "The following signatures were invalid: EXPKEYSIG 11764EE8AC24832F Carsten Boeving <carsten.boeving@whitedome.com.au>"
  330.       wget -O - https://re4son-kernel.com/keys/http/archive-key.asc | sudo apt-key add -
  331.  
  332.  sudo apt-get upgrade #This will take a while (~45 minutes). Be patient.
  333.       #Troubleshooting: You might encounter an error that looks similar to:
  334.       # Errors were encountered while processing:
  335.       #  /var/cache/apt/archives/kalipi-kernel_5.4.83-20211204_armhf.deb
  336.       # E: Sub-process /usr/bin/dpkg returned an error code (1)
  337.          sudo mv /boot/overlays/ overlaysbackup #rename the existing overlays in /boot/. The renamed overlays can be safely deleted later
  338.          sudo apt-get upgrade #attempt upgrade again.
  339.  
  340.  
  341. Step 11) Change all the default passwords
  342.  # Change "pi" password. Default "raspberry"
  343.  psswd
  344.  
  345.  # Change "root" password:
  346.  sudo su
  347.  psswd
  348.  
  349.  # Change pwnagotchi Web UI password. Default "changeme"
  350.  sudo nano /etc/pwnagotchi/config.toml
  351.   # locate and update the values for:
  352.     ui.web.username = "changeme"
  353.     ui.web.password = "changeme"
  354.  
  355.  # Update bettercap password. Default "pwnagotchi"
  356.  sudo nano /etc/pwnagotchi/config.toml
  357.   # locate and update the values for:
  358.     bettercap.username = "pwnagotchi"
  359.     bettercap.password = "pwnagotchi"
  360.   sudo nano /usr/local/share/bettercap/caplets/pwnagotchi-auto.cap
  361.     #modify the bettercap username & password to match config.toml
  362.   sudo nano /usr/local/share/bettercap/caplets/pwnagotchi-manual.cap
  363.     #modify the bettercap username & password to match config.toml
  364.  
  365.  sudo systemctl restart pwnagotchi.service #reload pwnagotchi for config changes to apply.
  366.    
  367. Step 12) Back up all your hard work!
  368.  Download the Backup script from Github.
  369.  # Link: https://github.com/evilsocket/pwnagotchi/blob/master/scripts/backup.sh
  370.  
  371.  Append the "FILES_TO_BACKUP" section of the backup script to include the following additional files that have been added or modified as a result of this guide:
  372.  
  373.   /usr/bin/pwnlib \
  374.   /etc/systemd/system/pwngrid-peer.service \
  375.   /usr/local/share/pwnagotchi/custom-plugins/ \
  376.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/libs/waveshare/v37inch/ \
  377.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/waveshare37inch.py \
  378.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/utils.py \
  379.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/display.py \
  380.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/components.py \
  381.   /usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/hw/__init__.py
  382.  
  383.      # Note: The last entry in the list must include an end quotation mark. Be sure to relocate this to the end of the list before saving.
  384.  
  385.   sudo chmod +x backup.sh # make backup.sh executable
  386.   sudo ./backup.sh
  387.  
  388. #### Enjoy your new Pwnagotchi, and please support the Pwnagotchi community on Reddit and Discord! ####
  389.  
  390. Step 13) [OPTIONAL] Accessing your handshakes
  391. #### Additional Optional step, curtosy of /u/Capt_Panic on Reddit and Discord ####
  392.     #Reference: https://www.reddit.com/r/pwnagotchi/comments/ubnlde/comment/i6gg8sj/?utm_source=share&utm_medium=web2x&context=3
  393.    
  394. #create file to access handshakes
  395.  sudo nano cph.sh
  396.  #insert these lines into the file
  397.     \#/bin/bash
  398.  
  399.  cp -r /root/handshakes/\* /home/pi/handshakes/
  400.  
  401.  chown pi:pi /home/pi/handshakes
  402.  
  403.  chown pi:pi /home/pi/handshakes/\*
  404.  sudo chmod +x cph.sh
  405.     #To run file, execute 'sudo cph.sh'. This will copy your handshakes into the /home/pi/handshakes directory
  406.  
  407. Step 14) [OPTIONAL] May be required if you are having troubles with bluetooth
  408. #### Additional Optional step, curtosy of /u/Capt_Panic on Reddit and Discord ####
  409.     #Reference: https://www.reddit.com/r/pwnagotchi/comments/ubnlde/comment/i6gg8sj/?utm_source=share&utm_medium=web2x&context=3
  410.  
  411.  # We need to add something into our profile which is in our root directory, hidden.
  412.  sudo su
  413.  cd /root
  414.  sudo nano ~/.profile
  415.  #add the following at the bottom of the file.
  416.  \# attempt to restart bluetooth
  417.  
  418.  sudo systemctl restart bluetooth
  419.  #save using crtl + x and then hit enter.
  420.  #Comment out an if-else-statement.
  421.  sudo nano /usr/bin/btuart
  422.  #At the first if-else-statement you see, comment it out like you you see below.
  423.  \#if grep -q "raspberrypi,4" /proc/device-tree/compatible; then
  424.  
  425.  BDADDR=
  426.  
  427.  \#else
  428.  
  429.  SERIAL='cat /proc/device-tree/serial-number | cut -c9-'
  430.  
  431.  B1='echo $SERIAL | cut -c3-4'
  432.  
  433.  B2='echo $SERIAL | cut -c5-6'
  434.  
  435.  B3='echo $SERIAL | cut -c7-8'
  436.  
  437.  BDADDR='printf b8:27:eb:%02x:%02x:%02x $((0x$B1 \^ 0xaa)) $((0x$B2 \^ 0xaa)) $((0x$B3 \^ 0xaa))'
  438.  
  439.  \#fi
  440.  #save it using crtl + x and then hit enter.
  441.  sudo reboot
Add Comment
Please, Sign In to add comment