Add display invert to --install

This commit is contained in:
jayofelony
2024-03-04 20:08:45 +01:00
parent 1f9afd541d
commit 54b7ce5d0d

View File

@ -160,21 +160,21 @@ if __name__ == '__main__':
sys.exit(0) sys.exit(0)
if args.wizard: 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'): 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")
print("Your previous configuration is restored, and I will restart in 5 seconds.") print("Your previous configuration is restored, and I will restart in 5 seconds.")
time.sleep(5) time.sleep(5)
os.system("service pwnagotchi restart") os.system("service pwnagotchi restart")
else: 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'): if pwn_check.lower() in ('y', 'yes'):
os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak") os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak")
with open("/etc/pwnagotchi/config.toml", "a+") as f: 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") f.write("# Do not edit this file if you do not know what you are doing!!!\n\n")
# Set pwnagotchi name # Set pwnagotchi name
print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n" print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n"
"My name is Jayofelony, how may I call you? ") "My name is Jayofelony, how may I call you?\n")
pwn_name = input("Pwnagotchi name (no spaces): ") pwn_name = input("Pwnagotchi name (no spaces): ")
if pwn_name == "": if pwn_name == "":
pwn_name = "Pwnagotchi" pwn_name = "Pwnagotchi"
@ -188,7 +188,7 @@ if __name__ == '__main__':
pwn_whitelist = input("How many networks do you want to whitelist? " pwn_whitelist = input("How many networks do you want to whitelist? "
"We will also ask a MAC for each network?\n" "We will also ask a MAC for each network?\n"
"Each SSID and BSSID count as 1 network. \n\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: if int(pwn_whitelist) > 0:
f.write("main.whitelist = [\n") f.write("main.whitelist = [\n")
for x in range(int(pwn_whitelist)): for x in range(int(pwn_whitelist)):
@ -198,7 +198,7 @@ if __name__ == '__main__':
f.write("\t\"" + bssid + "\",\n") f.write("\t\"" + bssid + "\",\n")
f.write("]\n") f.write("]\n")
# set bluetooth tether # 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'): if pwn_bluetooth.lower() in ('y', 'yes'):
f.write("main.plugins.bt-tether.enabled = true\n\n") 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? ")
@ -213,18 +213,18 @@ if __name__ == '__main__':
if pwn_bluetooth_mac != "": 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 = \"" + pwn_bluetooth_mac + "\"\n")
# set up display settings # 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'): if pwn_display_enabled.lower() in ('y', 'yes'):
f.write("ui.display.enabled = true\n") f.write("ui.display.enabled = true\n")
pwn_display_type = input("What display do you use?\n\n" pwn_display_type = input("What display do you use?\n\n"
"Be sure to check for the correct display type @ \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 != "": if pwn_display_type != "":
f.write("ui.display.type = \""+pwn_display_type+"\"\n") 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" pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n"
"No = Black background\n" "N = Black background\n"
"Yes = White background") "Y = White background\n")
if pwn_display_invert in ('y', 'yes'): if pwn_display_invert.lower() in ('y', 'yes'):
f.write("ui.invert = true\n") f.write("ui.invert = true\n")
f.close() f.close()
print("Your configuration is done, and I will restart in 5 seconds.") 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__) local = version_to_tuple(pwnagotchi.__version__)
remote = version_to_tuple(latest_ver) remote = version_to_tuple(latest_ver)
if remote > local: 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)) % (pwnagotchi.__version__, latest_ver))
# input validation # input validation
if user_input.lower() in ('y', 'yes'): if user_input.lower() in ('y', 'yes'):