PPPwn_cpp
PPPwn_cpp copied to clipboard
Add arg version
Could you add arg --version or something else ? So we could know version . And add to nightly.link file or something else to get nightly version ? With that all applications who used your program could update it just if needed.
good suggestion
Add this on main.cpp :
const std::string PROJECT_VERSION = "1.0.0";
and on int main(int argc, char *argv[]) :
bool show_version = false;
auto cli = (
("network interface" % required("-i", "--interface") & value("interface", interface), \
SUPPORTED_FIRMWARE % option("--fw") & integer("fw", fw), \
"stage1 binary (default: stage1/stage1.bin)" % option("-s1", "--stage1") & value("STAGE1", stage1), \
"stage2 binary (default: stage2/stage2.bin)" % option("-s2", "--stage2") & value("STAGE2", stage2), \
"timeout in seconds for ps4 response, 0 means always wait (default: 0)" %
option("-t", "--timeout") & integer("seconds", timeout), \
"Waiting time in seconds after the first round CPU pinning (default: 1)" %
option("-wap", "--wait-after-pin") & integer("seconds", wait_after_pin), \
"wait for 1ms every `n` rounds during Heap grooming (default: 4)" % option("-gd", "--groom-delay") &
integer("1-4097", groom_delay), \
"PCAP buffer size in bytes, less than 100 indicates default value (usually 2MB) (default: 0)" %
option("-bs", "--buffer-size") & integer("bytes", buffer_size), \
"automatically retry when fails or timeout" % option("-a", "--auto-retry").set(retry), \
"don't wait one more PADI before starting" % option("-nw", "--no-wait-padi").set(no_wait_padi), \
"Use CPU for more precise sleep time (Only used when execution speed is too slow)" %
option("-rs", "--real-sleep").set(real_sleep), \
"start a web page" % option("--web").set(web_page), \
"custom web page url (default: 0.0.0.0:7796)" % option("--url") & value("url", web_url)
) | \
"list interfaces" % command("list").call(listInterfaces) | \
"show version" % option("-v", "--version").set(show_version)
);
auto result = parse(argc, argv, cli);
if (!result) {
std::cout << make_man_page(cli, "pppwn");
return 1;
}
if (show_version) {
std::cout << PROJECT_VERSION << std::endl;
return 0;
}