├── LICENSE ├── README.md └── rocShell.gs /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rocShell 2 | A tool for the game [Grey Hack](https://store.steampowered.com/app/605230/Grey_Hack/). 3 | 4 | Has a built-in text editor. 5 | 6 | I made this with code from [NamelessOS](https://github.com/Nameless9000/NamelessOS) and [Exploit suite 0.9](https://github.com/Darkvalnar/greyscript/blob/master/suite/Exploit%20Suite%200.9.js) 7 | 8 | It has been completely rewrote, if you find any bug, please report to issues. 9 | 10 | credit goes to [Nameless9000](https://github.com/Nameless9000) and [Darkvalnar](https://github.com/Darkvalnar) 11 | 12 | update 20231103: rocShell without api will no longer be updated. rocShell.gs now contains API. Remove it yourself if you dont want to use it. If you use it in singleplayer, API will be disabled automatically. 13 | -------------------------------------------------------------------------------- /rocShell.gs: -------------------------------------------------------------------------------- 1 | //if params[0] != "password_here" then exit //if you need password protection use this line. 2 | 3 | //clear_screen //if you dont like screen to be cleared remove this line 4 | 5 | {"ver":"1.1.1", "api":true} //release. today is huge. 6 | 7 | getCloudExploitAPI = function(metaxploit) //cloud exploit database api. 8 | recursiveCheck = function(anyObject, maxDepth = -1) 9 | if maxDepth == 0 then return true 10 | if @anyObject isa map or @anyObject isa list then 11 | for key in indexes(@anyObject) 12 | if not recursiveCheck(@key, maxDepth - 1) then return false 13 | end for 14 | for val in values(@anyObject) 15 | if not recursiveCheck(@val, maxDepth - 1) then return false 16 | end for 17 | end if 18 | if @anyObject isa funcRef then return false 19 | return true 20 | end function 21 | if typeof(metaxploit) != "MetaxploitLib" then return print("metaxploit required for api to work.") 22 | netSession = metaxploit.net_use(nslookup("www.ExploitDatabase.org"), 80) //connect to server with metaxploit on ssh service 23 | if netSession then metaLib = netSession.dump_lib else metaLib = null 24 | if metaLib then remoteShell = metaLib.overflow("0x292F648B", "yn_dtreedyn_ltree") else remoteShell = null //exploit needed to grab a guest shell to the server 25 | if typeof(remoteShell) != "shell" then print("Server failed. API running in local mode.") 26 | 27 | clearInterface = function(interface) 28 | for k in indexes(interface) 29 | if @k == "classID" or @k == "__isa" then continue 30 | remove(interface, @k) 31 | end for 32 | if not recursiveCheck(@interface) then exit("WARNING, API MAY HAVE BEEN POISONED, ABORTING.") 33 | return null 34 | end function 35 | 36 | api = {} 37 | api.classID = "api" 38 | api.connection = remoteShell 39 | api.metaxploit = metaxploit 40 | api.interface = get_custom_object 41 | 42 | //all api method start 43 | api.testConnection = function(self) //demo method. 44 | clearInterface(self.interface) 45 | if typeof(self.connection) != "shell" then return false 46 | self.interface.ret = null 47 | self.interface.args = ["testConnection"] 48 | self.connection.launch("/interfaces/exploitAPI") 49 | if not hasIndex(self.interface, "ret") then return not (not clearInterface(self.interface)) //not (not) is for casting null to false, false to false, empty set to false, everything else to true. 50 | if @self.interface.ret isa funcRef or @self.interface.ret isa map then return not (not clearInterface(self.interface)) 51 | ret = not (not @self.interface.ret) 52 | clearInterface(self.interface) 53 | return ret 54 | end function 55 | api.scanMetaLib = function(self, metaLib) 56 | clearInterface(self.interface) 57 | self.interface.ret = null 58 | self.interface.args = ["scanMetaLib", metaLib] 59 | if typeof(self.connection) == "shell" then self.connection.launch("/interfaces/exploitAPI") 60 | print("IF YOU SEE ANY WEIRD OUTPUT ABOVE (ESPECIALLY OVERFLOW PROMPT), OR IF YOUR TERMINAL WAS CLEARED (OUTPUT SHOULD ONLY BE A PROGRESS BAR, NOTHING MORE NOTHING LESS), IT MEANS THE SERVER WAS HACKED AND YOU NEED TO STOP USING THIS API RIGHT NOW, AND CONTACT DISCORD:rocketorbit IMMEDIATELY.") 61 | if hasIndex(self.interface, "ret") and @self.interface.ret != null and recursiveCheck(@self.interface.ret) then 62 | ret = @self.interface.ret 63 | clearInterface(self.interface) 64 | return ret 65 | end if 66 | clearInterface(self.interface) 67 | print("Server failed. Using local scan.") 68 | ret = {} 69 | ret.lib_name = lib_name(@metaLib) 70 | ret.version = version(@metaLib) 71 | ret.memorys = {} 72 | memorys = self.metaxploit.scan(@metaLib) 73 | for memory in memorys 74 | addresses = split(self.metaxploit.scan_address(@metaLib, memory), "Unsafe check:") 75 | ret.memorys[memory] = [] 76 | for address in addresses 77 | if address == addresses[0] then continue 78 | value = address[indexOf(address, "") + 3:indexOf(address, "")].replace("\n", "") 79 | ret.memorys[memory] = ret.memorys[memory] + [value] 80 | end for 81 | end for 82 | return ret 83 | end function 84 | api.queryExploit = function(self, libName, libVersion) 85 | clearInterface(self.interface) 86 | if typeof(self.connection) != "shell" then return null 87 | self.interface.ret = null 88 | self.interface.args = ["queryExploit", libName, libVersion] 89 | self.connection.launch("/interfaces/exploitAPI") 90 | if not hasIndex(self.interface, "ret") then return clearInterface(self.interface) 91 | if not recursiveCheck(@self.interface.ret) then return clearInterface(self.interface) 92 | ret = @self.interface.ret 93 | clearInterface(self.interface) 94 | return ret 95 | end function 96 | api.getHashes = function(self) 97 | clearInterface(self.interface) 98 | if typeof(self.connection) != "shell" then return null 99 | self.interface.ret = null 100 | self.interface.args = ["getHashes"] 101 | self.connection.launch("/interfaces/exploitAPI") 102 | if not hasIndex(self.interface, "ret") then return clearInterface(self.interface) 103 | if not recursiveCheck(@self.interface.ret) then return clearInterface(self.interface) 104 | ret = @self.interface.ret 105 | clearInterface(self.interface) 106 | return ret 107 | end function 108 | //all api method end 109 | 110 | if not api.testConnection then print("unable to reach server. API is in local mode.") 111 | 112 | return api 113 | end function 114 | getRshellAPI = function(metaxploit) 115 | recursiveCheck = function(anyObject, maxDepth = -1) 116 | if maxDepth == 0 then return true 117 | if @anyObject isa map or @anyObject isa list then 118 | for key in indexes(@anyObject) 119 | if not recursiveCheck(@key, maxDepth - 1) then return false 120 | end for 121 | for val in values(@anyObject) 122 | if not recursiveCheck(@val, maxDepth - 1) then return false 123 | end for 124 | end if 125 | if @anyObject isa funcRef then return false 126 | return true 127 | end function 128 | if typeof(metaxploit) != "MetaxploitLib" then return print("metaxploit required for api to work.") 129 | netSession = metaxploit.net_use(nslookup("www.OpenRshell.org"), 80) //connect to server with metaxploit on ssh service 130 | if netSession then metaLib = netSession.dump_lib else metaLib = null 131 | if metaLib then remoteShell = metaLib.overflow("0x292F648B", "yn_dtreedyn_ltree") else remoteShell = null //exploit needed to grab a guest shell to the server 132 | if typeof(remoteShell) != "shell" then print("Server failed. API running in local mode.") 133 | 134 | clearInterface = function(interface) 135 | for k in indexes(interface) 136 | if @k == "classID" or @k == "__isa" then continue 137 | remove(interface, @k) 138 | end for 139 | if not recursiveCheck(@interface) then exit("WARNING, API MAY HAVE BEEN POISONED, ABORTING.") 140 | return null 141 | end function 142 | 143 | api = {} 144 | api.classID = "api" 145 | api.connection = remoteShell 146 | api.metaxploit = metaxploit 147 | api.interface = get_custom_object 148 | 149 | //all api method start 150 | api.testConnection = function(self) //demo method. 151 | clearInterface(self.interface) 152 | if typeof(self.connection) != "shell" then return false 153 | self.interface.ret = null 154 | self.interface.args = ["testConnection"] 155 | self.connection.launch("/interfaces/rshellAPI") 156 | if not hasIndex(self.interface, "ret") then return not (not clearInterface(self.interface)) //not (not) is for casting null to false, false to false, empty set to false, everything else to true. 157 | if @self.interface.ret isa funcRef or @self.interface.ret isa map then return not (not clearInterface(self.interface)) 158 | ret = not (not @self.interface.ret) 159 | clearInterface(self.interface) 160 | return ret 161 | end function 162 | api.getRshells = function(self, publicIp) 163 | clearInterface(self.interface) 164 | if typeof(self.connection) != "shell" then return null 165 | self.interface.ret = null 166 | self.interface.args = ["getRshells", publicIp] 167 | self.connection.launch("/interfaces/rshellAPI") 168 | if not hasIndex(self.interface, "ret") then return clearInterface(self.interface) 169 | if @self.interface.ret isa map then return clearInterface(self.interface) 170 | if not recursiveCheck(@self.interface.ret, 3) then return clearInterface(self.interface) //this is for shell object back passing only. do not access its method, when using the shell object, use host_computer(@shell) instead of shell.host_computer! 171 | ret = @self.interface.ret 172 | if ret isa list then 173 | for shell in ret 174 | if not host_computer(@shell) then return clearInterface(self.interface) 175 | end for 176 | else 177 | if not recursiveCheck(ret) then return clearInterface(self.interface) 178 | end if 179 | clearInterface(self.interface) 180 | return ret 181 | end function 182 | //all api method end 183 | 184 | if not api.testConnection then print("unable to reach server. API is in local mode.") 185 | 186 | return api 187 | end function 188 | 189 | local = {} 190 | local.shell = get_shell 191 | local.computer = get_shell.host_computer 192 | local.folder = local.computer.File(current_path) 193 | local.router = get_router 194 | local.user = active_user 195 | local.lanIp = get_shell.host_computer.local_ip 196 | local.publicIp = get_router.public_ip 197 | local.isLocal = true 198 | 199 | if not local.computer.is_network_active then print("No internet access.") 200 | 201 | aptclient = include_lib(current_path + "/aptclient.so") 202 | if not aptclient then aptclient = include_lib("/lib/aptclient.so") 203 | if not aptclient then print("missing lib apiclient.so in lib or current path") 204 | blockchain = include_lib(current_path + "/blockchain.so") 205 | if not blockchain then blockchain = include_lib("/lib/blockchain.so") 206 | if not blockchain then print("missing lib blockchain.so in lib or current path") 207 | crypto = include_lib(current_path + "/crypto.so") 208 | if not crypto then crypto = include_lib("/lib/crypto.so") 209 | if not crypto then print("missing lib crypto.so in lib or current path") 210 | metaxploit = include_lib(current_path + "/metaxploit.so") 211 | if not metaxploit then metaxploit = include_lib("/lib/metaxploit.so") 212 | if not metaxploit then print("missing lib metaxploit.so in lib or current path") 213 | 214 | api = getCloudExploitAPI(metaxploit) 215 | if api then hashMap = api.getHashes else hashMap = null //hashMap is not a HashMap, it is a map of hashes :) 216 | if not hashMap then hashMap = {} 217 | 218 | rshellAPI = getRshellAPI(metaxploit) 219 | 220 | current = {} 221 | current.obj = local.shell 222 | current.computer = function 223 | if typeof(current.obj) == "shell" then return current.obj.host_computer 224 | if typeof(current.obj) == "computer" then return current.obj 225 | return null 226 | end function 227 | current.router = local.router 228 | current.folder = local.folder 229 | current.user = local.user 230 | current.lanIp = local.lanIp 231 | current.publicIp = function 232 | return current.router.public_ip 233 | end function 234 | current.isLocal = local.isLocal 235 | current.compName = function 236 | if typeof(current.obj) == "shell" then return current.obj.host_computer.get_name 237 | if typeof(current.obj) == "computer" then return current.obj.get_name 238 | return "FILE" 239 | end function 240 | 241 | objects = [] 242 | 243 | libs = {} 244 | libs.absolutePath = function(rPath, cPath) //current path + relative path = absolute path 245 | if rPath.len == 0 then return print("invalid path.") 246 | if rPath[0] == "/" then return rPath 247 | if cPath.len == 0 then return print("invalid path.") 248 | if not cPath[0] == "/" then return print("invalid path.") 249 | if not cPath[-1] == "/" then cPath = cPath + "/" 250 | absPath = cPath + rPath 251 | while absPath.len > 1 and absPath[-1] == "/" 252 | absPath = absPath[:-1] 253 | end while 254 | return absPath 255 | end function 256 | libs.changeDir = function(toPath, fileObject) //go to another dir 257 | if not fileObject then fileObject = globals.current.folder 258 | while fileObject.parent 259 | fileObject = fileObject.parent 260 | end while 261 | if toPath.len == 0 then return print("File not found.") 262 | while (toPath.len > 1) and (toPath[-1] == "/") //trim end "/" 263 | toPath = toPath[:-1] 264 | end while 265 | while (toPath.len > 1) and (toPath[0] == "/") //trim start "/" 266 | toPath = toPath[1:] 267 | end while 268 | if toPath == "/" then return fileObject 269 | toPath = toPath.split("/") 270 | for p in toPath 271 | found = false 272 | for f in fileObject.get_folders 273 | if not f.name == p then continue 274 | found = true 275 | fileObject = f 276 | break 277 | end for 278 | if not found then return print("Folder not found.") 279 | end for 280 | if not fileObject.is_folder then return print("Folder not found.") 281 | return fileObject 282 | end function 283 | libs.getFile = function(toPath, fileObject) //changeDir only support folder but this works for both 284 | if not fileObject then fileObject = globals.current.folder 285 | while fileObject.parent 286 | fileObject = fileObject.parent 287 | end while 288 | if toPath.len == 0 then return print("File not found.") 289 | while (toPath.len > 1) and (toPath[-1] == "/") //trim end "/" 290 | toPath = toPath[:-1] 291 | end while 292 | while (toPath.len > 1) and (toPath[0] == "/") //trim start "/" 293 | toPath = toPath[1:] 294 | end while 295 | if toPath == "/" then return fileObject 296 | toPath = toPath.split("/") 297 | for i in toPath.indexes 298 | found = false 299 | if i == (toPath.len - 1) then 300 | for f in fileObject.get_folders + fileObject.get_files 301 | if not f.name == toPath[i] then continue 302 | return f 303 | end for 304 | return print("File not found") 305 | end if 306 | for f in fileObject.get_folders 307 | if not f.name == toPath[i] then continue 308 | found = true 309 | fileObject = f 310 | break 311 | end for 312 | if not found then return print("File not found.") 313 | end for 314 | return fileObject 315 | end function 316 | libs.allFiles = function(fileObject, maxDepth = -1) 317 | if fileObject.is_folder then total = {"ret":[fileObject], "stack":[maxDepth, fileObject]} else return [fileObject] 318 | while total.stack 319 | c = {"folder":total.stack.pop, "maxDepth":total.stack.pop} 320 | if c.maxDepth then total.ret = total.ret + c.folder.get_folders + c.folder.get_files else continue 321 | folders = c.folder.get_folders 322 | for i in range(len(folders) - 1) 323 | if folders then [total.stack.push(c.maxDepth - 1), total.stack.push(folders[i])] else break 324 | end for 325 | end while 326 | return total.ret 327 | end function 328 | libs.find = function(fileName, fileObject) //find files under a dir 329 | founded = [] 330 | files = self.allFiles(fileObject) 331 | for file in files 332 | if lower(file.name).indexOf(lower(fileName)) != null then founded = founded + [file] 333 | end for 334 | return founded 335 | end function 336 | libs.toFile = function(anyObject) 337 | if typeof(anyObject) == "shell" then return anyObject.host_computer.File("/") 338 | if typeof(anyObject) == "computer" then return anyObject.File("/") 339 | if typeof(anyObject) == "file" then 340 | while anyObject.parent 341 | anyObject = anyObject.parent 342 | end while 343 | return anyObject 344 | end if 345 | return null 346 | end function 347 | libs.checkAccess = function(fileObject) //check perm for npc machine 348 | if not typeof(fileObject) == "file" then return null 349 | while fileObject.parent 350 | fileObject = fileObject.parent 351 | end while 352 | homeFolder = null 353 | for folder in fileObject.get_folders 354 | if folder.name == "root" then 355 | if folder.has_permission("w") and folder.has_permission("r") and folder.has_permission("x") then return "root" 356 | end if 357 | if folder.name == "home" then 358 | homeFolder = folder 359 | end if 360 | end for 361 | if not homeFolder then return "guest" 362 | for folder in homeFolder.get_folders 363 | if folder.name == "guest" then continue 364 | if folder.has_permission("w") and folder.has_permission("r") and folder.has_permission("x") then return folder.name 365 | end for 366 | return "guest" 367 | end function 368 | libs.checkIp = function(anyObject, targetIp, targetPort, currentRouter) 369 | if typeof(anyObject) != "shell" and typeof(anyObject) != "computer" and typeof(anyObject) != "file" then return null 370 | if not is_valid_ip(targetIp) then return null 371 | if typeof(targetPort) != "number" then return null 372 | if typeof(currentRouter) != "router" then return null 373 | if typeof(anyObject) == "shell" then return {"localIp":anyObject.host_computer.local_ip, "publicIp":anyObject.host_computer.public_ip, "router":get_router(anyObject.host_computer.public_ip)} 374 | if typeof(anyObject) == "computer" then return {"localIp":anyObject.local_ip, "publicIp":anyObject.public_ip, "router":get_router(anyObject.public_ip)} 375 | if is_lan_ip(targetIp) then return {"localIp":targetIp, "publicIp":currentRouter.public_ip, "router":currentRouter} 376 | targetRouter = get_router(targetIp) 377 | if not targetRouter then return null 378 | targetPortObject = targetRouter.ping_port(targetPort) 379 | if targetPortObject then return {"localIp":targetPortObject.get_lan_ip, "publicIp":targetIp, "router":targetRouter} 380 | return {"localIp":targetRouter.local_ip, "publicIp":targetIp, "router":targetRouter} 381 | end function 382 | libs.corruptLog = function(fileObject) //overwrite system.log by copy the smallest file to that dir 383 | if not fileObject then fileObject = current.folder 384 | while fileObject.parent 385 | fileObject = fileObject.parent 386 | end while 387 | files = self.allFiles(fileObject, 3) 388 | toCopy = null 389 | for file in files 390 | if file.is_folder or (not file.has_permission("r")) then continue 391 | if not toCopy then toCopy = file 392 | if val(file.size) < val(toCopy.size) then toCopy = file 393 | end for 394 | if not toCopy then return print("No file to overwrite log! try using ""touch"".") 395 | logFile = self.getFile("/var/system.log", fileObject) 396 | if not logFile then return print("log file not found!") 397 | tryDelete = logFile.delete 398 | if tryDelete == "" then print("Log file deleted.") else return print("Error: " + tryDelete) 399 | tryCopy = toCopy.copy("/var", "system.log") 400 | if tryCopy == true then return print("All steps done. Log cleared.") 401 | return print(tryCopy) 402 | end function 403 | libs.fileSize = function(bytes) //translate byte to kb and mb 404 | bytes = bytes.to_int 405 | i = 0 406 | units = ["B","KB","MB","GB","TB","PT"] 407 | while bytes > 1024 408 | bytes = bytes / 1024 409 | i = i + 1 410 | end while 411 | return round(bytes, 2) + units[i] 412 | end function 413 | libs.scanLib = function(metaLib, metaxploit) 414 | if not metaLib then return null 415 | if not metaxploit then metaxploit = globals.metaxploit 416 | ret = {} 417 | ret.lib_name = metaLib.lib_name 418 | ret.version = metaLib.version 419 | ret.memorys = {} 420 | memorys = metaxploit.scan(metaLib) 421 | for memory in memorys 422 | addresses = metaxploit.scan_address(metaLib, memory).split("Unsafe check:") 423 | ret.memorys[memory] = [] 424 | for address in addresses 425 | if address == addresses[0] then continue 426 | value = address[address.indexOf("")+3:address.indexOf("")] 427 | value = value.replace("\n", "") 428 | ret.memorys[memory] = ret.memorys[memory] + [value] 429 | end for 430 | end for 431 | return ret 432 | end function 433 | libs.typeofFile = function(fileObject) 434 | if not typeof(fileObject) == "file" then return null 435 | if fileObject.is_folder then return "fld" 436 | if fileObject.is_binary then return "bin" 437 | return "txt" 438 | end function 439 | libs.bruteforce = function(length, charset, username) 440 | toDo = [""] 441 | while toDo 442 | item = toDo.pop 443 | for chr in charset 444 | newItem = item + chr 445 | if get_shell(username, newItem) then return get_shell(username, newItem) 446 | if newItem.len < length then toDo.push(newItem) 447 | end for 448 | end while 449 | return null 450 | end function 451 | 452 | computerCommands = {} 453 | computerCommands["ps"] = {"name":"ps", "description":"List processes running.", "args":""} 454 | computerCommands["ps"]["run"] = function(args) 455 | computer = current.computer 456 | procs = computer.show_procs 457 | procs = procs.split("\n") 458 | output = "" 459 | for proc in procs 460 | val = proc.split(" ") 461 | if val[0] == "USER" then continue 462 | output = output + "\n" + "[" + val[0] + "] (" + val[1] + ") " + val[4] + " " + "CPU: [" + val[2] + "] " + "MEM: [" + val[3] + "]" 463 | end for 464 | return print(format_columns(output) + "\n") 465 | end function 466 | computerCommands["kill"] = {"name":"kill", "description":"Kill a process.", "args":"[PID]"} 467 | computerCommands["kill"]["run"] = function(args) 468 | if args.len < 1 then return print("Usage: kill [PID]") 469 | PID = args[0].to_int 470 | if typeof(PID) != "number" then return print("The PID must be a number.") 471 | computer = current.computer 472 | output = computer.close_program(PID) //close PID 473 | if output == true then return print("Process " + PID + " closed") 474 | if output then return print(output) 475 | return print("Process " + PID + " not found") 476 | end function 477 | computerCommands["touch"] = {"name":"touch", "description":"Create a text file.", "args":"[file_path]"} 478 | computerCommands["touch"]["run"] = function(args) 479 | if args.len < 1 then return print("Usage: touch [file_name]") 480 | path = libs.absolutePath(args[0], current.folder.path) 481 | if path == null then return print("path not found") 482 | parent = parent_path(path) 483 | name = path.split("/")[-1] 484 | doTouch = current.computer.touch(parent, name) 485 | if doTouch == true then return print("Done.") 486 | print(doTouch) 487 | return print("Failed.") 488 | end function 489 | computerCommands["mkdir"] = {"name":"mkdir", "description":"Create a empty folder.", "args":"[folder_path]"} 490 | computerCommands["mkdir"]["run"] = function(args) 491 | if args.len < 1 then return print("Usage: mkdir [folder_path]") 492 | path = libs.absolutePath(args[0], current.folder.path) 493 | if path == null then return print("path not found") 494 | parent = parent_path(path) 495 | name = path.split("/")[-1] 496 | doMkdir = current.computer.create_folder(parent, name) 497 | if doMkdir == true then return print("Done.") 498 | print(doMkdir) 499 | return print("Failed.") 500 | end function 501 | computerCommands["netinfo"] = {"name":"netinfo", "description":"Display net info", "args":""} 502 | computerCommands["netinfo"]["run"] = function(args) 503 | computer = current.computer 504 | print(computer.public_ip) 505 | print(computer.local_ip) 506 | print(computer.active_net_card) 507 | if computer.active_net_card == "WIFI" then 508 | netcards = computer.network_devices 509 | for netcard in netcards.split(char(10)) 510 | interface = netcard.split(" ")[0] 511 | print(interface) 512 | for wifi in computer.wifi_networks(interface) 513 | print(wifi) 514 | end for 515 | end for 516 | end if 517 | return null 518 | end function 519 | computerCommands["useradd"] = {"name":"useradd", "description":"Create a user.", "args":"[new_user]"} 520 | computerCommands["useradd"]["run"] = function(args) 521 | if args.len < 1 then return print("Usage: useradd [new_user]") 522 | pass = user_input("Setting password for user " + args[0] + ".\nNew password: ", true) 523 | computer = current.computer 524 | output = computer.create_user(args[0], pass) 525 | if output == true then return print("User created OK") 526 | if output then return print(output) 527 | return print("Error: the user could not be created.") 528 | end function 529 | computerCommands["userdel"] = {"name":"userdel", "description":"Delete a user.", "args":"[(opt) -r][user]"} 530 | computerCommands["userdel"]["run"] = function(args) 531 | if args.len < 1 then return print("Usage: userdel [(opt) -r][user]") 532 | del = 0 533 | if args.len >= 2 and args[0] == "-r" then 534 | del = 1 535 | args.pull 536 | end if 537 | computer = current.computer 538 | output = computer.delete_user(args[0], del) 539 | if output == true then return print("user " + args[0] + " deleted.") 540 | if output then return print(output) 541 | return print("Error: user not deleted.") 542 | end function 543 | computerCommands["passwd"] = {"name":"passwd", "description":"Change password for a user.", "args":"[user]"} 544 | computerCommands["passwd"]["run"] = function(args) 545 | if args.len < 1 then return print("Usage: passwd [user]") 546 | computer = current.computer 547 | pass = user_input("Changing password for user " + args[0] +".\nNew password:", true) 548 | output = computer.change_password(args[0], pass) 549 | if output == true then return print("password modified OK") 550 | if output then return print(output) 551 | return print("Error: password not modified") 552 | end function 553 | computerCommands["groups"] = {"name":"groups", "description":"Get groups for a user.", "args":"[user]"} 554 | computerCommands["groups"]["run"] = function(args) 555 | if args.len < 1 then return print("Usage: groups [user]") 556 | computer = current.computer 557 | output = computer.groups(args[0]) 558 | if not output then return print("Usage: groups [user]") 559 | return print(output) 560 | end function 561 | computerCommands["groupadd"] = {"name":"groupadd", "description":"Add a group to a user.", "args":"[user] [group]"} 562 | computerCommands["groupadd"]["run"] = function(args) 563 | if args.len < 2 then return print("Usage: groupadd [user] [group]") 564 | computer = current.computer 565 | output = computer.create_group(args[0], args[1]) 566 | if output == true then return print("Group " + args[1] + " added to user " + args[0]) 567 | if output then return print(output) 568 | return print("Error: the group could not be created.") 569 | end function 570 | computerCommands["groupdel"] = {"name":"groupdel", "description":"Delete a group from a user.", "args":"[user] [group]"} 571 | computerCommands["groupdel"]["run"] = function(args) 572 | if args.len < 2 then return print("Usage: groupdel [user] [group]") 573 | computer = current.computer 574 | output = computer.delete_group(args[0], args[1]) 575 | if output == true then return print("Group " + args[1] + " deleted from user " + args[0]) 576 | if output then return print(output) 577 | return print("Error: the group could not be deleted.") 578 | end function 579 | computerCommands["wifi"] = {"name":"wifi", "description":"Connect Wifi.", "args":"[device] [bssid] [essid] [password]"} 580 | computerCommands["wifi"]["run"] = function(args) 581 | if args.len < 4 then return print("Usage: wifi [device] [bssid] [essid] [password]") 582 | computer = current.computer 583 | return print(computer.connect_wifi(args[0], args[1], args[2], args[3])) 584 | end function 585 | 586 | shellCommands = {} 587 | shellCommands["shell"] = {"name":"shell", "description":"Starts terminal. Watch out for active traces.", "args":""} 588 | shellCommands["shell"]["run"] = function(args) 589 | return current.obj.start_terminal 590 | end function 591 | shellCommands["ssh"] = {"name":"ssh", "description":"Connect to a ssh service. I hate ftp.", "args":"[user@password] [ip] [(opt) port]"} 592 | shellCommands["ssh"]["run"] = function(args) 593 | if args.len < 2 then return print("usage: ssh [user@password] [ip] [(opt) port]") 594 | sshUser = args[0].split("@")[0] 595 | sshPass = args[0].split("@")[1] 596 | sshIp = args[1] 597 | if args.len > 2 then port = args[2].to_int else port = 22 598 | if not port isa number then return print("Invalid port.") 599 | localShell = current.obj 600 | remoteShell = localShell.connect_service(sshIp, port, sshUser, sshPass, "ssh") 601 | if not typeof(remoteShell) == "shell" then 602 | print(remoteShell) 603 | return print("Connection failed.") 604 | end if 605 | if sshUser == "root" then homePath = "/root" else homePath = "/home/" + sshUser 606 | globals.current.obj = remoteShell 607 | globals.current.folder = remoteShell.host_computer.File(homePath) 608 | globals.current.user = sshUser 609 | if not is_lan_ip(sshIp) then globals.current.router = get_router(sshIp) 610 | globals.current.lanIp = remoteShell.host_computer.local_ip 611 | globals.objects.push({"object":remoteShell, "user":libs.checkAccess(libs.toFile(remoteShell)), "localIp":remoteShell.host_computer.local_ip, "publicIp":remoteShell.host_computer.public_ip, "router":get_router(sshIp)}) 612 | return print("Connected.") 613 | end function 614 | shellCommands["brutessh"] = {"name":"brutessh", "description":"Bruteforce a ssh with a NPC password list.", "args":"[user] [ip] [(opt) port]"} 615 | shellCommands["brutessh"]["run"] = function(args) 616 | if args.len < 2 then return print("brutessh [user] [ip] [(opt) port]") 617 | if args.len > 2 then port = to_int(args[2]) else port = 22 618 | if typeof(port) != "number" then return print("port invalid.") 619 | user = args[0] 620 | ip = args[1] 621 | for pas in hashMap.values 622 | result = current.obj.connect_service(ip, port, user, pas) 623 | if typeof(result) != "shell" then continue 624 | globals.objects.push({"object":result, "user":libs.checkAccess(libs.toFile(result)), "localIp":result.host_computer.local_ip, "publicIp":result.host_computer.public_ip, "router":get_router(ip)}) 625 | return print("Password found! " + usr + ":" + pas) 626 | end for 627 | return print("Failed.") 628 | end function 629 | shellCommands["up"] = {"name":"up", "description":"Upload a file. Only take absolute path.", "args":"[local_file_path] [remote_path]"} 630 | shellCommands["up"]["run"] = function(args) 631 | if args.len < 2 then return print("Usage: up [local_file_path] [remote_path].") 632 | localShell = local.shell 633 | remoteShell = current.obj 634 | pathFrom = args[0] 635 | pathTo = args[1] 636 | fileFrom = globals.local.computer.File(pathFrom) //get file 637 | folderTo = globals.current.obj.host_computer.File(pathTo) //get folder 638 | if not folderTo then return print("Remote directory not found.") //check if folder exists 639 | if not folderTo.is_folder then return print("Remote directory not found.") //check if folder exists 640 | if not fileFrom then return print("Local file not found: " + pathFrom) //not found print error msg 641 | print("Uploading file: " + fileFrom.name + " to: " + pathTo) //found print target path 642 | upload = localShell.scp(pathFrom, pathTo, remoteShell) //func call as upload 643 | if not typeof(upload) == "string" then return print("File uploaded successfully.") 644 | return print(upload) 645 | end function 646 | shellCommands["dl"] = {"name":"dl", "description":"download a file.", "args":"[remote_file_path] [local_path]"} 647 | shellCommands["dl"]["run"] = function(args) 648 | localShell = local.shell 649 | remoteShell = current.obj 650 | if args.len < 2 then return print("Usage: dl [remote_file_path] [local_path].") 651 | pathFrom = args[0] 652 | pathTo = args[1] 653 | fileFrom = globals.current.obj.host_computer.File(pathFrom)//get file 654 | folderTo = globals.local.computer.File(pathTo) //get folder 655 | if not folderTo then return print("Local directory not found.") //check if folder exists 656 | if not folderTo.is_folder then return print("Local directory not found.") //check if folder exists 657 | if not fileFrom then return print("Remote file not found: " + pathFrom) //not found print error msg 658 | print("Downloading file: " + fileFrom.name + " to: " + pathTo) //found print target path 659 | download = remoteShell.scp(pathFrom, pathTo, localShell) //func call as download 660 | if not typeof(download) == "string" then return print("File uploaded successfully.") 661 | return print(download) 662 | end function 663 | shellCommands["run"] = {"name":"run", "description":"Execute a program.", "args":"[path] [(opt) params]"} 664 | shellCommands["run"]["run"] = function(args) 665 | if args.len < 1 then return print("Program not found") 666 | return current.obj.launch(args[0], args[1:].join(" ")) 667 | end function 668 | shellCommands["ping"] = {"name":"ping", "description":"Ping a ip.", "args":"[ip]"} 669 | shellCommands["ping"]["run"] = function(args) 670 | if args.len < 1 then return print("Invalid ip.") 671 | result = current.obj.ping(params[0]) 672 | if result then 673 | if typeof(result) == "string" then 674 | print(result) 675 | else 676 | print("Ping successful") 677 | end if 678 | else 679 | print("ip unreachable"); 680 | end if 681 | return true 682 | end function 683 | shellCommands["build"] = {"name":"build", "description":"Compile a program.", "args":"[source_path] [to_path] [(opt) allow_import]"} 684 | shellCommands["build"]["run"] = function(args) 685 | if args.len < 2 then return print("Path invalid.") 686 | allowedImport = false 687 | if args.len > 2 then 688 | if (args[2].lower == "true") or (args[2].to_int == 1) then allowedImport = true 689 | end if 690 | return print(current.obj.build(args[0], args[1], allowedImport)) 691 | end function 692 | shellCommands["jump"] = {"name":"jump", "description":"Remote payload execute. Advanced feature, run with no argument to get a special help msg.", "args":"[compile/upload] [remote_path] [params] [(opt) --custom_payload [local_path]]"} 693 | shellCommands["jump"]["run"] = function(args) 694 | if not args then 695 | print("You can sudo without using ""shell"" command, try ""jump compile /home/guest sudo root [password]"".") 696 | print("You can local exploit without using ""shell"" command, try ""up [metaxploit_path] /home/guest/metaxploit.so"" and then ""jump compile /home/guest exploit [lib_path]"".") 697 | print("Dont use --custom_payload flag or upload mode if you dont know what you are doing.") 698 | return null 699 | end if 700 | if args[0] != "compile" and args[0] != "upload" then return print("mode can only be compile or upload.") 701 | if args.len < 2 then return print("Missing remote path.") 702 | custom_payload = args.indexOf("--custom_payload") 703 | payload = "//code start 704 | interface = get_custom_object 705 | if params.len < 1 then exit(""[sudo/exploit] [user/lib_path] [pass]"") 706 | if params[0] == ""sudo"" then 707 | if params.len < 3 then exit(""sudo mode need username and password."") 708 | interface.shell = get_shell(params[1], params[2]) 709 | exit({""shell"":""Done."", ""null"":""invalid user/pass.""}[typeof(interface.shell)]) 710 | else if params[0] == ""exploit"" then 711 | if params.len < 2 then exit(""exploit mode need lib path."") 712 | metaxploit = include_lib(current_path + ""/metaxploit.so"") 713 | if not metaxploit then metaxploit = include_lib(""/lib/metaxploit.so"") 714 | if not metaxploit then exit(""metaxploit.so not found"") 715 | metaLib = metaxploit.load(params[1]) 716 | if not metaLib then exit(""lib not found."") 717 | interface.metaLib = metaLib 718 | exit(""Done."") 719 | else 720 | exit(""[sudo/exploit] [user/lib_path] [pass]"") 721 | end if 722 | //code end" 723 | if custom_payload != null then 724 | if custom_payload == args.len - 1 then return print("Provided flag ""--custom_payload"" without providing payload path.") 725 | payloadFile = local.computer.File(args[custom_payload + 1]) 726 | if not payloadFile then return print("custom payload file not found.") 727 | if payloadFile.is_folder then return print("custom payload can not be folder.") 728 | if payloadFile.is_binary and args[0] == "compile" then return print("Got binary when mode ""compile"" was provided.") 729 | if (not payloadFile.is_binary) and args[0] == "upload" then return print("Got text when mode ""upload"" was provided.") 730 | if args[0] == "compile" then payload = payloadFile.get_content else payload = null 731 | args = args[:custom_payload] 732 | end if 733 | if payload == null then 734 | tryUpload = local.shell.scp(payloadFile.path, arg[1] + "/.", current.obj) 735 | if not typeof(tryUpload) == "string" then print("Payload uploaded successfully.") 736 | return print("Payload upload failed: " + tryUpload) 737 | end if 738 | if payload then 739 | current.computer.touch(args[1], "..src") 740 | payloadFile = current.computer.File(args[1] + "/..src") 741 | if not payloadFile then return print("compile failed.") 742 | payloadFile.set_content(payload) 743 | current.obj.build(payloadFile.path, parent_path(payloadFile.path)) 744 | end if 745 | current.obj.launch(args[1] + "/.", args[2:].join(" ")) 746 | interface = get_custom_object 747 | for unsecureVariables in interface 748 | if @unsecureVariables["key"] == "__isa" or @unsecureVariables["key"] == "classID" then continue 749 | if version(@unsecureVariables["value"]) then 750 | metaLib = @unsecureVariables["value"] 751 | exploits = libs.scanLib(metaLib, metaxploit) //This is the full local version. 752 | injectArg = user_input("inject password: ") 753 | for e in exploits.memorys 754 | print("" + e.key + "") 755 | for value in e.value 756 | print(char(9) + "" + value + "") 757 | object = metaLib.overflow(e.key, value, injectArg) 758 | if (typeof(object) != "shell") and (typeof(object) != "computer") and (typeof(object) != "file") then continue 759 | result = {"object":object, "user":libs.checkAccess(libs.toFile(object)), "addr":e.key, "valn":value, "localIp":current.lanIp, "publicIp":current.publicIp, "router":current.router} 760 | objects.push(result) 761 | end for 762 | end for 763 | end if 764 | if host_computer(@unsecureVariables["value"]) or File(@unsecureVariables["value"], "/") or (size(@unsecureVariables["value"]) != null) then globals.objects.push({"object":unsecureVariables["value"], "user":libs.checkAccess(libs.toFile(unsecureVariables["value"])), "localIp":current.lanIp, "publicIp":current.publicIp, "router":current.router}) 765 | end for 766 | return null 767 | end function 768 | 769 | commands = {} 770 | commands["re"] = {"name":"re", "description":"Remote attack.", "args":"[ip] [port] [(opt) injectArg]"} 771 | commands["re"]["run"] = function(args) 772 | if not current.isLocal then return print("metaxploit based commands only works when running from local.") 773 | if args.len < 2 then return print("Usage: re [ip] [port] [(opt) injectArg]") 774 | targetIp = args[0] 775 | if not is_valid_ip(targetIp) then targetIp = nslookup(targetIp) 776 | if not is_valid_ip(targetIp) then return print("Invalid ip.") 777 | targetPort = args[1].to_int 778 | if args.len > 2 then injectArg = args[2] else injectArg = "" 779 | netSession = metaxploit.net_use(targetIp, targetPort) 780 | netSession = metaxploit.net_use(targetIp, targetPort) //this extra line is for some game mechanics 781 | if not netSession then return print("Unable to make net session.") 782 | metaLib = netSession.dump_lib 783 | if not metaLib then return print("Unable to dump lib.") 784 | forceLocal = false 785 | while true 786 | exploits = api.queryExploit(metaLib.lib_name, metaLib.version) //Request exploit from cloud database API 787 | //exploits = libs.scanLib(metaLib, metaxploit) //This is the full local version. 788 | if (not exploits) or forceLocal then 789 | exploits = api.scanMetaLib(metaLib) //Scan for exploit and send to cloud database thru API 790 | forceLocal = true 791 | end if 792 | if not exploits then return print("Unable to scan for exploits.") 793 | results = [] 794 | for e in exploits.memorys 795 | print("" + e.key + "") 796 | for value in e.value 797 | print(char(9) + "" + value + "") 798 | object = metaLib.overflow(e.key, value, injectArg) 799 | if (typeof(object) != "shell") and (typeof(object) != "computer") and (typeof(object) != "file") then continue 800 | ips = libs.checkIp(object, targetIp, targetPort, current.router) 801 | if not ips then continue 802 | result = {"object":object, "user":libs.checkAccess(libs.toFile(object)), "addr":e.key, "valn":value, "localIp":ips.localIp, "publicIp":ips.publicIp, "router":ips.router} 803 | results.push(result) 804 | end for 805 | end for 806 | toPrint = "" 807 | for result in results 808 | globals.objects.push(result) 809 | toPrint = toPrint + result.user + ":" + typeof(result.object) + " " + result.publicIp + " " + result.localIp + " " + result.addr + " " + result.valn + char(10) 810 | end for 811 | print(format_columns(toPrint)) 812 | print("Type ""objects"" command to use exploit.") 813 | if not forceLocal then 814 | print("Perform a force local scan may find more exploits.") 815 | select = user_input("Enter ""f"" to force a local scan> ", false, true) 816 | if not lower(select) == "f" then break 817 | forceLocal = true 818 | continue 819 | end if 820 | break 821 | end while 822 | return null 823 | end function 824 | commands["lo"] = {"name":"lo", "description":"Local attack.", "args":"[lib_path] [(opt) injectArg]"} 825 | commands["lo"]["run"] = function(args) 826 | if not current.isLocal then return print("metaxploit based commands only works when running from local.") 827 | if args.len < 1 then return print("Usage: lo [lib_path] [(opt) injectArg]") 828 | targetPath = args[0] 829 | if args.len > 1 then injectArg = args[1] else injectArg = "" 830 | metaLib = metaxploit.load(targetPath) 831 | if not metaLib then return print("Unable to load lib.") 832 | forceLocal = false 833 | while true 834 | exploits = api.queryExploit(metaLib.lib_name, metaLib.version) //Request exploit from cloud database API 835 | //exploits = libs.scanLib(metaLib, metaxploit) //This is the full local version. 836 | if (not exploits) or forceLocal then 837 | exploits = api.scanMetaLib(metaLib) //Scan for exploit and send to cloud database thru API 838 | forceLocal = true 839 | end if 840 | if not exploits then return print("Unable to scan for exploits.") 841 | results = [] 842 | for e in exploits.memorys 843 | print("" + e.key + "") 844 | for value in e.value 845 | print(char(9) + "" + value + "") 846 | object = metaLib.overflow(e.key, value, injectArg) 847 | if (typeof(object) != "shell") and (typeof(object) != "computer") and (typeof(object) != "file") then continue 848 | if typeof(object) == "shell" then localIp = object.host_computer.local_ip 849 | if typeof(object) == "computer" then localIp = object.local_ip 850 | if typeof(object) == "file" then localIp = current.lanIp 851 | result = {"object":object, "user":libs.checkAccess(libs.toFile(object)), "addr":e.key, "valn":value, "localIp":localIp, "publicIp":current.publicIp, "router":current.router} 852 | results.push(result) 853 | end for 854 | end for 855 | toPrint = "" 856 | for result in results 857 | globals.objects.push(result) 858 | toPrint = toPrint + result.user + ":" + typeof(result.object) + " " + result.publicIp + " " + result.localIp + " " + result.addr + " " + result.valn + char(10) 859 | end for 860 | print(format_columns(toPrint)) 861 | print("Type ""objects"" command to use exploit.") 862 | if not forceLocal then 863 | print("Perform a force local scan may find more exploits.") 864 | select = user_input("Enter ""f"" to force a local scan> ", false, true) 865 | if not lower(select) == "f" then break 866 | forceLocal = true 867 | continue 868 | end if 869 | break 870 | end while 871 | return null 872 | end function 873 | commands["rshell"] = {"name":"rshell", "description":"Get rshell connections. Specify a public IP to get from open rshell api.", "args":"[(opt) public_ip]"} 874 | commands["rshell"]["run"] = function(args) 875 | if not current.isLocal then return print("metaxploit based commands only works when running from local.") 876 | if args and rshellAPI and args[0] then 877 | rshells = rshellAPI.getRshells(args[0]) 878 | print("Using open rshell api with IP " + args[0]) 879 | else 880 | rshells = metaxploit.rshell_server 881 | if typeof(rshells) == "string" then return print(rshells) 882 | end if 883 | for object in rshells 884 | objects.push({"object":object, "user":libs.checkAccess(libs.toFile(object)), "localIp":object.host_computer.local_ip, "publicIp":object.host_computer.public_ip, "router":get_router(object.host_computer.public_ip)}) 885 | end for 886 | print(rshells.len + " active rshells added to list. Use with ""objects"" command.") 887 | return null 888 | end function 889 | commands["objects"] = {"name":"objects", "description":"Change active object.", "args":""} 890 | commands["objects"]["run"] = function(args) 891 | toPrint = "" 892 | for i in objects.indexes 893 | toPrint = toPrint + str(i + 1) + "." + objects[i].user + ":" + typeof(objects[i].object) + " " + objects[i].publicIp + " " + objects[i].localIp + char(10) 894 | end for 895 | print(format_columns(toPrint)) 896 | select = to_int(user_input("Chose a number: ")) 897 | if typeof(select) != "number" or select < 1 or select > objects.len then return print("input invalid.") 898 | select = select - 1 899 | globals.current.obj = objects[select].object 900 | globals.current.router = objects[select].router 901 | globals.current.lanIp = objects[select].localIp 902 | globals.current.folder = libs.toFile(objects[select].object) 903 | globals.current.user = objects[select].user 904 | globals.current.isLocal = false 905 | return print("Done.") 906 | end function 907 | commands["nmap"] = {"name":"nmap", "description":"Scan a ip or a domain.", "args":"[ip/domain]"} 908 | commands["nmap"]["run"] = function(args) //thanks to Nameless for this awesome nmap. I am too lazy to write a new one. It is MIT licensed anyway. //update 20240302: i did write a new one. 909 | if args.len < 1 then return print("Invalid ip.") 910 | targetIp = args[0] 911 | if not is_valid_ip(targetIp) then targetIp = nslookup(targetIp) 912 | if not is_valid_ip(targetIp) then return print("Invalid ip.") 913 | if is_lan_ip(targetIp) then 914 | if get_router(targetIp) then 915 | router = get_router(targetIp) 916 | else if get_switch(targetIp) then 917 | router = get_switch(targetIp) 918 | else 919 | router = current.router 920 | end if 921 | else 922 | if not get_router(targetIp) then return print("Invalid ip.") 923 | router = get_router(targetIp) 924 | end if 925 | toPrint = "" + router.essid_name + " (" + router.bssid_name + ")\nPublic IP: " + router.public_ip + " Private IP: " + router.local_ip + "\n\nkernel_router.so v" + router.kernel_version + "\n\nWhois info:\n" + whois(router.public_ip).replace(char(10), "\n").replace(": ", ": ") + "\n\nFirewall rules:\n" + format_columns((["ACTION PORT SOURCE_IP DESTINATION_IP"] + router.firewall_rules).join("\n")) + "\n\n" //nslookup, whois, scanrouter part. 926 | nmapInfo = "Exposed ports on router " + router.public_ip + " " + router.local_ip 927 | for port in router.used_ports 928 | if port.is_closed then accessible = "--- " else accessible = "ACCESSIBLE" 929 | portInfo = router.port_info(port).split(" ") 930 | portNumber = port.port_number + "" 931 | nmapInfo = nmapInfo + "\n" + char(9) + accessible + " " + portNumber + (" " * (6 - portNumber.len)) + portInfo[0] + (" " * (13 - portInfo[0].len)) + portInfo[1] + (" " * (8 - portInfo[1].len)) + port.get_lan_ip 932 | end for 933 | forwardedPorts = router.used_ports 934 | for i in forwardedPorts.indexes 935 | forwardedPorts[i] = forwardedPorts[i].get_lan_ip + router.port_info(forwardedPorts[i]) 936 | end for 937 | nmapInfo = nmapInfo + "\n\nScaning all machines..." 938 | if is_lan_ip(targetIp) then lanIps = [targetIp] else lanIps = router.devices_lan_ip.sort 939 | if lanIps.indexOf(router.local_ip) then 940 | lanIps.remove(lanIps.indexOf(router.local_ip)) 941 | lanIps = [router.local_ip] + lanIps 942 | end if 943 | for lanIp in lanIps 944 | nmapInfo = nmapInfo + "\nMachine at " + lanIp + "" 945 | ports = router.device_ports(lanIp) 946 | if not ports isa list then 947 | nmapInfo = nmapInfo + "\n" + char(9) + "IP UNREACHABLE" 948 | continue 949 | end if 950 | portsInfo = "" 951 | for port in ports 952 | if forwardedPorts.indexOf(port.get_lan_ip + router.port_info(port)) != null then exposed = "EXPOSED" else exposed = "--- " 953 | if is_lan_ip(targetIp) or ((not port.is_closed) and exposed == "EXPOSED") then accessible = "ACCESSIBLE" else accessible = "--- " 954 | portInfo = router.port_info(port).split(" ") 955 | portNumber = port.port_number + "" 956 | portsInfo = portsInfo + "\n" + char(9) + exposed + " " + accessible + " " + portNumber + (" " * (6 - portNumber.len)) + portInfo[0] + (" " * (13 - portInfo[0].len)) + portInfo[1] + (" " * (8 - portInfo[1].len)) + port.get_lan_ip 957 | end for 958 | if ports then nmapInfo = nmapInfo + portsInfo else nmapInfo = nmapInfo + "\n" + char(9) + "No ports detected." 959 | end for 960 | toPrint = toPrint + nmapInfo 961 | print(toPrint) 962 | end function 963 | commands["cd"] = {"name":"cd", "description":"Moves to a different directory.", "args":"[(opt) path]"} 964 | commands["cd"]["run"] = function(args) 965 | if args.len < 1 then 966 | if current.user == "root" then toPath = "/root" else toPath = "/home/" + current.user 967 | else 968 | if args[0] == "." then return null 969 | if args[0] == ".." then 970 | if current.folder.parent then globals.current.folder = current.folder.parent 971 | return null 972 | end if 973 | toPath = libs.absolutePath(args[0], current.folder.path) 974 | if not toPath then return null 975 | end if 976 | folderObj = current.folder 977 | while folderObj.parent 978 | folderObj = folderObj.parent 979 | end while 980 | toFolder = libs.changeDir(toPath, folderObj) 981 | if not typeof(toFolder) == "file" then 982 | if args.len < 1 then globals.current.folder = folderObj else print("No such directory.") 983 | return null 984 | end if 985 | if not toFolder.is_folder then return print("No such directory.") 986 | globals.current.folder = toFolder 987 | return true 988 | end function 989 | commands["ls"] = {"name":"ls", "description":"List all files.", "args":"[(opt) path]"} 990 | commands["ls"]["run"] = function(args) 991 | if args.len == 0 then toPath = current.folder.path else toPath = libs.absolutePath(args[0], current.folder.path) 992 | if not toPath then return print("No such directory.") 993 | folderObj = current.folder 994 | while folderObj.parent 995 | folderObj = folderObj.parent 996 | end while 997 | toFolder = libs.changeDir(toPath, folderObj) 998 | if not typeof(toFolder) == "file" then return print("No such directory.") 999 | if not toFolder.is_folder then return print("No such directory.") 1000 | subFiles = toFolder.get_folders + toFolder.get_files 1001 | subFiles.sort 1002 | output = "NAME TYPE +WRX FILE_SIZE PERMISSIONS OWNER GROUP" 1003 | for subFile in subFiles 1004 | nameFile = subFile.name.replace(" ","_") 1005 | permission = subFile.permissions 1006 | owner = subFile.owner 1007 | size = subFile.size 1008 | group = subFile.group 1009 | type = "txt" 1010 | if subFile.is_binary == 1 then type = "bin" 1011 | if subFile.is_folder == 1 then type = "fld" 1012 | WRX = "" 1013 | if subFile.has_permission("w") then WRX = WRX + "w" else WRX = WRX + "-" 1014 | if subFile.has_permission("r") then WRX = WRX + "r" else WRX = WRX + "-" 1015 | if subFile.has_permission("x") then WRX = WRX + "x" else WRX = WRX + "-" 1016 | output = output + "\n" + subFile + ">" + nameFile + " [" + type + "] [" + WRX + "] [" + libs.fileSize(size) + "] [" + permission + "] [" + owner + "] [" + group + "]" 1017 | end for 1018 | output = format_columns(output) 1019 | print(output) 1020 | return print("\n") 1021 | end function 1022 | commands["help"] = {"name":"help", "description":"List all commands.", "args":""} 1023 | commands["help"]["run"] = function(args) 1024 | output = "\n" + typeof(current.obj) + " commands:" + "\n" 1025 | for command in commands 1026 | commandData = command.value 1027 | output = output + char(9) + commandData.name + " " + commandData.args.trim + " -> " + commandData.description + "\n" 1028 | end for 1029 | if typeof(current.obj) == "computer" or typeof(current.obj) == "shell" then 1030 | for command in computerCommands 1031 | commandData = command.value 1032 | output = output + char(9) + commandData.name + " " + commandData.args.trim + " -> " + commandData.description + "\n" 1033 | end for 1034 | end if 1035 | if typeof(current.obj) == "shell" then 1036 | for command in shellCommands 1037 | commandData = command.value 1038 | output = output + char(9) + commandData.name + " " + commandData.args.trim + " -> " + commandData.description + "\n" 1039 | end for 1040 | end if 1041 | return print(output) 1042 | end function 1043 | commands["secureserver"] = {"name":"secureserver", "description":"chmod -R ugo-rwx /, chown -R root /, chgrp -R root /.", "args":""} 1044 | commands["secureserver"]["run"] = function(args) 1045 | if user_mail_address then return print("secureserver is disabled on home.") 1046 | fileObject = current.folder 1047 | while fileObject.parent 1048 | fileObject = fileObject.parent 1049 | end while 1050 | rootFolder = fileObject 1051 | if not rootFolder then return print("/ not found.") 1052 | rootFolder.set_group("root", true) 1053 | rootFolder.set_owner("root", true) 1054 | rootFolder.chmod("u-rwx", true) 1055 | rootFolder.chmod("g-rwx", true) 1056 | rootFolder.chmod("o-rwx", true) 1057 | return print("Tried to secure /.") 1058 | end function 1059 | commands["secure"] = {"name":"secure", "description":"chmod -R ugo-rwx /root, chown -R root /root, chgrp -R root /root.", "args":""} 1060 | commands["secure"]["run"] = function(args) 1061 | if not current.isLocal then return print("secure is disabled on remote.") 1062 | fileObject = current.folder 1063 | while fileObject.parent 1064 | fileObject = fileObject.parent 1065 | end while 1066 | rootFolder = libs.getFile("/root", fileObject) 1067 | if not rootFolder then return print("/root not found.") 1068 | rootFolder.set_group("root", true) 1069 | rootFolder.set_owner("root", true) 1070 | rootFolder.chmod("u-rwx", true) 1071 | rootFolder.chmod("g-rwx", true) 1072 | rootFolder.chmod("o-rwx", true) 1073 | return print("Tried to secure /root.") 1074 | end function 1075 | commands["vuln"] = {"name":"vuln", "description":"List file with vulnerable permission.", "args":"[(opt) max_depth]"} 1076 | commands["vuln"]["run"] = function(args) 1077 | if args and typeof(to_int(args[0])) == "number" then maxDepth = to_int(args[0]) else maxDepth = -1 1078 | rootFile = current.folder 1079 | while rootFile.parent 1080 | rootFile = rootFile.parent 1081 | end while 1082 | allFiles = libs.allFiles(rootFile, maxDepth) 1083 | files = [] 1084 | for file in allFiles 1085 | if file.has_permission("r") or file.has_permission("w") or file.has_permission("x") then 1086 | files = files + [libs.typeofFile(file) + " " + file.path + " " + file.permissions] 1087 | end if 1088 | end for 1089 | output = files.sort.join("\n") 1090 | return print(output) 1091 | end function 1092 | commands["text"] = {"name":"text", "description":"Text Editor. Will clear screen to display text.", "args":"[path_to_text]"} 1093 | commands["text"]["run"] = function(args) 1094 | if args.len < 1 then return print("Invalid arguments!") 1095 | pathText = libs.absolutePath(args[0], current.folder.path) 1096 | if not pathText then return print("File not found.") 1097 | textFile = libs.getFile(pathText) 1098 | if not textFile then return print("File not found.") 1099 | if textFile.is_binary or textFile.is_folder then return print("File not text.") 1100 | text = textFile.get_content 1101 | lines = text.split(char(10)) 1102 | while true 1103 | clear_screen 1104 | for i in lines.indexes 1105 | line = "" + str(i + 1) + "" + char(9) 1106 | line = line + lines[i] 1107 | print(line) 1108 | end for 1109 | print("x: save and exit, s: save, q: exit, i: insert, m: modify, r: remove") 1110 | option = user_input("> ", false, true) 1111 | if option.lower == "s" or option.lower == "x" then textFile.set_content(lines.join(char(10))) 1112 | if option.lower == "q" or option.lower == "x" then break 1113 | if option.lower == "i" then 1114 | print("specify line number, c to cancel.") 1115 | lineNum = user_input("> ").to_int 1116 | newText = user_input("input text:" + char(10)) 1117 | if not lineNum isa number then continue 1118 | if lineNum >= lines.len then lineNum = lines.len 1119 | if lineNum < 0 then lineNum = 0 1120 | lines = lines[:lineNum] + [newText] + lines[lineNum:] 1121 | continue 1122 | end if 1123 | if option.lower == "m" then 1124 | print("specify line number, c to cancel.") 1125 | lineNum = user_input("> ").to_int 1126 | newText = user_input("input text:" + char(10)) 1127 | if not lineNum isa number then continue 1128 | if lineNum > lines.len then lineNum = lines.len 1129 | if lineNum < 1 then lineNum = 1 1130 | lines[lineNum - 1] = newText 1131 | continue 1132 | end if 1133 | if option.lower == "r" then 1134 | print("specify line number, c to cancel.") 1135 | lineNum = user_input("> ").to_int 1136 | if not lineNum isa number then continue 1137 | if lineNum < 1 or lineNum > lines.len then continue 1138 | if lines.len == 1 then 1139 | lines[0] = "" 1140 | continue 1141 | end if 1142 | lines = lines[:lineNum - 1] + lines[lineNum:] 1143 | continue 1144 | end if 1145 | end while 1146 | return print("Done.") 1147 | end function 1148 | commands["find"] = {"name":"find", "description":"Find a file with its name.", "args":"[file]"} 1149 | commands["find"]["run"] = function(args) 1150 | if args.len < 1 then return print("Usage: find [file]") 1151 | fileName = args[0] 1152 | files = libs.find(fileName) 1153 | output = [] 1154 | for file in files 1155 | output = output + [libs.typeofFile(file) + " " + file.path] 1156 | end for 1157 | output = output.sort.join("\n") 1158 | return print(output) 1159 | end function 1160 | commands["cat"] = {"name":"cat", "description":"Prints a file.", "args":"[file]"} 1161 | commands["cat"]["run"] = function(args) 1162 | if args.len < 1 then return print("No file specified.") 1163 | folderObj = current.folder 1164 | while folderObj.parent 1165 | folderObj = folderObj.parent 1166 | end while 1167 | toPath = libs.absolutePath(args[0], current.folder.path) 1168 | if not toPath then return print("No file specified.") 1169 | toPrint = libs.getFile(toPath, folderObj) 1170 | if not typeof(toPrint) == "file" then return print("File not found: " + toPath) 1171 | if not toPrint.has_permission("r") then return print("Permission denied.") //check perm 1172 | if toPrint.is_binary or toPrint.is_folder then return print("File not text file.") 1173 | return print(toPrint.get_content) 1174 | end function 1175 | commands["chmod"] = {"name":"chmod", "description":"Change permission for a file.", "args":"[(opt) -R] [ugo+/-rwx] [path]"} 1176 | commands["chmod"]["run"] = function(args) 1177 | folderObj = current.folder 1178 | while folderObj.parent 1179 | folderObj = folderObj.parent 1180 | end while 1181 | if args.len == 2 then 1182 | toPath = libs.absolutePath(args[1], current.folder.path) 1183 | isRecursive = false 1184 | perm = args[0] 1185 | else if args.len == 3 then 1186 | toPath = libs.absolutePath(args[2], current.folder.path) 1187 | isRecursive = true 1188 | perm = args[1] 1189 | else 1190 | return print("Usage: chmod [(opt) -R] [ugo+-rwx] [path]") 1191 | end if 1192 | if not toPath then return print("No file specified.") 1193 | toChmod = libs.getFile(toPath, folderObj) 1194 | if not typeof(toChmod) == "file" then return print("File not found: " + toPath) 1195 | users = [] 1196 | if perm.indexOf("u") != null then users.push("u") 1197 | if perm.indexOf("g") != null then users.push("g") 1198 | if perm.indexOf("o") != null then users.push("o") 1199 | if perm.indexOf("+") != null and perm.indexOf("-") == null then 1200 | action = "+" 1201 | else if perm.indexOf("+") == null and perm.indexOf("-") != null then 1202 | action = "-" 1203 | else 1204 | return print("Invalid permission.") 1205 | end if 1206 | perms = "" 1207 | if perm.indexOf("r") != null then perms = perms + "r" 1208 | if perm.indexOf("w") != null then perms = perms + "w" 1209 | if perm.indexOf("w") != null then perms = perms + "x" 1210 | doChmod = 2 1211 | for user in users 1212 | doChmod = toChmod.chmod(user + action + perms, isRecursive) 1213 | end for 1214 | if doChmod and doChmod != 2 then return print(doChmod) 1215 | return print("Done.") 1216 | end function 1217 | commands["chgrp"] = {"name":"chgrp", "description":"Change group for a file.", "args":"[(opt) -R] [group] [path]"} 1218 | commands["chgrp"]["run"] = function(args) 1219 | folderObj = current.folder 1220 | while folderObj.parent 1221 | folderObj = folderObj.parent 1222 | end while 1223 | if args.len == 2 then 1224 | toPath = libs.absolutePath(args[1], current.folder.path) 1225 | isRecursive = false 1226 | grp = args[0] 1227 | else if args.len == 3 then 1228 | toPath = libs.absolutePath(args[2], current.folder.path) 1229 | isRecursive = true 1230 | grp = args[1] 1231 | else 1232 | return print("Usage: chgrp [(opt) -R] [group] [path]") 1233 | end if 1234 | if not toPath then return print("No file specified.") 1235 | toChgrp = libs.getFile(toPath, folderObj) 1236 | if not typeof(toChgrp) == "file" then return print("File not found: " + toPath) 1237 | doChgrp = toChgrp.set_group(grp, isRecursive) 1238 | if doChgrp then return print(doChgrp) 1239 | return print("Done.") 1240 | end function 1241 | commands["chown"] = {"name":"chown", "description":"Change owner for a file.", "args":"[(opt) -R] [owner] [path]"} 1242 | commands["chown"]["run"] = function(args) 1243 | folderObj = current.folder 1244 | while folderObj.parent 1245 | folderObj = folderObj.parent 1246 | end while 1247 | if args.len == 2 then 1248 | toPath = libs.absolutePath(args[1], current.folder.path) 1249 | isRecursive = false 1250 | user = args[0] 1251 | else if args.len == 3 then 1252 | toPath = libs.absolutePath(args[2], current.folder.path) 1253 | isRecursive = true 1254 | user = args[1] 1255 | else 1256 | return print("Usage: chown [(opt) -R] [owner] [path]") 1257 | end if 1258 | if not toPath then return print("No file specified.") 1259 | toChown = libs.getFile(toPath, folderObj) 1260 | if not typeof(toChown) == "file" then return print("File not found: " + toPath) 1261 | doChown = toChown.set_owner(user, isRecursive) 1262 | if doChown then return print(doChown) 1263 | return print("Done.") 1264 | end function 1265 | commands["cp"] = {"name":"cp", "description":"Copy file.", "args":"[path_from] [path_to]"} 1266 | commands["cp"]["run"] = function(args) 1267 | if args.len < 2 then return print("Usage: cp [path_from] [path_to].") 1268 | folderObj = current.folder 1269 | while folderObj.parent 1270 | folderObj = folderObj.parent 1271 | end while 1272 | fromPath = libs.absolutePath(args[0], current.folder.path) 1273 | toPath = libs.absolutePath(args[1], current.folder.path) 1274 | if (not fromPath) or (not toPath) then return print("No file specified.") 1275 | toCopy = libs.getFile(fromPath, folderObj) 1276 | if not typeof(toCopy) == "file" then return print("File not found: " + toPath) 1277 | paths = toPath.split("/") 1278 | toPathList = [] 1279 | for path in paths 1280 | if path then toPathList.push(path) //empty string eval to false 1281 | end for 1282 | if not toPathList.len then return print("No file specified.") 1283 | newName = toPathList[-1] 1284 | if toPathList.len == 1 then toPath = "/" else toPath = "/" + toPathList[:-1].join("/") 1285 | doCopy = toCopy.copy(toPath, newName) 1286 | if doCopy then return print(doCopy) 1287 | return print("Done.") 1288 | end function 1289 | commands["mv"] = {"name":"mv", "description":"Move file.", "args":"[path_from] [path_to]"} 1290 | commands["mv"]["run"] = function(args) 1291 | if args.len < 2 then return print("Usage: mv [path_from] [path_to].") 1292 | folderObj = current.folder 1293 | while folderObj.parent 1294 | folderObj = folderObj.parent 1295 | end while 1296 | fromPath = libs.absolutePath(args[0], current.folder.path) 1297 | toPath = libs.absolutePath(args[1], current.folder.path) 1298 | if (not fromPath) or (not toPath) then return print("No file specified.") 1299 | toMove = libs.getFile(fromPath, folderObj) 1300 | if not typeof(toMove) == "file" then return print("File not found: " + toPath) 1301 | paths = toPath.split("/") 1302 | toPathList = [] 1303 | for path in paths 1304 | if path then toPathList.push(path) //empty string eval to false 1305 | end for 1306 | if not toPathList.len then return print("No file specified.") 1307 | newName = toPathList[-1] 1308 | if toPathList.len == 1 then toPath = "/" else toPath = "/" + toPathList[:-1].join("/") 1309 | doMove = toMove.move(toPath, newName) 1310 | if doMove then return print(doMove) 1311 | return print("Done.") 1312 | end function 1313 | commands["rm"] = {"name":"rm", "description":"Delete file.", "args":"[file]"} 1314 | commands["rm"]["run"] = function(args) 1315 | if args.len < 1 then return print("No file specified.") 1316 | folderObj = current.folder 1317 | while folderObj.parent 1318 | folderObj = folderObj.parent 1319 | end while 1320 | toPath = libs.absolutePath(args[0], current.folder.path) 1321 | if not toPath then return print("No file specified.") 1322 | toDelete = libs.getFile(toPath, folderObj) 1323 | if not typeof(toDelete) == "file" then return print("File not found: " + toPath) 1324 | if not toDelete.has_permission("w") then return print("Permission denied.") //check perm 1325 | toDelete.delete //delete file 1326 | return print("File deleted.") //output 1327 | end function 1328 | commands["hash"] = {"name":"hash", "description":"Reverse hash. Split multiple lines with commas or line breaks.", "args":"[hash]"} 1329 | commands["hash"]["run"] = function(args) 1330 | if not crypto then print("Error: crypto.so not loaded! You can still try to use it if you have a hash map from API tho.") 1331 | if args.len != 1 then return print("Invalid arguments!") 1332 | hashes = [] 1333 | passes = args[0] 1334 | passes = passes.split(char(10)) 1335 | for i in passes.indexes 1336 | passes[i] = passes[i].split(",") 1337 | for j in passes[i].indexes 1338 | passes[i][j] = passes[i][j].split(";") 1339 | for k in passes[i][j].indexes 1340 | hashes = hashes + [passes[i][j][k]] 1341 | end for 1342 | end for 1343 | end for 1344 | for hsh in hashes 1345 | hsh = hsh.split(":") 1346 | if hsh.len > 0 then arg = hsh[0] 1347 | if hsh.len > 1 then arg = hsh[1] 1348 | ret = "" 1349 | if hashMap.hasIndex(arg) then ret = hashMap[arg] 1350 | if (not ret) and crypto then ret = crypto.decipher(arg) 1351 | if hsh.len > 1 then ret = hsh[0] + ":" + ret 1352 | print(ret) 1353 | end for 1354 | return print("All hash done.") 1355 | end function 1356 | commands["brute"] = {"name":"brute", "description":"Bruteforce with a NPC password list. Only works locally.", "args":"[(opt) user]"} 1357 | commands["brute"]["run"] = function(args) 1358 | if args then usr = args[0] else usr = "root" 1359 | for pas in hashMap.values 1360 | result = get_shell(usr, pas) 1361 | if typeof(result) != "shell" then continue 1362 | globals.objects.push({"object":result, "user":libs.checkAccess(libs.toFile(result)), "localIp":current.lanIp, "publicIp":current.publicIp, "router":current.router}) 1363 | return print("Password found! " + usr + ":" + pas) 1364 | end for 1365 | return print("Failed.") 1366 | end function 1367 | commands["clog"] = {"name":"clog", "description":"Clear log.", "args":""} 1368 | commands["clog"]["run"] = function(args) 1369 | tryClearLog = libs.corruptLog(current.folder) 1370 | if not tryClearLog then return print("Failed.") 1371 | return print("Done.") 1372 | end function 1373 | commands["local"] = {"name":"local", "description":"Get back to local.", "args":""} 1374 | commands["local"]["run"] = function(args) 1375 | globals.current.obj = local.shell 1376 | globals.current.router = local.router 1377 | globals.current.folder = local.folder 1378 | globals.current.user = local.user 1379 | globals.current.lanIp = local.lanIp 1380 | globals.current.isLocal = local.isLocal 1381 | return null 1382 | end function 1383 | commands["pwd"] = {"name":"pwd", "description":"Prints active path.", "args":""} 1384 | commands["pwd"]["run"] = function(args) 1385 | return print(current.folder.path) 1386 | end function 1387 | commands["clear"] = {"name":"clear", "description":"Clear screen.", "args":""} 1388 | commands["clear"]["run"] = function(args) 1389 | return clear_screen 1390 | end function 1391 | commands["exit"] = {"name":"exit", "description":"exit.", "args":""} 1392 | commands["exit"]["run"] = function(args) 1393 | return exit("exiting...") 1394 | end function 1395 | 1396 | execute = function(input) 1397 | cmd = input.split(" ") 1398 | cmdName = cmd[0] 1399 | args = cmd[1:] 1400 | Commands = commands 1401 | if typeof(current.obj) == "computer" or typeof(current.obj) == "shell" then 1402 | Commands = Commands + computerCommands 1403 | if typeof(current.obj) == "shell" then Commands = Commands + shellCommands 1404 | end if 1405 | if not Commands.hasIndex(cmdName.lower) then return print("Error: Command not found!") 1406 | command = Commands[cmdName.lower] 1407 | if args.len > 0 then 1408 | if args[0] == "-h" or args[0] == "--help" then 1409 | return print("Usage :" + command.name + " " + command.args.trim + " -> " + command.description + "\n") 1410 | end if 1411 | end if 1412 | command.run(args) 1413 | return null 1414 | end function 1415 | 1416 | main = function() 1417 | while true 1418 | print("――(" + current.user + ":" + typeof(current.obj) + "@" + current.publicIp + "~" + current.lanIp + ")[" + current.folder.path + "]") 1419 | if current.user == "root" then 1420 | input = user_input("# ") 1421 | else 1422 | input = user_input("$ ") 1423 | end if 1424 | execute(input) 1425 | end while 1426 | return null 1427 | end function 1428 | main --------------------------------------------------------------------------------