What should I learn to turn my Wi-Fi login script into a proper tool?

0
0
Asked By MapleOrbit47 On

I've written a basic script that makes connecting to my college's Wi-Fi semi-automatic. It uses nmcli and a keyboard shortcut to open or run the applications and scripts needed to connect to the network and complete the captive-portal login. It currently works reliably, but I'd like to expand it into a more complete project.

I want to add interactive console prompts, collect information from the user, save that information somewhere, and load it again during future runs. I have some programming experience, but I'm an English Language Teaching student who mainly programs as a hobby and occasionally contributes to open-source projects. I'm not sure what concepts or technologies I should research to build this properly.

Should I continue with Bash, or would Python or C# be more suitable? What topics should I look into for command-line input, persistent data, configuration files, subprocesses, and safely storing any credentials?

4 Answers

Answered By CopperMeadow21 On

C# is also a reasonable option if you already know it and want a more structured application. It can produce a standalone Linux build, but for a lightweight command-line automation script, Python will probably involve less setup. The important decision is less about performance and more about which language lets you work comfortably with files, processes, and error handling.

Answered By QuietHarbor8 On

For a small tool that mainly launches commands and applications, Bash can handle the basics. Research the `read` command for user input, shell redirection for simple file output, and tools such as `jq` if you want to work with JSON. However, once you need structured data, validation, error handling, and more complicated logic, Bash becomes awkward quickly. A general-purpose language will be easier to maintain.

Answered By LimeCanvas3 On

Python would be a practical choice here, especially if you remember finding it convenient. Useful topics to research are `input()`, JSON or TOML configuration files, `pathlib` for file paths, and `subprocess` for running `nmcli`. Build it in small stages: first prompt for one value, then save and load a harmless test setting, then connect that to the existing workflow. Keep configuration separate from the code and add input validation as you go.

SilverTangent6 -

That makes sense. I’m leaning toward Python because I used it a long time ago and remember it being straightforward, even though I’ll need to relearn most of it.

Answered By VioletKite90 On

The main concepts to research are command-line interfaces, configuration files, serialization and deserialization, persistent application state, subprocess management, and input validation. Since this tool may handle Wi-Fi or portal credentials, don’t casually write passwords to a plain text or JSON file. Look into your desktop environment’s keyring or Linux Secret Service support, and keep secrets out of source control. It’s also worth separating the program into functions for prompting, saving settings, loading settings, and running the network commands.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.