Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Wargames Levelling System [Perl]
  • Sh3llc0d3
    Posts: 1,910
    This is a taster of what I'm working on for the levelling system. This will gather input and adjust accordingly. It's designed to fit around chronic's wargames. This is the very early stages to see what you think. It'll hopefully post information online when I work out the methods of how I want it to do so. See what you think, if anyone needs any help with the perl let me know and I'll comment anything anyone's unsure on.

    #!/usr/bin/perl
    #Coded by: Semtex-Primed
    #For use with: iExploit Wargames Server

    # Test/Demo Passwords
    $wg1_code = \"test1\";
    $wg2_code = \"test2\";
    @header = (
    \"\n\n\t\td8b 8888888888 888 d8b 888 \n\",
    \"\t\tY8P 888 888 Y8P 888 \n\",
    \"\t\t 888 888 888 \n\",
    \"\t\t888 8888888 888 888 88888b. 888 .d88b. 888 888888 \n\",
    \"\t\t888 888 `Y8bd8P' 888 88b 888 d88 88b 888 888 \n\",
    \"\t\t888 888 X88K 888 888 888 888 888 888 888 \n\",
    \"\t\t888 888 .d8pq8b. 888 d88P 888 Y88..88P 888 Y88b. \n\",
    \"\t\t888 8888888888 888 888 88888P 888 Y88P 888 Y888 \n\",
    \"\t\t 888 \n\",
    \"\t\t 888 Wargames Server \n\",
    \"\t\t 888 \n\"
    );
    @wargames = (
    \"\n\t\t*Wargames Available*\n\",
    \"\t\t[+] Wargame [1]\n\",
    \"\t\t[-] Wargame [2]\n\",
    \"\t\t[-] Wargame [3]\n\n\",
    \"\t\tnote: [+] = Available, [-] = Needs Unlocking, [x] = Completed\n\"
    );
    while(1) {
    system(\"clear\");
    print @header;
    print @wargames;
    print \"\t\t[*] Make your selection: \n\";
    print \"\t\t[*] >> \";
    $choice = <STDIN>;
    chomp ($choice);
    if($choice eq '1') {
    $data_file=\"/home/semtex-primed/iexploit1.hint\";
    open(DATA, $data_file) || die(\"\t\t[*] Could not open wargame!\n\");
    @raw_data=<DATA>;
    print @raw_data;
    print \"\t\t[*] Enter the passcode to complete mission\n\";
    print \"\t\t[*] >> \";
    $code=<STDIN>;
    chomp($code);
    if($code eq $wg1_code) {
    # Change menu
    @wargames[1] = \"\t\t[x] Wargame [1]\n\";
    @wargames[2] = \"\t\t[+] Wargame [2]\n\";
    # Upgrade privs to view next challenge
    system(\"usermod -a -G iE2 semtex-primed\");
    #send points to web!
    } else {
    print \"Wrong password! Try again!\n\";
    last;
    }
    } elsif ($choice eq '2') {
    $data_file=\"/home/semtex-primed/iexploit2.hint\";
    open(DATA, $data_file) || die(\"\t\t[*] Could not open wargame!\n\");
    @raw_data=<DATA>;
    print @raw_data;
    print \"\t\t[*] Enter the passcode to complete mission\n\";
    print \"\t\t[*] >> \";
    $code=<STDIN>;
    chomp($code);
    if($code eq $wg2_code) {
    # Change menu
    @wargames[2] = \"\t\t[x] Wargame [2]\n\";
    @wargames[3] = \"\t\t[+] Wargame [3]\n\";
    # Upgrade privs to view next challenge
    system(\"usermod -a -G iE3 semtex-primed\");
    #send points to web!
    } else {
    print \"Wrong password! Try again!\n\";
    last;
    }
    } else {
    print \"\t\t[*] Make a selection!\n\";
    }
    }


    Usage: best way is to "chmod +x file.pl" the file then "./file.pl" to run.
  • Xin
    Posts: 3,251
    said:


    This is a taster of what I'm working on for the levelling system. This will gather input and adjust accordingly. It's designed to fit around chronic's wargames. This is the very early stages to see what you think. It'll hopefully post information online when I work out the methods of how I want it to do so. See what you think, if anyone needs any help with the perl let me know and I'll comment anything anyone's unsure on.

    #!/usr/bin/perl
    #Coded by: Semtex-Primed
    #For use with: iExploit Wargames Server

    # Test/Demo Passwords
    $wg1_code = \"test1\";
    $wg2_code = \"test2\";
    @header = (
    \"\n\n\t\td8b 8888888888 888 d8b 888 \n\",
    \"\t\tY8P 888 888 Y8P 888 \n\",
    \"\t\t 888 888 888 \n\",
    \"\t\t888 8888888 888 888 88888b. 888 .d88b. 888 888888 \n\",
    \"\t\t888 888 `Y8bd8P' 888 88b 888 d88 88b 888 888 \n\",
    \"\t\t888 888 X88K 888 888 888 888 888 888 888 \n\",
    \"\t\t888 888 .d8pq8b. 888 d88P 888 Y88..88P 888 Y88b. \n\",
    \"\t\t888 8888888888 888 888 88888P 888 Y88P 888 Y888 \n\",
    \"\t\t 888 \n\",
    \"\t\t 888 Wargames Server \n\",
    \"\t\t 888 \n\"
    );
    @wargames = (
    \"\n\t\t*Wargames Available*\n\",
    \"\t\t[+] Wargame [1]\n\",
    \"\t\t[-] Wargame [2]\n\",
    \"\t\t[-] Wargame [3]\n\n\",
    \"\t\tnote: [+] = Available, [-] = Needs Unlocking, [x] = Completed\n\"
    );
    while(1) {
    system(\"clear\");
    print @header;
    print @wargames;
    print \"\t\t[*] Make your selection: \n\";
    print \"\t\t[*] >> \";
    $choice = <STDIN>;
    chomp ($choice);
    if($choice eq '1') {
    $data_file=\"/home/semtex-primed/iexploit1.hint\";
    open(DATA, $data_file) || die(\"\t\t[*] Could not open wargame!\n\");
    @raw_data=<DATA>;
    print @raw_data;
    print \"\t\t[*] Enter the passcode to complete mission\n\";
    print \"\t\t[*] >> \";
    $code=<STDIN>;
    chomp($code);
    if($code eq $wg1_code) {
    @wargames[1] = \"\t\t[x] Wargame [1]\n\";
    @wargames[2] = \"\t\t[+] Wargame [2]\n\";
    #send points to web!
    }
    } elsif ($choice eq '2') {
    $data_file=\"/home/semtex-primed/iexploit2.hint\";
    open(DATA, $data_file) || die(\"\t\t[*] Could not open wargame!\n\");
    @raw_data=<DATA>;
    print @raw_data;
    print \"\t\t[*] Enter the passcode to complete mission\n\";
    print \"\t\t[*] >> \";
    $code=<STDIN>;
    chomp($code);
    if($code eq $wg2_code) {
    @wargames[2] = \"\t\t[x] Wargame [2]\n\";
    @wargames[3] = \"\t\t[+] Wargame [3]\n\";
    #send points to web!
    }
    } else {
    print \"\t\t[*] Make a selection!\n\";
    }
    }


    Usage: best way is to "chmod +x file.pl" the file then "./file.pl" to run.


    By leveling i dont mean the users get points and can be ranked, although that would be nice :) i mean like when you complete a challenge your shell gets escalated to shell challenge 2 for examples, and you have the permissions to complete it.

    But great start :)
    Xin
  • Lookin awesome. Never really though of something like that. Great job.
  • Sh3llc0d3
    Posts: 1,910

    By leveling i dont mean the users get points and can be ranked, although that would be nice :) i mean like when you complete a challenge your shell gets escalated to shell challenge 2 for examples, and you have the permissions to complete it.

    But great start :)


    Yeah I get what you mean, I'll look into incorporating it or writing a separate script executed/activated by this one.

    Lookin awesome. Never really though of something like that. Great job.


    Thanks chronic, hopefully I'll have a much better version to show in the next update.

    I've just checked out the escalation of privs to a new level etc and I can do it using a perl script, however it needs root privs to make the change =/
  • said:


    By leveling i dont mean the users get points and can be ranked, although that would be nice :) i mean like when you complete a challenge your shell gets escalated to shell challenge 2 for examples, and you have the permissions to complete it.

    But great start :)


    Yeah I get what you mean, I'll look into incorporating it or writing a separate script executed/activated by this one.

    Lookin awesome. Never really though of something like that. Great job.


    Thanks chronic, hopefully I'll have a much better version to show in the next update.

    I've just checked out the escalation of privs to a new level etc and I can do it using a perl script, however it needs root privs to make the change =/

    So how about you give the script the SUID flag? That way, if the script is run it runs as root.
  • Sh3llc0d3
    Posts: 1,910
    said:


    said:


    By leveling i dont mean the users get points and can be ranked, although that would be nice :) i mean like when you complete a challenge your shell gets escalated to shell challenge 2 for examples, and you have the permissions to complete it.

    But great start :)


    Yeah I get what you mean, I'll look into incorporating it or writing a separate script executed/activated by this one.

    Lookin awesome. Never really though of something like that. Great job.


    Thanks chronic, hopefully I'll have a much better version to show in the next update.

    I've just checked out the escalation of privs to a new level etc and I can do it using a perl script, however it needs root privs to make the change =/

    So how about you give the script the SUID flag? That way, if the script is run it runs as root.



    Honestly didn't think to do so! lol

    Now, creating two different usergroups (user starting off as a member of the 1st) and group permissions to the second challenge the user will not be allowed to access the second game until levelling up and escalating to the second usergroup. Bit of tinkering about and it should work fine. What I can do is append the shell itself to show the level the person is currently at... we'll see what happens.
  • said:


    said:


    said:


    By leveling i dont mean the users get points and can be ranked, although that would be nice :) i mean like when you complete a challenge your shell gets escalated to shell challenge 2 for examples, and you have the permissions to complete it.

    But great start :)


    Yeah I get what you mean, I'll look into incorporating it or writing a separate script executed/activated by this one.

    Lookin awesome. Never really though of something like that. Great job.


    Thanks chronic, hopefully I'll have a much better version to show in the next update.

    I've just checked out the escalation of privs to a new level etc and I can do it using a perl script, however it needs root privs to make the change =/

    So how about you give the script the SUID flag? That way, if the script is run it runs as root.



    Honestly didn't think to do so! lol

    Now, creating two different usergroups (user starting off as a member of the 1st) and group permissions to the second challenge the user will not be allowed to access the second game until levelling up and escalating to the second usergroup. Bit of tinkering about and it should work fine. What I can do is append the shell itself to show the level the person is currently at... we'll see what happens.

    Good luck. Sadly I can't help because I don't know perl lol.
  • Sh3llc0d3
    Posts: 1,910
    Well I'll in all fairness end up ballsing it up so I wouldn't count on it staying in perl lol. It should work fine till I try and add the code to post the results to the net.
  • Sh3llc0d3
    Posts: 1,910
    Updated:

    - Privs escalation feature.
    - Menu update feature.

    Changes needed to vuln box:
    - Usergroups need creating
    - files need usergroup privs editing.

    Code still needed:
    - CGI code
    - local recording of user stats.

    The hint files/challenges will be only accessible by users of a specific usergroup. After completing the challenge and entering the answer the users status in the wargame menu changes to completed and then unlocks the next challenge. Then the user gets escalated into the next usergroup (ie2, ie3 etc.)

    The .hint files need filling in and the web coding needs doing. With my limited knowledge of web coding and perl/web code I'm going to try and implement a perl/cgi script that'll have built in html capabilities thus printing info to a local webpage.