-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLI.h
95 lines (79 loc) · 2.39 KB
/
CLI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef CLI_h
#define CLI_h
#include "Arduino.h"
#include <ESP8266WiFi.h>
#include <FS.h>
extern "C" {
#include "user_interface.h"
}
#include "language.h"
#include "A_config.h"
#include "SimpleList.h"
#include "Settings.h"
#include "Names.h"
#include "SSIDs.h"
#include "Scan.h"
#include "Attack.h"
#include "DisplayUI.h"
#include "LED.h"
extern LED led;
extern Settings settings;
extern Names names;
extern SSIDs ssids;
extern Accesspoints accesspoints;
extern Stations stations;
extern Scan scan;
extern Attack attack;
extern DisplayUI displayUI;
extern uint32_t currentTime;
extern uint32_t autosaveTime;
extern String macToStr(uint8_t* mac);
extern void strToColor(String str, uint8_t* buf);
extern void readFileToSerial(String path, bool showLineNum);
extern bool readFile(String path, String& buf);
extern bool removeFile(String path);
extern bool copyFile(String pathFrom, String pathTo);
extern bool renameFile(String pathFrom, String pathTo);
extern bool appendFile(String path, String& buf);
extern bool removeLines(String path, int lineFrom, int lineTo);
extern bool replaceLine(String path, int line, String& buf);
extern bool equalsKeyword(const char* str, const char* keyword);
extern void printWifiStatus();
extern void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal);
extern void wifiUpdate();
class CLI {
public:
CLI();
~CLI();
void load();
void load(String filepath);
void enable();
void disable();
void update();
void stop();
void enableDelay(uint32_t delayTime);
void exec(String input);
void execFile(String path);
void runLine(String input);
void runCommand(String input);
private:
bool enabled = false;
SimpleList<String>* list;
SimpleList<String>* queue;
bool delayed = false;
uint32_t delayTime = 0;
uint32_t delayStartTime = 0;
String execPath = "/autostart.txt";
struct Keyword {
const char* name;
const char* shortName;
const char* alt;
};
void error(String message);
void parameterError(String parameter);
bool isInt(String str);
int toInt(String str);
uint32_t getTime(String time);
bool eqlsCMD(int i, const char* keyword);
};
#endif // ifndef CLI_h