Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arg version #70

Open
DjPopol opened this issue Jun 8, 2024 · 2 comments
Open

Add arg version #70

DjPopol opened this issue Jun 8, 2024 · 2 comments

Comments

@DjPopol
Copy link

DjPopol commented Jun 8, 2024

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.

@DjPopol DjPopol changed the title Add version Add arg version Jun 8, 2024
@bsdcpp
Copy link

bsdcpp commented Jul 6, 2024

good suggestion

@DjPopol
Copy link
Author

DjPopol commented Sep 29, 2024

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;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants