From 913b1a6e1dc32b15add1e07ae3683ab03249444a Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 12:55:12 +0100 Subject: [PATCH 01/30] Update 2.7 inch display --- pwnagotchi/ui/hw/waveshare2in7_V2.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pwnagotchi/ui/hw/waveshare2in7_V2.py b/pwnagotchi/ui/hw/waveshare2in7_V2.py index 42272fb6..e8d4cfcd 100644 --- a/pwnagotchi/ui/hw/waveshare2in7_V2.py +++ b/pwnagotchi/ui/hw/waveshare2in7_V2.py @@ -35,13 +35,11 @@ class Waveshare27inchV2(DisplayImpl): from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD self._display = EPD() self._display.init() - # this must have changed by waveshare - # remove the 0xFF(Clear(0xFF)) other wise it errors. can't pass oxff and self self._display.Clear() def render(self, canvas): buf = self._display.getbuffer(canvas) - self._display.display_Partial(buf, 0, 0, 176, 264) + self._display.display_Fast(buf) def clear(self): # This line also removes the 0xFF From 8531b8977169bb661b5056cee1997fc7a75aefb3 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 13:02:33 +0100 Subject: [PATCH 02/30] Add ui.invert = false to defaults --- pwnagotchi/defaults.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pwnagotchi/defaults.toml b/pwnagotchi/defaults.toml index ddfcc9e0..de52db73 100644 --- a/pwnagotchi/defaults.toml +++ b/pwnagotchi/defaults.toml @@ -154,6 +154,8 @@ personality.throttle_d = 0.9 personality.clear_on_exit = true # clear display when shutting down cleanly +ui.invert = false # false = black background, true = white background + ui.fps = 0.0 ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic ui.font.size_offset = 0 # will be added to the font size From d29aca15a99b2fbe591bab1adcaa69b4adc2ea58 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:24:17 +0100 Subject: [PATCH 03/30] Add ui.invert = false to defaults --- pwnagotchi/defaults.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/defaults.toml b/pwnagotchi/defaults.toml index de52db73..5fdc276e 100644 --- a/pwnagotchi/defaults.toml +++ b/pwnagotchi/defaults.toml @@ -32,7 +32,7 @@ main.plugins.bt-tether.devices.android-phone.netmask = 24 main.plugins.bt-tether.devices.android-phone.interval = 1 main.plugins.bt-tether.devices.android-phone.scantime = 10 main.plugins.bt-tether.devices.android-phone.max_tries = 10 -main.plugins.bt-tether.devices.android-phone.share_internet = false +main.plugins.bt-tether.devices.android-phone.share_internet = true main.plugins.bt-tether.devices.android-phone.priority = 1 main.plugins.bt-tether.devices.ios-phone.enabled = false @@ -43,7 +43,7 @@ main.plugins.bt-tether.devices.ios-phone.netmask = 24 main.plugins.bt-tether.devices.ios-phone.interval = 5 main.plugins.bt-tether.devices.ios-phone.scantime = 20 main.plugins.bt-tether.devices.ios-phone.max_tries = 0 -main.plugins.bt-tether.devices.ios-phone.share_internet = false +main.plugins.bt-tether.devices.ios-phone.share_internet = true main.plugins.bt-tether.devices.ios-phone.priority = 999 main.plugins.fix_services.enabled = true From a34db250b5d1711ad55bcc1bca6000aadb5e82d2 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:24:45 +0100 Subject: [PATCH 04/30] Add a interactive configuration installer --- bin/pwnagotchi | 69 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 65aea2f2..015e8619 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -133,6 +133,8 @@ if __name__ == '__main__': help="Print the configuration.") # Jayofelony added these + parser.add_argument('--install', dest="install", action="store_true", default=False, + help="Interactive installation of your personal configuration.") parser.add_argument('--check-update', dest="check_update", action="store_true", default=False, help="Check for updates on Pwnagotchi. And tells current version.") parser.add_argument('--donate', dest="donate", action="store_true", default=False, @@ -157,6 +159,71 @@ if __name__ == '__main__': print(pwnagotchi.__version__) sys.exit(0) + if args.install: + pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [y/n]") + if pwn_check.lower() in ('y', 'yes'): + pwn_restore = input("Do you want to restore the previous configuration? [y/n]") + if pwn_restore in ('y', 'yes'): + os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi.config.toml") + else: + os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") + with open("/etc/pwnagotchi/config.toml", "a+") as f: + # Set pwnagotchi name + print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n" + "My name is Jayofelony, how may I call you? ") + pwn_name = input("Pwnagotchi name (no spaces):") + if pwn_name == "": + pwn_name = "Pwnagotchi" + print("I shall go by Pwnagotchi from now on!") + pwn_name = ("# Do not edit this file if you do not know what you are doing!!!\n\n" + "main.name = \"") + pwn_name + "\"\n" + f.write(pwn_name) + else: + print("I shall go by %s from now on!", pwn_name) + pwn_name = "main.name = " + pwn_name + "\"\n" + f.write(pwn_name) + pwn_whitelist = input("How many networks do you want to whitelist? " + "We will also ask a MAC for each network?\n" + "Each SSID and BSSID count as 1 network. \n\n" + "Be sure to use digits as your answer.") + if int(pwn_whitelist) > 0: + f.write("main.whitelist = [\n") + for x in range(int(pwn_whitelist)): + ssid = input("SSID (Name):") + bssid = input("BSSID (MAC):") + f.write("\t\"" + ssid + "\"\n") + f.write("\t\"" + bssid + "\"\n") + f.write("]\n") + # set bluetooth tether + pwn_bluetooth = input("Do you want to enable BT-Tether? [y/n]") + if pwn_bluetooth.lower() in ('y', 'yes'): + f.write("main.plugins.bt-tether.enabled = true\n\n") + pwn_bluetooth_device = input("What device do you use? Android or iOS?") + if pwn_bluetooth_device.lower() == "android": + f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") + pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") + if pwn_bluetooth_mac is not "": + f.write("main.plugins.bt-tether.devices.android-phone.mac = \""+pwn_bluetooth_mac+"\"\n") + elif pwn_bluetooth_device.lower() == "ios": + f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") + pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") + if pwn_bluetooth_mac is not "": + f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") + # set up display settings + pwn_display_enabled = input("Do you use a display? [y/n]") + if pwn_display_enabled.lower() in ('y,', 'yes'): + f.write("ui.display.enabled = true\n") + pwn_display_type = input("What display do you use?\n\n" + "Be sure to check for the correct display type @ \n" + "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431") + if pwn_display_type is not "": + f.write("ui.display.type = \""+pwn_display_type+"\"\n") + f.close() + print("Your configuration is done, and I will restart in 5 seconds.") + time.sleep(5) + os.system("service pwnagotchi restart") + sys.exit(0) + if args.donate: print("Donations can made @ \n " "https://www.patreon.com/pwnagotchi_torch \n " @@ -172,7 +239,7 @@ if __name__ == '__main__': local = version_to_tuple(pwnagotchi.__version__) remote = version_to_tuple(latest_ver) if remote > local: - user_input = input("There is a new version available! Update from v%s to v%s?\n[y(es)/n(o)]" + user_input = input("There is a new version available! Update from v%s to v%s?\n[y/n]" % (pwnagotchi.__version__, latest_ver)) # input validation if user_input.lower() in ('y', 'yes'): From ea60808700b778b544fdab3f4fd327607ccd05db Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:26:48 +0100 Subject: [PATCH 05/30] Add a interactive configuration installer --- bin/pwnagotchi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 015e8619..715b72d9 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -202,12 +202,12 @@ if __name__ == '__main__': if pwn_bluetooth_device.lower() == "android": f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") - if pwn_bluetooth_mac is not "": + if pwn_bluetooth_mac != "": f.write("main.plugins.bt-tether.devices.android-phone.mac = \""+pwn_bluetooth_mac+"\"\n") elif pwn_bluetooth_device.lower() == "ios": f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") - if pwn_bluetooth_mac is not "": + if pwn_bluetooth_mac != "": f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") # set up display settings pwn_display_enabled = input("Do you use a display? [y/n]") @@ -216,7 +216,7 @@ if __name__ == '__main__': pwn_display_type = input("What display do you use?\n\n" "Be sure to check for the correct display type @ \n" "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431") - if pwn_display_type is not "": + if pwn_display_type != "": f.write("ui.display.type = \""+pwn_display_type+"\"\n") f.close() print("Your configuration is done, and I will restart in 5 seconds.") From e5e0180f3cd09055b8b6905ea6960a896df4b2a7 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:32:08 +0100 Subject: [PATCH 06/30] Add a interactive configuration installer --- bin/pwnagotchi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 715b72d9..ebd88e31 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -164,7 +164,7 @@ if __name__ == '__main__': if pwn_check.lower() in ('y', 'yes'): pwn_restore = input("Do you want to restore the previous configuration? [y/n]") if pwn_restore in ('y', 'yes'): - os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi.config.toml") + os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") else: os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") with open("/etc/pwnagotchi/config.toml", "a+") as f: From 501ec9ca2b6f3794d5c6bda5d0e3342ca436ed60 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:34:39 +0100 Subject: [PATCH 07/30] Add a interactive configuration installer --- bin/pwnagotchi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index ebd88e31..2195959a 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -160,12 +160,12 @@ if __name__ == '__main__': sys.exit(0) if args.install: - pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [y/n]") - if pwn_check.lower() in ('y', 'yes'): - pwn_restore = input("Do you want to restore the previous configuration? [y/n]") - if pwn_restore in ('y', 'yes'): - os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") - else: + pwn_restore = input("Do you want to restore the previous configuration? [y/n]") + if pwn_restore in ('y', 'yes'): + os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") + else: + pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [y/n]") + if pwn_check.lower() in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") with open("/etc/pwnagotchi/config.toml", "a+") as f: # Set pwnagotchi name @@ -222,6 +222,8 @@ if __name__ == '__main__': print("Your configuration is done, and I will restart in 5 seconds.") time.sleep(5) os.system("service pwnagotchi restart") + else: + print("Ok, doing nothing.") sys.exit(0) if args.donate: From bc92613700ab294309fa6c81d5acc01f431c3b7b Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:36:17 +0100 Subject: [PATCH 08/30] Add a interactive configuration installer --- bin/pwnagotchi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 2195959a..5c860629 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -163,6 +163,9 @@ if __name__ == '__main__': pwn_restore = input("Do you want to restore the previous configuration? [y/n]") if pwn_restore in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") + print("Your previous configuration is restored, and I will restart in 5 seconds.") + time.sleep(5) + os.system("service pwnagotchi restart") else: pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [y/n]") if pwn_check.lower() in ('y', 'yes'): From 5f907b236a9952fb308ef7d241e2ff0ce025ba8a Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:39:24 +0100 Subject: [PATCH 09/30] Add a interactive configuration installer --- bin/pwnagotchi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 5c860629..e9d46b32 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -171,6 +171,7 @@ if __name__ == '__main__': if pwn_check.lower() in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") with open("/etc/pwnagotchi/config.toml", "a+") as f: + f.write("# Do not edit this file if you do not know what you are doing!!!\n\n") # Set pwnagotchi name print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n" "My name is Jayofelony, how may I call you? ") @@ -178,8 +179,7 @@ if __name__ == '__main__': if pwn_name == "": pwn_name = "Pwnagotchi" print("I shall go by Pwnagotchi from now on!") - pwn_name = ("# Do not edit this file if you do not know what you are doing!!!\n\n" - "main.name = \"") + pwn_name + "\"\n" + pwn_name = "main.name = \"" + pwn_name + "\"\n" f.write(pwn_name) else: print("I shall go by %s from now on!", pwn_name) From f7a599ab8f75be855471872d0b564895c3c829f6 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:42:36 +0100 Subject: [PATCH 10/30] Add a interactive configuration installer --- bin/pwnagotchi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index e9d46b32..f858f038 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -183,7 +183,7 @@ if __name__ == '__main__': f.write(pwn_name) else: print("I shall go by %s from now on!", pwn_name) - pwn_name = "main.name = " + pwn_name + "\"\n" + pwn_name = "main.name = \"" + pwn_name + "\"\n" f.write(pwn_name) pwn_whitelist = input("How many networks do you want to whitelist? " "We will also ask a MAC for each network?\n" From 5be8580a5998f46f06d806c49e50ef2f9c96b9fd Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:46:23 +0100 Subject: [PATCH 11/30] Add a interactive configuration installer --- bin/pwnagotchi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index f858f038..ef3c5fdd 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -194,8 +194,8 @@ if __name__ == '__main__': for x in range(int(pwn_whitelist)): ssid = input("SSID (Name):") bssid = input("BSSID (MAC):") - f.write("\t\"" + ssid + "\"\n") - f.write("\t\"" + bssid + "\"\n") + f.write("\t\"" + ssid + "\",\n") + f.write("\t\"" + bssid + "\",\n") f.write("]\n") # set bluetooth tether pwn_bluetooth = input("Do you want to enable BT-Tether? [y/n]") From 14e4fc6d479356c25321b0de822b783c72ca9f4b Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:48:52 +0100 Subject: [PATCH 12/30] Add a interactive configuration installer --- bin/pwnagotchi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index ef3c5fdd..de6bf87e 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -214,7 +214,7 @@ if __name__ == '__main__': f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") # set up display settings pwn_display_enabled = input("Do you use a display? [y/n]") - if pwn_display_enabled.lower() in ('y,', 'yes'): + if pwn_display_enabled.lower() in ('y', 'yes'): f.write("ui.display.enabled = true\n") pwn_display_type = input("What display do you use?\n\n" "Be sure to check for the correct display type @ \n" From 77af772b4b921cbf92929712a2371b021649315e Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:53:18 +0100 Subject: [PATCH 13/30] remove color = black --- pwnagotchi/ui/hw/waveshare2in13.py | 59 +++++++++----------------- pwnagotchi/ui/hw/waveshare2in13_V2.py | 60 +++++++++------------------ 2 files changed, 38 insertions(+), 81 deletions(-) diff --git a/pwnagotchi/ui/hw/waveshare2in13.py b/pwnagotchi/ui/hw/waveshare2in13.py index de6c29b7..2cfedcfa 100644 --- a/pwnagotchi/ui/hw/waveshare2in13.py +++ b/pwnagotchi/ui/hw/waveshare2in13.py @@ -9,46 +9,25 @@ class WaveshareV1(DisplayImpl): super(WaveshareV1, self).__init__(config, 'waveshare_1') def layout(self): - if self.config['color'] == 'black': - fonts.setup(10, 9, 10, 35, 25, 9) - self._layout['width'] = 250 - self._layout['height'] = 122 - self._layout['face'] = (0, 40) - self._layout['name'] = (5, 20) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['uptime'] = (185, 0) - self._layout['line1'] = [0, 14, 250, 14] - self._layout['line2'] = [0, 108, 250, 108] - self._layout['friend_face'] = (0, 92) - self._layout['friend_name'] = (40, 94) - self._layout['shakes'] = (0, 109) - self._layout['mode'] = (225, 109) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 20 - } - else: - fonts.setup(10, 8, 10, 25, 25, 9) - self._layout['width'] = 212 - self._layout['height'] = 104 - self._layout['face'] = (0, 26) - self._layout['name'] = (5, 15) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['uptime'] = (147, 0) - self._layout['line1'] = [0, 12, 212, 12] - self._layout['line2'] = [0, 92, 212, 92] - self._layout['friend_face'] = (0, 76) - self._layout['friend_name'] = (40, 78) - self._layout['shakes'] = (0, 93) - self._layout['mode'] = (187, 93) - self._layout['status'] = { - 'pos': (91, 15), - 'font': fonts.status_font(fonts.Medium), - 'max': 20 - } + fonts.setup(10, 9, 10, 35, 25, 9) + self._layout['width'] = 250 + self._layout['height'] = 122 + self._layout['face'] = (0, 40) + self._layout['name'] = (5, 20) + self._layout['channel'] = (0, 0) + self._layout['aps'] = (28, 0) + self._layout['uptime'] = (185, 0) + self._layout['line1'] = [0, 14, 250, 14] + self._layout['line2'] = [0, 108, 250, 108] + self._layout['friend_face'] = (0, 92) + self._layout['friend_name'] = (40, 94) + self._layout['shakes'] = (0, 109) + self._layout['mode'] = (225, 109) + self._layout['status'] = { + 'pos': (125, 20), + 'font': fonts.status_font(fonts.Medium), + 'max': 20 + } return self._layout def initialize(self): diff --git a/pwnagotchi/ui/hw/waveshare2in13_V2.py b/pwnagotchi/ui/hw/waveshare2in13_V2.py index 76c48ad0..8c56b12a 100644 --- a/pwnagotchi/ui/hw/waveshare2in13_V2.py +++ b/pwnagotchi/ui/hw/waveshare2in13_V2.py @@ -9,47 +9,25 @@ class WaveshareV2(DisplayImpl): super(WaveshareV2, self).__init__(config, 'waveshare_2') def layout(self): - if self.config['color'] == 'black': - fonts.setup(10, 9, 10, 35, 25, 9) - self._layout['width'] = 250 - self._layout['height'] = 122 - self._layout['face'] = (0, 40) - self._layout['name'] = (5, 20) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['uptime'] = (185, 0) - self._layout['line1'] = [0, 14, 250, 14] - self._layout['line2'] = [0, 108, 250, 108] - self._layout['friend_face'] = (0, 92) - self._layout['friend_name'] = (40, 94) - self._layout['shakes'] = (0, 109) - self._layout['mode'] = (225, 109) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 20 - } - else: - fonts.setup(10, 8, 10, 25, 25, 9) - self._layout['width'] = 212 - self._layout['height'] = 104 - self._layout['face'] = (0, 26) - self._layout['name'] = (5, 15) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['status'] = (91, 15) - self._layout['uptime'] = (147, 0) - self._layout['line1'] = [0, 12, 212, 12] - self._layout['line2'] = [0, 92, 212, 92] - self._layout['friend_face'] = (0, 76) - self._layout['friend_name'] = (40, 78) - self._layout['shakes'] = (0, 93) - self._layout['mode'] = (187, 93) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 14 - } + fonts.setup(10, 9, 10, 35, 25, 9) + self._layout['width'] = 250 + self._layout['height'] = 122 + self._layout['face'] = (0, 40) + self._layout['name'] = (5, 20) + self._layout['channel'] = (0, 0) + self._layout['aps'] = (28, 0) + self._layout['uptime'] = (185, 0) + self._layout['line1'] = [0, 14, 250, 14] + self._layout['line2'] = [0, 108, 250, 108] + self._layout['friend_face'] = (0, 92) + self._layout['friend_name'] = (40, 94) + self._layout['shakes'] = (0, 109) + self._layout['mode'] = (225, 109) + self._layout['status'] = { + 'pos': (125, 20), + 'font': fonts.status_font(fonts.Medium), + 'max': 20 + } return self._layout def initialize(self): From 2149c5dbdfa8a900283ac611b6ad1e0af9d3c10c Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 15:55:50 +0100 Subject: [PATCH 14/30] remove color = black --- pwnagotchi/ui/hw/waveshare2in13.py | 38 ++++------------ pwnagotchi/ui/hw/waveshare2in13b_V3.py | 60 ++++++++------------------ pwnagotchi/ui/hw/waveshare2in13b_V4.py | 60 ++++++++------------------ 3 files changed, 46 insertions(+), 112 deletions(-) diff --git a/pwnagotchi/ui/hw/waveshare2in13.py b/pwnagotchi/ui/hw/waveshare2in13.py index 2cfedcfa..c142aa4a 100644 --- a/pwnagotchi/ui/hw/waveshare2in13.py +++ b/pwnagotchi/ui/hw/waveshare2in13.py @@ -31,38 +31,16 @@ class WaveshareV1(DisplayImpl): return self._layout def initialize(self): - if self.config['color'] == 'black': - logging.info("initializing waveshare v2in13_V1 display in monochromatic mode") - from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD - self._display = EPD() - self._display.init(self._display.lut_full_update) - self._display.Clear(0xFF) - self._display.init(self._display.lut_partial_update) - elif self.config['color'] == 'fastAndFurious': - logging.info("initializing waveshare v2in13_V1 3-color display in FAST MODE") - logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED") - logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK") - from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bcFAST import EPD - self._display = EPD() - self._display.init() - self._display.Clear() - else: - logging.info("initializing waveshare v2in13_V1 display 3-color mode") - from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bc import EPD - self._display = EPD() - self._display.init() - self._display.Clear() + logging.info("initializing waveshare v2in13_V1 display in monochromatic mode") + from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD + self._display = EPD() + self._display.init(self._display.lut_full_update) + self._display.Clear(0xFF) + self._display.init(self._display.lut_partial_update) def render(self, canvas): - if self.config['color'] == 'black': - buf = self._display.getbuffer(canvas) - self._display.display(buf) - elif self.config['color'] == 'fastAndFurious': - buf_black = self._display.getbuffer(canvas) - self._display.DisplayPartial(buf_black) - else: - buf_black = self._display.getbuffer(canvas) - self._display.displayBlack(buf_black) + buf = self._display.getbuffer(canvas) + self._display.display(buf) def clear(self): self._display.Clear(0xff) diff --git a/pwnagotchi/ui/hw/waveshare2in13b_V3.py b/pwnagotchi/ui/hw/waveshare2in13b_V3.py index 9c13436d..c5c96453 100644 --- a/pwnagotchi/ui/hw/waveshare2in13b_V3.py +++ b/pwnagotchi/ui/hw/waveshare2in13b_V3.py @@ -10,47 +10,25 @@ class Waveshare2in13bV3(DisplayImpl): super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3') def layout(self): - if self.config['color'] == 'black': - fonts.setup(10, 9, 10, 35, 25, 9) - self._layout['width'] = 250 - self._layout['height'] = 122 - self._layout['face'] = (0, 40) - self._layout['name'] = (5, 20) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['uptime'] = (185, 0) - self._layout['line1'] = [0, 14, 250, 14] - self._layout['line2'] = [0, 108, 250, 108] - self._layout['friend_face'] = (0, 92) - self._layout['friend_name'] = (40, 94) - self._layout['shakes'] = (0, 109) - self._layout['mode'] = (225, 109) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 20 - } - else: - fonts.setup(10, 8, 10, 25, 25, 9) - self._layout['width'] = 212 - self._layout['height'] = 104 - self._layout['face'] = (0, 26) - self._layout['name'] = (5, 15) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['status'] = (91, 15) - self._layout['uptime'] = (147, 0) - self._layout['line1'] = [0, 12, 212, 12] - self._layout['line2'] = [0, 92, 212, 92] - self._layout['friend_face'] = (0, 76) - self._layout['friend_name'] = (40, 78) - self._layout['shakes'] = (0, 93) - self._layout['mode'] = (187, 93) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 14 - } + fonts.setup(10, 9, 10, 35, 25, 9) + self._layout['width'] = 250 + self._layout['height'] = 122 + self._layout['face'] = (0, 40) + self._layout['name'] = (5, 20) + self._layout['channel'] = (0, 0) + self._layout['aps'] = (28, 0) + self._layout['uptime'] = (185, 0) + self._layout['line1'] = [0, 14, 250, 14] + self._layout['line2'] = [0, 108, 250, 108] + self._layout['friend_face'] = (0, 92) + self._layout['friend_name'] = (40, 94) + self._layout['shakes'] = (0, 109) + self._layout['mode'] = (225, 109) + self._layout['status'] = { + 'pos': (125, 20), + 'font': fonts.status_font(fonts.Medium), + 'max': 20 + } return self._layout def initialize(self): diff --git a/pwnagotchi/ui/hw/waveshare2in13b_V4.py b/pwnagotchi/ui/hw/waveshare2in13b_V4.py index 1b190d14..7cc5a543 100644 --- a/pwnagotchi/ui/hw/waveshare2in13b_V4.py +++ b/pwnagotchi/ui/hw/waveshare2in13b_V4.py @@ -10,47 +10,25 @@ class Waveshare213bV4(DisplayImpl): super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4') def layout(self): - if self.config['color'] == 'black': - fonts.setup(10, 9, 10, 35, 25, 9) - self._layout['width'] = 250 - self._layout['height'] = 122 - self._layout['face'] = (0, 40) - self._layout['name'] = (5, 20) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['uptime'] = (185, 0) - self._layout['line1'] = [0, 14, 250, 14] - self._layout['line2'] = [0, 108, 250, 108] - self._layout['friend_face'] = (0, 92) - self._layout['friend_name'] = (40, 94) - self._layout['shakes'] = (0, 109) - self._layout['mode'] = (225, 109) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 20 - } - else: - fonts.setup(10, 8, 10, 25, 25, 9) - self._layout['width'] = 212 - self._layout['height'] = 104 - self._layout['face'] = (0, 26) - self._layout['name'] = (5, 15) - self._layout['channel'] = (0, 0) - self._layout['aps'] = (28, 0) - self._layout['status'] = (91, 15) - self._layout['uptime'] = (147, 0) - self._layout['line1'] = [0, 12, 212, 12] - self._layout['line2'] = [0, 92, 212, 92] - self._layout['friend_face'] = (0, 76) - self._layout['friend_name'] = (40, 78) - self._layout['shakes'] = (0, 93) - self._layout['mode'] = (187, 93) - self._layout['status'] = { - 'pos': (125, 20), - 'font': fonts.status_font(fonts.Medium), - 'max': 14 - } + fonts.setup(10, 9, 10, 35, 25, 9) + self._layout['width'] = 250 + self._layout['height'] = 122 + self._layout['face'] = (0, 40) + self._layout['name'] = (5, 20) + self._layout['channel'] = (0, 0) + self._layout['aps'] = (28, 0) + self._layout['uptime'] = (185, 0) + self._layout['line1'] = [0, 14, 250, 14] + self._layout['line2'] = [0, 108, 250, 108] + self._layout['friend_face'] = (0, 92) + self._layout['friend_name'] = (40, 94) + self._layout['shakes'] = (0, 109) + self._layout['mode'] = (225, 109) + self._layout['status'] = { + 'pos': (125, 20), + 'font': fonts.status_font(fonts.Medium), + 'max': 20 + } return self._layout def initialize(self): From 6691257036e0dc34fe0b7f37b3a97cca8159d081 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 16:00:31 +0100 Subject: [PATCH 15/30] change small font size --- pwnagotchi/ui/hw/waveshare2in13.py | 2 +- pwnagotchi/ui/hw/waveshare2in13_V2.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/ui/hw/waveshare2in13.py b/pwnagotchi/ui/hw/waveshare2in13.py index c142aa4a..b720b555 100644 --- a/pwnagotchi/ui/hw/waveshare2in13.py +++ b/pwnagotchi/ui/hw/waveshare2in13.py @@ -9,7 +9,7 @@ class WaveshareV1(DisplayImpl): super(WaveshareV1, self).__init__(config, 'waveshare_1') def layout(self): - fonts.setup(10, 9, 10, 35, 25, 9) + fonts.setup(10, 8, 10, 35, 25, 9) self._layout['width'] = 250 self._layout['height'] = 122 self._layout['face'] = (0, 40) diff --git a/pwnagotchi/ui/hw/waveshare2in13_V2.py b/pwnagotchi/ui/hw/waveshare2in13_V2.py index 8c56b12a..48042746 100644 --- a/pwnagotchi/ui/hw/waveshare2in13_V2.py +++ b/pwnagotchi/ui/hw/waveshare2in13_V2.py @@ -9,7 +9,7 @@ class WaveshareV2(DisplayImpl): super(WaveshareV2, self).__init__(config, 'waveshare_2') def layout(self): - fonts.setup(10, 9, 10, 35, 25, 9) + fonts.setup(10, 8, 10, 35, 25, 9) self._layout['width'] = 250 self._layout['height'] = 122 self._layout['face'] = (0, 40) From 87eae76a58a74bf55888d5aa219c3c25bccc7a56 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 16:07:17 +0100 Subject: [PATCH 16/30] Add display invert to --install --- bin/pwnagotchi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index de6bf87e..24e547df 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -221,6 +221,11 @@ if __name__ == '__main__': "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431") if pwn_display_type != "": f.write("ui.display.type = \""+pwn_display_type+"\"\n") + pwn_display_invert = input("Do you want to invert the display colors? [y/n]\n\n" + "No = Black background\n" + "Yes = White background") + if pwn_display_invert in ('y', 'yes'): + f.write("ui.invert = true\n") f.close() print("Your configuration is done, and I will restart in 5 seconds.") time.sleep(5) From 1f9afd541d1cef97a9f7e7a3badc374ae3cbcc4a Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 19:59:48 +0100 Subject: [PATCH 17/30] Add display invert to --install --- bin/pwnagotchi | 6 +++--- .../64bit/etc/bash_completion.d/pwnagotchi_completion.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 24e547df..af82690c 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -137,7 +137,7 @@ if __name__ == '__main__': help="Interactive installation of your personal configuration.") parser.add_argument('--check-update', dest="check_update", action="store_true", default=False, help="Check for updates on Pwnagotchi. And tells current version.") - parser.add_argument('--donate', dest="donate", action="store_true", default=False, + parser.add_argument('--wizard', dest="wizard", action="store_true", default=False, help="How to donate to this project.") # pwnagotchi plugins --help @@ -159,8 +159,8 @@ if __name__ == '__main__': print(pwnagotchi.__version__) sys.exit(0) - if args.install: - pwn_restore = input("Do you want to restore the previous configuration? [y/n]") + if args.wizard: + pwn_restore = input("Do you want to restore the previous configuration? [y/n]\n") if pwn_restore in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") print("Your previous configuration is restored, and I will restart in 5 seconds.") diff --git a/builder/data/64bit/etc/bash_completion.d/pwnagotchi_completion.sh b/builder/data/64bit/etc/bash_completion.d/pwnagotchi_completion.sh index 8424a534..68edc4e9 100644 --- a/builder/data/64bit/etc/bash_completion.d/pwnagotchi_completion.sh +++ b/builder/data/64bit/etc/bash_completion.d/pwnagotchi_completion.sh @@ -2,7 +2,7 @@ _show_complete() { local cur opts node_names all_options opt_line all_options=" -pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --check-update --donate {plugins,google} +pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --wizard --check-update --donate {plugins,google} pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade} pwnagotchi plugins list -i --installed -h --help pwnagotchi plugins install -h --help From 54b7ce5d0d4234647665353d2c57e9950a38abed Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:08:45 +0100 Subject: [PATCH 18/30] Add display invert to --install --- bin/pwnagotchi | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index af82690c..dc4c6812 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -160,22 +160,22 @@ if __name__ == '__main__': sys.exit(0) if args.wizard: - pwn_restore = input("Do you want to restore the previous configuration? [y/n]\n") + pwn_restore = input("Do you want to restore the previous configuration? [Y/N]\n") if pwn_restore in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") print("Your previous configuration is restored, and I will restart in 5 seconds.") time.sleep(5) os.system("service pwnagotchi restart") else: - pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [y/n]") + pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [Y/N]\n") if pwn_check.lower() in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") with open("/etc/pwnagotchi/config.toml", "a+") as f: f.write("# Do not edit this file if you do not know what you are doing!!!\n\n") # Set pwnagotchi name print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n" - "My name is Jayofelony, how may I call you? ") - pwn_name = input("Pwnagotchi name (no spaces):") + "My name is Jayofelony, how may I call you?\n") + pwn_name = input("Pwnagotchi name (no spaces): ") if pwn_name == "": pwn_name = "Pwnagotchi" print("I shall go by Pwnagotchi from now on!") @@ -188,43 +188,43 @@ if __name__ == '__main__': pwn_whitelist = input("How many networks do you want to whitelist? " "We will also ask a MAC for each network?\n" "Each SSID and BSSID count as 1 network. \n\n" - "Be sure to use digits as your answer.") + "Be sure to use digits as your answer.\n\n Amount of networks: ") if int(pwn_whitelist) > 0: f.write("main.whitelist = [\n") for x in range(int(pwn_whitelist)): - ssid = input("SSID (Name):") - bssid = input("BSSID (MAC):") + ssid = input("SSID (Name): ") + bssid = input("BSSID (MAC): ") f.write("\t\"" + ssid + "\",\n") f.write("\t\"" + bssid + "\",\n") f.write("]\n") # set bluetooth tether - pwn_bluetooth = input("Do you want to enable BT-Tether? [y/n]") + pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N]") if pwn_bluetooth.lower() in ('y', 'yes'): f.write("main.plugins.bt-tether.enabled = true\n\n") - pwn_bluetooth_device = input("What device do you use? Android or iOS?") + pwn_bluetooth_device = input("What device do you use? Android or iOS? ") if pwn_bluetooth_device.lower() == "android": f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") - pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") + pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": f.write("main.plugins.bt-tether.devices.android-phone.mac = \""+pwn_bluetooth_mac+"\"\n") elif pwn_bluetooth_device.lower() == "ios": f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") - pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device?") + pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") # set up display settings - pwn_display_enabled = input("Do you use a display? [y/n]") + pwn_display_enabled = input("Do you use a display? [Y/N]\n") if pwn_display_enabled.lower() in ('y', 'yes'): f.write("ui.display.enabled = true\n") pwn_display_type = input("What display do you use?\n\n" "Be sure to check for the correct display type @ \n" - "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431") + "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n") if pwn_display_type != "": f.write("ui.display.type = \""+pwn_display_type+"\"\n") - pwn_display_invert = input("Do you want to invert the display colors? [y/n]\n\n" - "No = Black background\n" - "Yes = White background") - if pwn_display_invert in ('y', 'yes'): + pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n" + "N = Black background\n" + "Y = White background\n") + if pwn_display_invert.lower() in ('y', 'yes'): f.write("ui.invert = true\n") f.close() print("Your configuration is done, and I will restart in 5 seconds.") @@ -249,7 +249,7 @@ if __name__ == '__main__': local = version_to_tuple(pwnagotchi.__version__) remote = version_to_tuple(latest_ver) if remote > local: - user_input = input("There is a new version available! Update from v%s to v%s?\n[y/n]" + user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] " % (pwnagotchi.__version__, latest_ver)) # input validation if user_input.lower() in ('y', 'yes'): From 25cb1f2175749c670eb79277185593903da46d91 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:11:20 +0100 Subject: [PATCH 19/30] Add display invert to --install --- bin/pwnagotchi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index dc4c6812..3be7320e 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -162,12 +162,12 @@ if __name__ == '__main__': if args.wizard: pwn_restore = input("Do you want to restore the previous configuration? [Y/N]\n") if pwn_restore in ('y', 'yes'): - os.system("mv -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") + os.system("cp -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml") print("Your previous configuration is restored, and I will restart in 5 seconds.") time.sleep(5) os.system("service pwnagotchi restart") else: - pwn_check = input("This will create a new configuration file and backup your current one, are you sure? [Y/N]\n") + pwn_check = input("This will create a new configuration file and overwrite your current backup, are you sure? [Y/N]\n") if pwn_check.lower() in ('y', 'yes'): os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") with open("/etc/pwnagotchi/config.toml", "a+") as f: From 69e7503d67bf229d02dc7fd7b082460298ca8321 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:21:41 +0100 Subject: [PATCH 20/30] Add display invert to --install --- bin/pwnagotchi | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 3be7320e..6e9584f6 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -7,6 +7,7 @@ import sys import toml import requests import os +import re import pwnagotchi from pwnagotchi import utils @@ -160,6 +161,14 @@ if __name__ == '__main__': sys.exit(0) if args.wizard: + def is_valid_hostname(hostname): + if len(hostname) > 255: + return False + if hostname[-1] == ".": + hostname = hostname[:-1] # strip exactly one dot from the right, if present + allowed = re.compile("(?!-)[A-Z\d-]{1,63}(? 0: f.write("main.whitelist = [\n") for x in range(int(pwn_whitelist)): @@ -198,7 +209,7 @@ if __name__ == '__main__': f.write("\t\"" + bssid + "\",\n") f.write("]\n") # set bluetooth tether - pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N]") + pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N] ") if pwn_bluetooth.lower() in ('y', 'yes'): f.write("main.plugins.bt-tether.enabled = true\n\n") pwn_bluetooth_device = input("What device do you use? Android or iOS? ") @@ -213,7 +224,7 @@ if __name__ == '__main__': if pwn_bluetooth_mac != "": f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") # set up display settings - pwn_display_enabled = input("Do you use a display? [Y/N]\n") + pwn_display_enabled = input("Do you use a display? [Y/N] ") if pwn_display_enabled.lower() in ('y', 'yes'): f.write("ui.display.enabled = true\n") pwn_display_type = input("What display do you use?\n\n" From 9495d552969ba25e92255144e307bbec90360d14 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:25:22 +0100 Subject: [PATCH 21/30] Add display invert to --install --- bin/pwnagotchi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 6e9584f6..d8f68fa5 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -191,10 +191,13 @@ if __name__ == '__main__': pwn_name = "main.name = \"" + pwn_name + "\"\n" f.write(pwn_name) else: - pwn_name = is_valid_hostname(pwn_name) - print("I shall go by %s from now on!", pwn_name) - pwn_name = "main.name = \"" + pwn_name + "\"\n" - f.write(pwn_name) + if is_valid_hostname(pwn_name): + print("I shall go by %s from now on!", pwn_name) + pwn_name = "main.name = \"" + pwn_name + "\"\n" + f.write(pwn_name) + else: + print("You have chosen an invalid name. Please start over.") + pass pwn_whitelist = input("How many networks do you want to whitelist? " "We will also ask a MAC for each network?\n" "Each SSID and BSSID count as 1 network. \n\n" From a4c25e99964546cf12bd685633f39d8de28a5fc7 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:28:31 +0100 Subject: [PATCH 22/30] Add display invert to --install --- bin/pwnagotchi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index d8f68fa5..0ac3d20e 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -197,7 +197,7 @@ if __name__ == '__main__': f.write(pwn_name) else: print("You have chosen an invalid name. Please start over.") - pass + exit() pwn_whitelist = input("How many networks do you want to whitelist? " "We will also ask a MAC for each network?\n" "Each SSID and BSSID count as 1 network. \n\n" From 6f57b66cf4f4cff4ea79070933527282a119ce65 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:35:09 +0100 Subject: [PATCH 23/30] Add display invert to --install --- bin/pwnagotchi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 0ac3d20e..3a022504 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -188,12 +188,12 @@ if __name__ == '__main__': if pwn_name == "": pwn_name = "Pwnagotchi" print("I shall go by Pwnagotchi from now on!") - pwn_name = "main.name = \"" + pwn_name + "\"\n" + pwn_name = "main.name = \"%s\"\n" % pwn_name f.write(pwn_name) else: if is_valid_hostname(pwn_name): - print("I shall go by %s from now on!", pwn_name) - pwn_name = "main.name = \"" + pwn_name + "\"\n" + print("I shall go by %s from now on!" % pwn_name) + pwn_name = "main.name = \"%s\"\n" % pwn_name f.write(pwn_name) else: print("You have chosen an invalid name. Please start over.") @@ -208,8 +208,8 @@ if __name__ == '__main__': for x in range(int(pwn_whitelist)): ssid = input("SSID (Name): ") bssid = input("BSSID (MAC): ") - f.write("\t\"" + ssid + "\",\n") - f.write("\t\"" + bssid + "\",\n") + f.write("\t\"%s\",\n" % ssid) + f.write("\t\"%s\",\n" % bssid) f.write("]\n") # set bluetooth tether pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N] ") @@ -218,14 +218,14 @@ if __name__ == '__main__': pwn_bluetooth_device = input("What device do you use? Android or iOS? ") if pwn_bluetooth_device.lower() == "android": f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") - pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device? ") + pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": - f.write("main.plugins.bt-tether.devices.android-phone.mac = \""+pwn_bluetooth_mac+"\"\n") + f.write("main.plugins.bt-tether.devices.android-phone.mac = \"%s\"\n" % pwn_bluetooth_mac) elif pwn_bluetooth_device.lower() == "ios": f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") - pwn_bluetooth_mac = input("What is the Bluetooth MAC of your device? ") + pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": - f.write("main.plugins.bt-tether.devices.android-phone.mac = \"" + pwn_bluetooth_mac + "\"\n") + f.write("main.plugins.bt-tether.devices.ios-phone.mac = \"%s\"\n" % pwn_bluetooth_mac) # set up display settings pwn_display_enabled = input("Do you use a display? [Y/N] ") if pwn_display_enabled.lower() in ('y', 'yes'): From 255bbdbc0809aa216f6ad01857df3b5f2bc72044 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:40:04 +0100 Subject: [PATCH 24/30] Update wizard script --- bin/pwnagotchi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 3a022504..a7369b20 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -234,7 +234,7 @@ if __name__ == '__main__': "Be sure to check for the correct display type @ \n" "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n") if pwn_display_type != "": - f.write("ui.display.type = \""+pwn_display_type+"\"\n") + f.write("ui.display.type = \"%s\"\n" % pwn_display_type) pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n" "N = Black background\n" "Y = White background\n") From 8f043ff5efce9caf65d20ebe186559e89268bbc5 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:47:52 +0100 Subject: [PATCH 25/30] Update wizard script --- bin/pwnagotchi | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index a7369b20..723c00cc 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -188,12 +188,12 @@ if __name__ == '__main__': if pwn_name == "": pwn_name = "Pwnagotchi" print("I shall go by Pwnagotchi from now on!") - pwn_name = "main.name = \"%s\"\n" % pwn_name + pwn_name = f"main.name = \"{pwn_name}\"\n" f.write(pwn_name) else: if is_valid_hostname(pwn_name): - print("I shall go by %s from now on!" % pwn_name) - pwn_name = "main.name = \"%s\"\n" % pwn_name + print(f"I shall go by {pwn_name} from now on!") + pwn_name = f"main.name = \"{pwn_name}\"\n" f.write(pwn_name) else: print("You have chosen an invalid name. Please start over.") @@ -208,8 +208,8 @@ if __name__ == '__main__': for x in range(int(pwn_whitelist)): ssid = input("SSID (Name): ") bssid = input("BSSID (MAC): ") - f.write("\t\"%s\",\n" % ssid) - f.write("\t\"%s\",\n" % bssid) + f.write(f"\t\"{ssid}\",\n") + f.write(f"\t\"{bssid}\",\n") f.write("]\n") # set bluetooth tether pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N] ") @@ -220,12 +220,12 @@ if __name__ == '__main__': f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": - f.write("main.plugins.bt-tether.devices.android-phone.mac = \"%s\"\n" % pwn_bluetooth_mac) + f.write(f"main.plugins.bt-tether.devices.android-phone.mac = \"{pwn_bluetooth_mac}\"\n") elif pwn_bluetooth_device.lower() == "ios": f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ") if pwn_bluetooth_mac != "": - f.write("main.plugins.bt-tether.devices.ios-phone.mac = \"%s\"\n" % pwn_bluetooth_mac) + f.write(f"main.plugins.bt-tether.devices.ios-phone.mac = \"{pwn_bluetooth_mac}\"\n") # set up display settings pwn_display_enabled = input("Do you use a display? [Y/N] ") if pwn_display_enabled.lower() in ('y', 'yes'): @@ -234,14 +234,22 @@ if __name__ == '__main__': "Be sure to check for the correct display type @ \n" "https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n") if pwn_display_type != "": - f.write("ui.display.type = \"%s\"\n" % pwn_display_type) + f.write(f"ui.display.type = \"{pwn_display_type}\"\n") pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n" "N = Black background\n" "Y = White background\n") if pwn_display_invert.lower() in ('y', 'yes'): f.write("ui.invert = true\n") f.close() - print("Your configuration is done, and I will restart in 5 seconds.") + if pwn_bluetooth.lower() in ('y', 'yes'): + if pwn_bluetooth_device.lower == "android": + print("To visit the webui on your phone go to: http://192.168.44.44:8080\n" + "Your configuration is done, and I will restart in 5 seconds.") + elif pwn_bluetooth_device.lower == "ios": + print("To visit the webui on your phone go to: http://172.20.10.6:8080\n" + "Your configuration is done, and I will restart in 5 seconds.") + else: + print("Your configuration is done, and I will restart in 5 seconds.") time.sleep(5) os.system("service pwnagotchi restart") else: From 2a243870f70a86be407f57065e8aba82a7fb5e48 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:49:38 +0100 Subject: [PATCH 26/30] Update wizard script --- bin/pwnagotchi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index 723c00cc..bb5ba2df 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -243,10 +243,10 @@ if __name__ == '__main__': f.close() if pwn_bluetooth.lower() in ('y', 'yes'): if pwn_bluetooth_device.lower == "android": - print("To visit the webui on your phone go to: http://192.168.44.44:8080\n" + print("To visit the webui when connected with your phone, visit: http://192.168.44.44:8080\n" "Your configuration is done, and I will restart in 5 seconds.") elif pwn_bluetooth_device.lower == "ios": - print("To visit the webui on your phone go to: http://172.20.10.6:8080\n" + print("To visit the webui when connected with your phone, visit: http://172.20.10.6:8080\n" "Your configuration is done, and I will restart in 5 seconds.") else: print("Your configuration is done, and I will restart in 5 seconds.") From 42cc3136ee979ee2d845600a5ea66d5ac3c427d9 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 20:54:25 +0100 Subject: [PATCH 27/30] Update wizard script --- bin/pwnagotchi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index bb5ba2df..66bc9ed1 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -134,11 +134,11 @@ if __name__ == '__main__': help="Print the configuration.") # Jayofelony added these - parser.add_argument('--install', dest="install", action="store_true", default=False, + parser.add_argument('--wizard', dest="wizard", action="store_true", default=False, help="Interactive installation of your personal configuration.") parser.add_argument('--check-update', dest="check_update", action="store_true", default=False, help="Check for updates on Pwnagotchi. And tells current version.") - parser.add_argument('--wizard', dest="wizard", action="store_true", default=False, + parser.add_argument('--donate', dest="donate", action="store_true", default=False, help="How to donate to this project.") # pwnagotchi plugins --help From 5b7014c68e57ab41df485339869af9012216e776 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 21:01:23 +0100 Subject: [PATCH 28/30] Change MOTD --- builder/data/64bit/etc/update-motd.d/01-motd | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/data/64bit/etc/update-motd.d/01-motd b/builder/data/64bit/etc/update-motd.d/01-motd index 31f6c6bd..1f9d52d2 100755 --- a/builder/data/64bit/etc/update-motd.d/01-motd +++ b/builder/data/64bit/etc/update-motd.d/01-motd @@ -20,6 +20,7 @@ echo " I'm managed by systemd. Here are some basic commands." echo echo " If you want to know what I'm doing, you can check my logs with the command" echo " - pwnlog" +echo " - sudo pwnagotchi --wizard, to help set up a config.toml" echo " - sudo pwnagotchi --version, to check the current version" echo " - sudo pwnagotchi --donate, to see how you can donate to this project" echo " - sudo pwnagotchi --check-update, to see if there is a new version available" From 59e42daeb5dbfab2118d3838dbdd9f3c528a8513 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Mon, 4 Mar 2024 21:13:33 +0100 Subject: [PATCH 29/30] Update bash Signed-off-by: jayofelony --- builder/data/32bit/raspberrypi32.yml | 23 +++++------------------ builder/data/64bit/raspberrypi64.yml | 23 +++++------------------ 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/builder/data/32bit/raspberrypi32.yml b/builder/data/32bit/raspberrypi32.yml index 8fae65a2..e3b03d9b 100644 --- a/builder/data/32bit/raspberrypi32.yml +++ b/builder/data/32bit/raspberrypi32.yml @@ -383,6 +383,11 @@ block: | export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin + alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/' + alias config='sudo nano /etc/pwnagotchi/config.toml' + alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-' + alias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"' + alias pwnkill='sudo killall -USR1 pwnagotchi' when: golang.changed - name: download pwngrid @@ -494,24 +499,6 @@ regexp: '(.*)$' line: '\1 modules-load=dwc2,g_ether' - - name: Add pwnlog alias - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'" - insertafter: EOF - - - name: Add pwnver alias - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'" - insertafter: EOF - - - name: Add pwnkill alias to restart pwnagotchi with a signal - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'" - insertafter: EOF - - name: add firmware packages to hold dpkg_selections: name: "{{ item }}" diff --git a/builder/data/64bit/raspberrypi64.yml b/builder/data/64bit/raspberrypi64.yml index c3aa52a3..c0137d2c 100644 --- a/builder/data/64bit/raspberrypi64.yml +++ b/builder/data/64bit/raspberrypi64.yml @@ -497,6 +497,11 @@ block: | export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin + alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/' + alias config='sudo nano /etc/pwnagotchi/config.toml' + alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-' + alias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"' + alias pwnkill='sudo killall -USR1 pwnagotchi' when: golang.changed - name: download pwngrid @@ -598,24 +603,6 @@ state: absent path: /etc/update-motd.d/10-uname - - name: Add pwnlog alias - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'" - insertafter: EOF - - - name: Add pwnver alias - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'" - insertafter: EOF - - - name: Add pwnkill alias to restart pwnagotchi with a signal - lineinfile: - dest: /home/pi/.bashrc - line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'" - insertafter: EOF - - name: add firmware packages to hold dpkg_selections: name: "{{ item }}" From eb76ef4c5401a54f974fda4a673800cdaf9d2012 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Mon, 4 Mar 2024 21:21:48 +0100 Subject: [PATCH 30/30] Update build Signed-off-by: jayofelony --- builder/data/32bit/raspberrypi32.yml | 2 +- builder/data/64bit/raspberrypi64.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/data/32bit/raspberrypi32.yml b/builder/data/32bit/raspberrypi32.yml index e3b03d9b..8af1d53f 100644 --- a/builder/data/32bit/raspberrypi32.yml +++ b/builder/data/32bit/raspberrypi32.yml @@ -456,7 +456,7 @@ # Add your configuration overrides on this file any configuration changes done to default.toml will be lost! # Example: # ui.display.enabled = true - # ui.display.type = "waveshare_2" + # ui.display.type = "waveshare_4" when: not user_config.stat.exists - name: Delete motd 10-uname diff --git a/builder/data/64bit/raspberrypi64.yml b/builder/data/64bit/raspberrypi64.yml index c0137d2c..740f8d38 100644 --- a/builder/data/64bit/raspberrypi64.yml +++ b/builder/data/64bit/raspberrypi64.yml @@ -590,7 +590,7 @@ # Add your configuration overrides on this file any configuration changes done to default.toml will be lost! # Example: # ui.display.enabled = true - # ui.display.type = "waveshare_2" + # ui.display.type = "waveshare_4" when: not user_config.stat.exists - name: Delete motd