-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82348fa
commit a8c70e3
Showing
21 changed files
with
511 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
v3.0 (2024-01-20) | ||
* command-line qrcode export support | ||
* sudo support | ||
|
||
v2.1 (2023-03-04) | ||
================= | ||
* support libUseful-5 | ||
* Create LICENSE | ||
|
||
v2.0 (2022-10-21) | ||
================= | ||
* display options for known and open nets | ||
* channel numbers can be 3 digits! | ||
* add 'change interface' screen | ||
* added 'list interfaces' action | ||
|
||
v1.5 (2020-06-18) | ||
================= | ||
* fix for stuck process left when terminal closed | ||
|
||
v1.4 (2020-06-06) | ||
================= | ||
* country-code/regulatory option added | ||
* add country code for wpa_supplicant | ||
* Better command-line parsing. Handle devices that require using other wpa_supplicant drivers than nl80211 | ||
|
||
v1.3 (2020-04-30) | ||
================= | ||
* Fix for 'last character missing' issue with user-inputed strings, like network passphrases | ||
|
||
v1.2 (2020-04-28) | ||
================= | ||
* You can now back out of entering network details and cancel joining a network | ||
|
||
v1.1 (2020-03-24) | ||
================= | ||
* don't mess up config file is items like 'username' aren't set | ||
* changes for networks using username and password | ||
|
||
v1.0 (2019-12-15) | ||
================= | ||
* use iw if iwconfig not available | ||
* handle open wifi networks | ||
* fix return value to allow compile under clang | ||
* Don't launch DHCPCD until wifi is associated | ||
* better behaved bottom bar | ||
* code tidyup, added README.md, added .travis.yml | ||
* initial commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "command_line.h" | ||
#include "settings.h" | ||
|
||
int ParseCommandLine(int argc, char *argv[], TNet *Conf) | ||
{ | ||
CMDLINE *CL; | ||
int Act=ACT_INTERACTIVE; | ||
const char *ptr; | ||
|
||
CL=CommandLineParserCreate(argc, argv); | ||
|
||
ptr=CommandLineFirst(CL); | ||
if (StrValid(ptr)) | ||
{ | ||
if (strcmp(ptr, "list")==0) Act=ACT_LIST; | ||
else if (strcmp(ptr, "interfaces")==0) Act=ACT_IFACE_LIST; | ||
else if (strcmp(ptr, "scan")==0) | ||
{ | ||
ptr=CommandLineNext(CL); | ||
if (ListFindNamedItem(Interfaces, ptr)) | ||
{ | ||
Conf->Interface=CopyStr(Conf->Interface, ptr); | ||
} | ||
Act=ACT_SCAN; | ||
} | ||
else if (strcmp(ptr, "add")==0) | ||
{ | ||
Act=ACT_ADD; | ||
Conf->Flags |= NET_STORE; | ||
Conf->ESSID=CopyStr(Conf->ESSID, CommandLineNext(CL)); | ||
Conf->Address=CopyStr(Conf->Address, CommandLineNext(CL)); | ||
if (strcasecmp(Conf->Address, "dhcp") !=0) | ||
{ | ||
Conf->Netmask=CopyStr(Conf->Netmask, CommandLineNext(CL)); | ||
Conf->Gateway=CopyStr(Conf->Gateway, CommandLineNext(CL)); | ||
Conf->DNSServer=CopyStr(Conf->DNSServer, CommandLineNext(CL)); | ||
} | ||
} | ||
else if (strcmp(ptr, "join")==0) | ||
{ | ||
Act=ACT_JOIN; | ||
Conf->Interface=CopyStr(Conf->Interface, CommandLineNext(CL)); | ||
if (! ListFindNamedItem(Interfaces, Conf->Interface)) | ||
{ | ||
printf("ERROR: '%s' is not an interface\n", Conf->Interface); | ||
printf("usage: %s join <interface> <essid>\n", argv[0]); | ||
exit(1); | ||
} | ||
|
||
Conf->ESSID=CopyStr(Conf->ESSID, CommandLineNext(CL)); | ||
} | ||
else if (strcmp(ptr, "connect")==0) | ||
{ | ||
Act=ACT_JOIN; | ||
Conf->ESSID=CopyStr(Conf->ESSID, CommandLineNext(CL)); | ||
Conf->Interface=CopyStr(Conf->Interface, CommandLineNext(CL)); | ||
} | ||
else if (strcmp(ptr, "leave")==0) | ||
{ | ||
Act=ACT_LEAVE; | ||
Conf->Interface=CopyStr(Conf->Interface, CommandLineNext(CL)); | ||
if (! ListFindNamedItem(Interfaces, Conf->Interface)) | ||
{ | ||
printf("ERROR: '%s' is not an interface\n", Conf->Interface); | ||
printf("usage: %s join <interface> <essid>\n", argv[0]); | ||
exit(1); | ||
} | ||
} | ||
else if (strcmp(ptr, "forget")==0) | ||
{ | ||
Act=ACT_FORGET; | ||
Conf->ESSID=CopyStr(Conf->ESSID, CommandLineNext(CL)); | ||
} | ||
else if (strcmp(ptr, "qrcode")==0) | ||
{ | ||
Act=ACT_QRCODE; | ||
Conf->ESSID=CopyStr(Conf->ESSID, CommandLineNext(CL)); | ||
} | ||
else if (strcmp(ptr, "help")==0) Act=ACT_HELP; | ||
} | ||
|
||
|
||
|
||
ptr=CommandLineCurr(CL); | ||
while (ptr) | ||
{ | ||
if (strcmp(ptr, "-?")==0) Act=ACT_HELP; | ||
else if (strcmp(ptr, "-h")==0) Act=ACT_HELP; | ||
else if (strcmp(ptr, "-help")==0) Act=ACT_HELP; | ||
else if (strcmp(ptr, "--help")==0) Act=ACT_HELP; | ||
else if (strcmp(ptr, "-i")==0) Conf->Interface=CopyStr(Conf->Interface, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-ap")==0) Conf->AccessPoint=CopyStr(Conf->AccessPoint, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-k")==0) Conf->Key=CopyStr(Conf->Key, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-w")==0) Settings.WPASupplicantSock=CopyStr(Settings.WPASupplicantSock, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-o")==0) Settings.OutputPath=CopyStr(Settings.OutputPath, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-viewer")==0) Settings.ImageViewer=CopyStr(Settings.ImageViewer, CommandLineNext(CL)); | ||
else if (strcmp(ptr, "-view")==0) Settings.ImageViewer=CopyStr(Settings.ImageViewer, CommandLineNext(CL)); | ||
|
||
ptr=CommandLineNext(CL); | ||
} | ||
|
||
return(Act); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef TERM_WIFI_CMD_LINE_H | ||
#define TERM_WIFI_CMD_LINE_H | ||
|
||
#include "common.h" | ||
|
||
|
||
#define ACT_INTERACTIVE 0 | ||
#define ACT_ADD 1 | ||
#define ACT_JOIN 2 | ||
#define ACT_LEAVE 3 | ||
#define ACT_LIST 4 | ||
#define ACT_SCAN 5 | ||
#define ACT_FORGET 6 | ||
#define ACT_IFACE_LIST 7 | ||
#define ACT_QRCODE 8 | ||
#define ACT_HELP 99 | ||
|
||
|
||
|
||
int ParseCommandLine(int argc, char *argv[], TNet *Conf); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.