Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function(context, args) { // target:"#s.no.quotes"
  3. // Above, we have set an autocomplete string that will give us a tip on how to use the script while we type it.
  4.  
  5.     var ret = ""                            // "ret", short for return, is declared here beforeand. I use it in this script to
  6.                                             //  store and analyze what the game spits out at me.
  7.  
  8.     var ez = ["open","unlock","release"]    // The "ez" array I define here stores the possibilities for unlocking the EZ_21 lock.
  9.                                             // It's just named "ez" because these same strings are used in all the EZ locks,
  10.                                             // and this can be used in that capacity if you wanted to expand on this script.
  11.  
  12.     var regex = /\N(\wV)\N lock\./          // This is a little trickier. Regular expressions are used to find and extract
  13.                                             // stuff from strings. This in particular finds the part of the game output that
  14.                                             // tells you which lock you're up against next. The game output is something like
  15.                                             // "blah blah blah Hyperion Systems EZ-21 lock." This regex expression will match
  16.                                             // the end of that string and extract the "EZ-21" part. It will also, in fact,
  17.                                             // extract the name of any lock you are up against, not just this specifically.
  18.                                             // You can find out more here:
  19.                                             // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
  20.  
  21.     ret = args.target.call({})              // args.target is used to pull the scriptor you passed to this script with the "target"
  22.                                             // key. ".call" at the end allows us to further pass our own arguments with it. So
  23.                                             // basically if we do something like args.target.call({foo:"bar"}), that's like us
  24.                                             // entering "your.target {foo:"bar"}" into hackmud.
  25.        
  26.     var done = false                        // I use "done" as a boolean that we can switch to "true" when we detect that we have
  27.                                             // cracked our lock. Otherwise, the program will time out or return a failure.
  28.    
  29.     // Ok, here we go.
  30.    
  31.     var lock = regex.exec(ret)                  // Here I use our RegEx from earlier to find the name of the next lock and store it in
  32.                                             // a "lock" variable. This is actually an array because of how RegEx capturing groups
  33.                                             // work.
  34.  
  35.     if (lock[1] == "EZ_21") {               // Here we see if the name we got from our RegEx matches "EZ_21". We compare it
  36.                                             // specifically to key 1 in "lock" (lock[1]) because that's where it will have
  37.                                             // been captured.
  38.  
  39.         for (var i = 0; i < 3; i++) {                   // So if the match is successful, we begin brute-forcing the lock.
  40.             ret = args.target.call({ez_21: ez[i]})      // We use a for loop and our variable "i" we use to iterate through
  41.                                                         // our "ez" array from earlier. We use a call and send our target
  42.                                                         // an argument {ez_21:"<etc>"} each time we loop, and put the return
  43.                                                         // response in "ret".
  44.  
  45.             if (!ret.includes("LOCK_ERROR")) {          // Each time we run the loop, we want to check if the target responds
  46.                 done = true                             // that the lock has been cracked. Specifically, we check to see if
  47.                 break;                                  // the response includes the "LOCK_ERROR" string. If not, we
  48.             }                                           // have done it! We flag that we are done and break our of our for loop
  49.         }                                               // to return a "success" string. At this point, the lock has been
  50.     }                                                   // cracked so we end the script.
  51.  
  52.     return {ok:done,msg:"gg fam"}
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement