1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[#5] Skript Challenge - Deobfuscater

Discussion in 'Skript Challenge' started by BaeFell, May 1, 2018.

Thread Status:
Not open for further replies.
  1. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    969
    Likes Received:
    228
    Hi everyone,

    Welcome to another Skript Challenge!

    In this Skript Challenge, you must make a deobfuscator for @Donut's obfuscator

    The rules are as follows (note: rules may change between challenge):
    - Any of the languages below can be used but the code must be easily readable and accessible
    - Your code must be in code tags, pastebin or on a public GitHub repo
    - You can use addons, but, you're not allowed to use a feature from an addon which does this and the addon must of been released publicly prior to the creation of this thread (eg. WildSkript obfuscate expression...)
    - You can use another user's code, but please don't edit your messages. I can see all message history and posts that do have edit history like this will not be counted
    - Web API's or using an external source (eg, a Java obfuscation library), to get your result in is not allowed. All submissions must actually do the obfuscation themselves.
    - You must list all addons used. I will be testing on Spigot 1.12.2

    I might add a rule after a submission has been made, it's up to me whether or not that submission is valid. I can deny any submission for any reason.

    Challenge details (specifics about this challenge):
    - Your must successfully take the input of an obfuscated script that was obfuscated using @Donut's obfuscation tool and then return the deobfuscated output
    - You can use any of the programming languages below, but the code must be accessible.
    - I really like any information and stuff so gimme stats about what's going on and how everything went

    Languages allowed:
    - Java
    - PHP
    - Skript
    - JavaScript
    Those are the languages I am confident in and can only judge code using them.

    Please follow this format:

    Code (Text):
    1.  
    2. Language used:
    3. Published link (optional):
    4. Source code link or pasted below:
    5.  
    Important
    If you don't understand how your answer will be judged here is an explanation:
    Better code quality = more points. I'm very anti-addon with some things. If you're using an addon for what can be done normally in Skript, then you're not Skripting right. Variable names, code structure, use of functions and code readability matters for this challenge. I'm specifically looking for the best code, not the smallest, but you shouldn't have code that is far too long, otherwise it's unlikely to be efficient.

    The closing date is 7 days from now -> 7th of May - have fun!
    (I might be too busy to post winners on the 8th of May, but any entries after the 7th of May at 11:59PM GMT will not be counted)

    Please direct any questions at myself.

    Thanks,
    BaeFell

    NOTICE: I will be accepting already created solutions, please link to where they are if they're published and the source code.
     
    ShaneBee likes this.
  2. WheezyGold7931

    WheezyGold7931 BaeFell Enthusiast
    VIP+ Addon Developer

    Joined:
    Jan 26, 2017
    Messages:
    134
    Likes Received:
    40
    Medals:
    Need Deobfuscater, asking for a friend
     
    ShaneBee likes this.
  3. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    870
    Likes Received:
    139
    Medals:
    Technically my deobfuscation addon was released prior to the posting of this thread, so here's my submission using Script Deobfuscator:
    Code (Skript):
    1. on script load:
    2.   deobfuscate script
    3.  
    4. # obfuscated code here
     
  4. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    969
    Likes Received:
    228
    lol, just post a normal submission pls
     
    ShaneBee likes this.
  5. Nicofisi

    Supporter Addon Developer

    Joined:
    Jan 26, 2017
    Messages:
    26
    Likes Received:
    10
    So you can't make use of any of Skript's code like Pikachu's addon does, with Java nor skript-mirror, the method/function for deobfuscating needs to take the whole content of a script as a string parameter (/list of strings(lines), etc), process it without accessing Skript and then return it as a deobfuscated string?
     
  6. Duetro

    Duetro Active Member

    Joined:
    Jan 26, 2017
    Messages:
    138
    Likes Received:
    51
    Medals:
    #6 Duetro, May 2, 2018
    Last edited: May 7, 2018
  7. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    870
    Likes Received:
    139
    Medals:
    I guess my submission is the addon itself, then. I'll make a skript version if I have a chance later
     
  8. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    177
    Medals:
  9. TonyMaster21

    Supporter ++ Supporter + Supporter Addon Developer

    Joined:
    Nov 28, 2016
    Messages:
    50
    Likes Received:
    15
    Medals:
  10. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,336
    Likes Received:
    177
    Medals:
  11. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    For 1.1.5: (I made it yesterday but didn't post it yet)
    Language: Skript
    Addons: skUtilities (only for taking file input)
    Input file: plugins/obf.sk
    Code:
    Code (Skript):
    1. options:
    2.     file: plugins/obf.sk
    3.     @: @
    4.          
    5. function getOptions(f: text):
    6.     set {_c::*} to file contents of {_f}
    7.     set {_c} to join {_c::*} with nl
    8.     set {_l::*} to split {_c} at "options:"
    9.     set {_c} to {_l::3}
    10.     delete {_l::*}
    11.     replace every "    " in {_c} with ""
    12.     set {_l::*} to split {_c} at nl
    13.     delete {_l::1}
    14.     loop {_l::*}:
    15.         delete {_s::*}
    16.         set {_s::*} to split loop-value at ": "
    17.         set {obf-options::%{_s::1}%} to {_s::2}
    18.  
    19. function parseOptions(t: text) :: text:
    20.     set {_c::*} to {_t} parsed as "{{@@}%text%}"
    21.     return {_c::1}
    22.  
    23. function obf(t: text) :: text:
    24.     return {obf-options::%{_t}%}
    25.  
    26. # function obfDecodeLine(t: text) :: text:
    27.     # set {_f} to {_t}
    28.     # set {_s::*} to split {_t} at ""
    29.     # set {_w} to false
    30.     # loop {_s::*}:
    31.         # set {_i1} to loop-index parsed as a number
    32.         # loop 10 times:
    33.             # set {_i%loop-number + 1%} to {_i%loop-number%} + 1
    34.         # if loop-value is "{":
    35.             # {_w} is false
    36.             # {_s::%{_i2}%} is "@"
    37.             # set {_in} to false
    38.             # if {_i3} is "}":
    39.                 # set {_in} to true
    40.             # set {_w} to true
    41.             # add {_i1} to {_ind::*}
    42.         # if loop-value is "}":
    43.             # {_w} is true
    44.             # {_in} is false
    45.             # add {_i1} to {_ind::*}
    46.             # set {_w} to false
    47.     # loop {_ind::*}:
    48.         # mod(loop-index parsed as a number, 2) = 1
    49.         # set {_i1} to loop-index parsed as a number
    50.         # set {_i2} to {_i1} + 1
    51.         # set {_txt} to subtext of {_t} from characters loop-value to {_ind::%{_i2}%}
    52.         # set {_txt2} to obf(parseOptions({_txt}))
    53.         # replace every {_txt} in {_f} with {_txt2}
    54.     # return {_f}
    55.  
    56. function obfDecodeFile() :: text:
    57.     getOptions("{@file}")
    58.     set {_c::*} to file contents of "{@file}"
    59.     set {_c} to join {_c::*} with nl
    60.     set {_l::*} to split {_c} at "options:"
    61.     set {_c} to {_l::3}
    62.     delete {_l::*}
    63.     set {_l::*} to split {_c} at nl
    64.     delete {_l::1}
    65.     loop {_l::*}:
    66.         # set {_s} to loop-value
    67.         if loop-value does not contain "    ":
    68.             # broadcast "exit at %loop-value%"
    69.             exit loop
    70.         delete {_l::%loop-index%}
    71.     loop {_l::*}:
    72.         add obfDecodeLine2(loop-value) to {_out::*}
    73.         # broadcast "%{_out::*}%"
    74.         # stop
    75.     set {_out} to join {_out::*} with nl
    76.     replace every "    " in {_out} with "    "
    77.     return {_out}
    78.      
    79. command /decode:
    80.     trigger:
    81.         broadcast obfDecodeFile()
    82.  
    83. function obfDecodeLine2(t: text) :: text:
    84.     set {_f} to {_t}
    85.     set {_s::*} to split {_t} at ""
    86.     set {_w} to false
    87.     loop {_s::*}:
    88.         set {_i1} to loop-index parsed as a number
    89.         loop 10 times:
    90.             set {_i%loop-number + 1%} to {_i%loop-number%} + 1
    91.         remove 1 from {_in}
    92.         set {_c} to false
    93.         if loop-value is "{":
    94.             {_w} is false
    95.             {_s::%{_i2}%} is "@"
    96.             set {_in} to 0
    97.             set {_c} to true
    98.             if {_s::%{_i3}%} is "}":
    99.                 set {_in} to 2
    100.             set {_w} to true
    101.             add {_i1} to {_ind::*}
    102.         if loop-value is "}":
    103.             {_w} is true
    104.             {_in} is not 0
    105.             set {_c} to true
    106.             set {_last} to last element out of {_ind::*}
    107.             add subtext of {_t} from characters {_last} to {_i1} to {_l2::*}
    108.             add {_i1} to {_ind::*}
    109.             set {_w} to false
    110.         if {_c} is false:
    111.             {_w} is false
    112.             add loop-value to {_l2::*}
    113.     # loop {_ind::*}:
    114.         # mod(loop-index parsed as a number, 2) = 1
    115.         # set {_i1} to loop-index parsed as a number
    116.         # set {_i2} to {_i1} + 1
    117.         # set {_txt} to subtext of {_t} from characters loop-value to {_ind::%{_i2}%}
    118.         # set {_txt2} to obf(parseOptions({_txt}))
    119.         # replace every {_txt} in {_f} with {_txt2}
    120.     # return {_f}
    121.     # broadcast "%{_l2::*}%"
    122.     # stop
    123.     loop {_l2::*}:
    124.         loop-value contains "@", "{" and "}"
    125.         set {_l2::%loop-index%} to obf(parseOptions(loop-value))
    126.     set {_out} to join {_l2::*} with ""
    127.     replace every "    " in {_out} with "    "
    128.     return {_out}
    I'm going to make one for the newest version as well
    EDIT:
    Okay I think I won't be able to do the deobfuskator for 1.2.5 as skUtilities doesn't want to take input from the file :/, so I hope there will be a new version which skUtilities can read.
     
    #11 TPGamesNL, May 3, 2018
    Last edited: May 3, 2018
  12. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    969
    Likes Received:
    228
    Just so everyone is aware - I'll be testing on the first released version of the obfuscator.
     
  13. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    That's 1.0 right?
     
  14. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    969
    Likes Received:
    228
    Yes.
     
  15. Nicofisi

    Supporter Addon Developer

    Joined:
    Jan 26, 2017
    Messages:
    26
    Likes Received:
    10
    Whyyyy :emoji_frowning: It breaks the fun of updating everything to the latest version
     
  16. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Okay this is my submission for the 1.0 version:
    Language used: Skript
    Addons (I seriously needed 2 for 2 different things):
    • skUtilities (for taking file input)
    • SkQuery (for the new line expression, idk if it's possible in vanilla Skript)
    Input file: plugins/obf.sk
    Command: /decode (will broadcast deobfuscated script so you can also see it in console)
    Code:
    Code (Skript):
    1. options:
    2.     file: plugins/obf.sk
    3.     @: @
    4.            
    5. function getOptions(f: text):
    6.     delete {obf-options::*}
    7.     set {_c::*} to file contents of {_f}
    8.     set {_c} to join {_c::*} with nl
    9.     set {_l::*} to split {_c} at "options:"
    10.     set {_c} to {_l::2}
    11.     delete {_l::*}
    12.     replace every "    " in {_c} with ""
    13.     set {_l::*} to split {_c} at nl
    14.     delete {_l::1}
    15.     loop {_l::*}:
    16.         delete {_s::*}
    17.         set {_s::*} to split loop-value at ": "
    18.         set {obf-options::%{_s::1}%} to {_s::2}
    19.    
    20. function parseOptions(t: text) :: text:
    21.     set {_c::*} to {_t} parsed as "{{@@}%text%}"
    22.     return {_c::1}
    23.  
    24. function obf(t: text) :: text:
    25.     return {obf-options::%{_t}%}
    26.  
    27. function obfDecodeFile() :: text:
    28.     getOptions("{@file}")
    29.     set {_c::*} to file contents of "{@file}"
    30.     set {_c} to join {_c::*} with nl
    31.     set {_l::*} to split {_c} at "options:"
    32.     set {_c} to {_l::2}
    33.     delete {_l::*}
    34.     set {_l::*} to split {_c} at nl
    35.     delete {_l::1}
    36.     loop {_l::*}:
    37.         if loop-value does not contain "    ":
    38.             exit loop
    39.         delete {_l::%loop-index%}
    40.     loop {_l::*}:
    41.         add obfDecodeLine2(loop-value) to {_out::*}
    42.     set {_out} to join {_out::*} with nl
    43.     replace every "    " in {_out} with "    "
    44.     return {_out}
    45.        
    46. command /decode:
    47.     trigger:
    48.         broadcast obfDecodeFile()
    49.  
    50. function obfDecodeLine2(t: text) :: text:
    51.     set {_f} to {_t}
    52.     set {_s::*} to split {_t} at ""
    53.     set {_w} to false
    54.     loop {_s::*}:
    55.         set {_i1} to loop-index parsed as a number
    56.         loop 10 times:
    57.             set {_i%loop-number + 1%} to {_i%loop-number%} + 1
    58.         remove 1 from {_in}
    59.         set {_c} to false
    60.         if loop-value is "{":
    61.             {_w} is false
    62.             {_s::%{_i2}%} is "@"
    63.             set {_in} to 0
    64.             set {_c} to true
    65.             if {_s::%{_i3}%} is "}":
    66.                 set {_in} to 2
    67.             set {_w} to true
    68.             add {_i1} to {_ind::*}
    69.         if loop-value is "}":
    70.             {_w} is true
    71.             {_in} is not 0
    72.             set {_c} to true
    73.             set {_last} to last element out of {_ind::*}
    74.             add subtext of {_t} from characters {_last} to {_i1} to {_l2::*}
    75.             add {_i1} to {_ind::*}
    76.             set {_w} to false
    77.         if {_c} is false:
    78.             {_w} is false
    79.             add loop-value to {_l2::*}
    80.     loop {_l2::*}:
    81.         loop-value contains "@", "{" and "}"
    82.         set {_l2::%loop-index%} to obf(parseOptions(loop-value))
    83.     set {_out} to join {_l2::*} with ""
    84.     replace every "    " in {_out} with "    "
    85.     return {_out}
     
    Pikachu likes this.
  17. TonyMaster21

    Supporter ++ Supporter + Supporter Addon Developer

    Joined:
    Nov 28, 2016
    Messages:
    50
    Likes Received:
    15
    Medals:
    Okay version 1 should also work on my deob
     
  18. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    870
    Likes Received:
    139
    Medals:
    you can remove the reliance on skquery using skutilies sys prop expr
     
  19. Rezz

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    80
    Likes Received:
    37
    Medals:
    #19 Rezz, May 7, 2018
    Last edited by a moderator: May 13, 2021
  20. BaeFell

    BaeFell I'm Poppy
    Admin Supporter

    Joined:
    Nov 27, 2016
    Messages:
    969
    Likes Received:
    228
    Entries close end of today BST!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...