Coder Social home page Coder Social logo

functions's Introduction

Functions Description

Poggit-CI

Ever wanted to make your own commands? Well, now you can! Using the functions plugin a user can set a function, and then on running a certain command, that function will be run - Enjoy :D



Changelog

Version 2.0.0: May 13, 2018. Thanks to JackMD!

- Updated to version 2.0.0 in config
- Compatibility with API 3.0.0-ALPHA12 through ALPHA14
- Code reformatting
- Shorthand commands: /func, for example
- Typehints added (ew, but yeah fiiineeeee)
- Help message redesign, looking great!
- Remove unnecessary return statements
- File structure improved
- Author name fixed
- Minor improvements

Commands

All the commands currently implemented into Functions:

- /function create <name of the function>
    Create a function!

- /function addcmd <function name> <command>
    Add a command to a function!

- /function setcmd <function name> <id> <command> (Functions 1.2+)
    Set a command to a function by it's id (can be found using read)!

- /function usage <function name> <usage> (Functions 1.2+)
    Set the usage of a function!

- /function desc <function name> <description> (Funtions 1.2+)
    Set the description of a function!

- /function read <function name>
    Show every command of the function (nothink executes no commands!)

- /function resetcmd <function name> <command id>
    Reset a command (leave it to blank to be changed later)

- /function removecmd <function name> <command id>
    Remove the command (remove the space used for the command)

Permissions

All the permissions used by Functions:

- func.command.function : Allows /function, Default: OP

Special replacements

Those are what in the command will be replace by what :~)

  • {sender} : Will be replaced with sender name
  • {isop} : Boolean if the sender is OP.
  • {usage} : Will be replaced with the command usage
  • {desc}: Will be replaced with the command description
  • {x} : Will be replaced with sender x coordinate
  • {y} : Will be replaced with sender y coordinate
  • {z} : Will be replaced with sender z coordinate
  • {level} : Will be replaced with sender level
  • {args[0]} : Will be replaced with the first argument of the command
  • {args[1]} : Will be replaced with the second argument of the command
  • {args[2]} : Will be replaced with the third argument of the command
  • {args[3]} : Will be replaced with the fourth argument of the command

You can also enter:

  • {op} to set the user OP just for the command then unop him if (he wasn't OP).TtTT
  • {console} to execute the command as the console

Here comes the complex part: the if statements. (Functions 1.2+)
If statements follows a simple syntax in the command (removed after execution):
{if:<conditon>;then:<action>}

List of possible conditions:

  • value=other value: Check if two values are equal.
  • value!=other value: Check if two values are not equal.
  • value>other value: Check if a value is more than an other. Only for numbers.
  • value<other value: Check if a value is less than an other. Only for numbers.

List of possible actions:

  • exec (or execute): Will execute the command (if cancelled before)
  • !exec (or !execute): Will cancel the execution of the command
  • asop: Will execute the command as an OP.
  • asconsole: Will execute the command as console.
  • as<online player name>: Will execute all new commands as another player.

AND and OR

You can check multiple conditions using && (and) or || (or). DO NOT USE BOTH IN THE SAME CONDITION !

Combined with other replacements, you can do thousands of things. Here are a few example:

  • {if:{isop}!=true;then:!exec}: Will execute the command only if the player is OP.
  • {if:{level}!=lobby;then:!exec}: Will execute the command only the command if the player is in the world "lobby" (like /fly commands)
  • {if:{y}<10&&{y}>1;then:asop}: Will execute the command as OP if the sender is beetween 1 and 10 of height.
  • {if:{args[0]}=read||{args[0]}=listen;then:!exec}: Will not execute the command if the 1st argument is "read" or "listen".

... create your own conditions will help you to really make interactive commands.

Importing / Exporting Functions (Functions 1.2.1+)

What's even cooler with this plugin is the fact that you can easily share Functions with other servers/on your network with a simple really light file.

Basic import/export

So first, you need to have a created function on your server.
Then, you need to run /function export <function name>
If succefull, you would see a new file in the function folder called <function name>.func .
This file basicly stores the function and is needed to import the function on other servers.
So share this file and put it into the Functions folder of the wanted server.
Then, on this server, run command /function import <name of he file without the .func> .
And voila ! You have succefully imported a function to an another server.

Import/export with password

Sometimes, you wouldn't like your shared functions to be leaked, so Functions comes with a buildt in feature of encrypting functions with passwords.
Passwords are encrypted using an sha512 encryption then converted to ANSII, then reencrypted into 1 number so there is NO way back to the original password.

So how to do this:
First of all, as you did before, you need to have the function you want to share on a server.
Then, run command /function export <function name> <password> .
You would see if functions successfully encrypted your password at the success message.
Now, as we did before, share it into an another server and put it into the Functions plugin folder.
And finally run command /function import <name of he file without the .func> <password> .
If no password included for a function that need one, you will get a message telling you to enter the password.
If the password entered is wrong (could not decrypt the function), you will also get an error message.

Authors

All contributors to Functions:

- Ad5001

- applqpak

- HimbeersaftLP

- TheDragonRing

- remotevase

- Dog2puppy

- ErkamKahriman

- JackMD

- TheRoyalBlock (AvgZing)

- DarkWav

Read The License!!!

Please make sure you read the license, upon downloading any file of the software, you agree to all its terms. The license may be found [here.] (http://bit.ly/2jikqXv)

functions's People

Contributors

ad5001 avatar applqpak avatar avgzing avatar catgirlinspace avatar darkwav avatar dragonwocky avatar erkam246 avatar himbeersaftlp avatar ifera avatar poggit-bot avatar remotevase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

functions's Issues

Error,Cannot make fucntion

I cannot create function. Read copy .log fir details.

Logs/Errors

 function c Hub

Warning: file_put_contents(/storage/emulated/0/PocketMine/plugins/Functions/config.yml): failed to open stream: No such file or directory in /storage/emulated/0/PocketMine/src/pocketmine/utils/Config.php on line 207

Warning: file_put_contents(/storage/emulated/0/PocketMine/plugins/Functions/config.yml): failed to open stream: No such file or directory in /storage/emulated/0/PocketMine/src/pocketmine/utils/Config.php on line 207

Warning: file_put_contents(/storage/emulated/0/PocketMine/plugins/Functions/config.yml): failed to open stream: No such file or directory in /storage/emulated/0/PocketMine/src/pocketmine/utils/Config.php on line 207

Notice: Undefined variable: name in /storage/emulated/0/PocketMine/plugins/Functions-master/src/Ad5001/Functions/Main.php on line 47

Notice: Undefined variable: cmd in /storage/emulated/0/PocketMine/plugins/Functions-master/src/Ad5001/Functions/Main.php on line 48
[Tesseract] [20:56:12] INFO> [Functions] Function Hub has been created! You can edit it on the config or by doing /function ac  <command number> <command...>.

 function ac Hub 1 kill

Warning: file_put_contents(/storage/emulated/0/PocketMine/plugins/Functions/config.yml): failed to open stream: No such file or directory in /storage/emulated/0/PocketMine/src/pocketmine/utils/Config.php on line 207
[Tesseract] [20:56:21] INFO> [Functions] Function Hub not found. Create it with /function c Hub

But I alredy do /function create Hub and again this last msg

Tesserect (Probably low spelled)

Brief description (why it is an issue)

Steps to reproduce (how can anyone reproduce the issue)

Expected result (what do you want to happen)

Actual result (what actually happens)

OS Infomation

Functions version(Commit number or link to where you got your .phar):
Software Version:
OS Version: Android

Logs/Errors

CRASH DUMP:
https://www.sendspace.com/file/4ekokc

P.S Tesserect is new name of ImagicalMine

Question

If functions are permissable, meaning a given permission to use each function, then how would I go about giving/taking permissions for each function ?

unless there is a way to check this in the function itself, please explain as not enough examples were given for me to figure this out on my own.

Thank you.

Doesn't work

Brief description

Steps to reproduce

  1. ...
  2. ...
  3. ...

Expected result

Actual result

Server Information

  • Functions Version: From PMMP Forums
  • Software Version: I dont know.
  • Server OS:

CrashDumps/Errors

Paste your CrashDump or error by replacing this text (DON'T delete the backticks!)

errors

Please update the plugin for 3.2.0 with new API documentation

Copyright Issue

http://forum.leet.cc/topic/23110/functions-plugin-used-without-permission/

I will submit a DMCA Takedown Notice.

SAMPLE DMCA TAKEDOWN NOTICE TEMPLATE.

— — — — — — — — — — — — — — —
To Whom It May Concern,

The following information serves to assert my rights and request removal of allegedly infringing web content under the Digital Millennium Copyright Act (DMCA). The following is a report, in good faith, of alleged copyright infringement. I am contacting you as the designated agent for the site upon which the infringing work currently appears. This letter is a Notice of Infringement as authorized in §512(c) of the U.S. Copyright Law.

I am the copyright owner of the works and the following is true and accurate.

  1. The original work, for which I claim copyright, appears, with my permission, at the following locations online:

{URLs WHERE YOUR ORIGNAL AUTHORIZED WORK APPEARS}

  1. Copies of my original copyrighted work are {attached/included/provided} to assist you in your evaluation and determination.

  2. The allegedly infringing {work/text/image} appears at the following location(s) online:

{URLs WHERE INFRINGING WORK IS CURRENTLY LOCATED}

  1. My contact information, as copyright holder, is as follows:

{INCLUDE YOUR CONTACT INFORMATION}

  1. The information of the alleged copyright infringer is:

{INSERT WHOIS INFORMATION FOR THE SITE YOU ALLEGE IS INFRINGING}

  1. I have a good faith belief the use of the above reference copyrighted work(s) that appears on the website for which you are the designated DMCA agent is not authorized by the copyright owner, its agent, or by law.

I declare, under penalty of perjury, this notice is true and correct and that I am the copyright owner entitled to exclusive rights which I allege are being infringed.

Signed this ________ day of ______, 20 in {INSERT CITY, STATE, COUNTY}.

{YOUR SIGNATURE/eSIGNATURE}

— — — — — — — — — — — — — — —

Filing a DMCA Takedown does not mean every instance of your copyrighted work will be removed from the internet. You will need to submit a request for all the different locations you find your work. No, that’s not awesome. But it’s how it works.

Finally, keep in mind that the alleged infringer will have access to the information provided in your takedown notice. In addition, the alleged infringer can file a counter-notice, which is basically a reply, stating why the work does not infringe your copyright. If that happens, the work will likely be reposted and you will need to pursue other measures to enforce your copyright.

Error

I've got Pocketmine Version 3.8.2 and the Plugin Version 1.2.1.

Thus is the problem:

atal error: Declaration of Ad5001\Functions\Main::onCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, $label, array $args) must be compatible with pocketmine\plugin\PluginBase::onCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, string $label, array $args): bool in phar:///storage/emulated/0/PocketMine-MP/plugins/Functions_v1.2.1.phar/src/Ad5001/Functions/Main.php on line 15

Security Flaw

Brief description

Insecure encryption

As someone who like to break stuff for fun the said encryption is very easy to break,

even tho it is impossible to retrieve the said password due to how it have been converted into numbers like how you cant find out exactly what made 100 but you could guess it is 50x2 or 10x10 etc it also limit the strength itself since regardless how long my password is, i will get around so many length due to how hash alwayls have some estimated lenght

it is possible to decode the encrypted content without much computing power, there is a down fall to this by turning the password into numbers first then messing them up will make it very easy to brute force (mind you i am no cryptographer)

which i advise to not advertise your encryption feature as a strong encryption, I know this is not really something of major concern to the team but i just want to point it out

steps:

is to reverse engineer the encrypt part which uncover all it did was splitting each string into a array

then foreach strings turn them into number + a hard coded 23 + the number resulted by the hash of the password itself

which lead me to the realization of why not trying all iterations of numbers with a good success and easy brute forcing

as for how to fix it:

i think other then using something like a true encryption like AES there not much ways around it
OR use a longer hash that generates a longer number thrust taking more iterations for the attacker (and dont hardcode the long number, just make it so it is PRONE to happen hard coding makes attacker skip the lower part when they know the number dont starts there)

As for the source code it's self it will be released some time latter, HOPEFULLY when this is resolved or ignored as not fixing even tho by reading my feedback it is already given info to make your own version

if you really do not believe me you could upload a encrypted .func i will get back to you when i can with the un-encrypted (getting password is not possible like i said earlier)

READ FULL,THAN CLOSE PLEASE

Close this immediately,but PLEASE read!
I cannot open (Don't know how) new pull request,so I'll type here:
@Ad5001 Please add something like this (example from LEET.CC-TapToDo)
So lets begin what I want.(low at english)
/function create PvP
/function ac PvP tp X Y Z
And when player execute /pvp cmd,he/she to that coords even if no permission (example Guest without perm,can use /pvp,like /tp %p X Y Z%pow)
Translations: Please add some like %p %pow %op,any just to can do it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.