Skip to content

Define Easy Variables

Mohamed Dief edited this page Feb 19, 2021 · 2 revisions

Defining Easy Variables Using DEFINE and INIT

  • In Easy. All Variables Are Getting Stored In a Dictionary. That Takes The Variables Name And It's Value. You Can Define Easy Variables Using Two Syntaxes. The Fist One is DEFINE. DEFINE is Used To Define an Easy Variable That Could be Used as a Variable. Or It Could Be a Python Code. Make Sure To Check Your Easy Variables. Because If It's User Controllable. That Can Lead To Remote Code Execution By Adding Python Codes. Otherwise. Here's a DEFINE Example.
DEFINE key=<'hello = "test"'>
    ADD key

CALL print,hello
  • The Code I Included Is Defining an Easy Variable Called Key. Key Does Contain a Python Code. Using ADD Syntax. You're Appending This Variable Into The Code That Will Be Getting Executed. Then You're Calling print Function To Print hello Variable. That's Defined To test. The Output Of This Code Will Be: test

  • The Second Method To Define Variables That Could Be Used In Global For Every Single Easy File Inside Your Folder Is __INIT__. INIT is Used To Load Global Static Variables From __INIT__ or __INIT__.easy Files. But It Should Be Inside The Folder You're Running The Shell From. Otherwise. It Won't Be Able To Find It. Here's a Simple Example For __INIT__. We Will Start Creating a File With This Content Inside It.

filename = "__INIT__"
name = "easyTester"
age = 20
  • From Your Easy Code You Should Call INIT To Load The Global Variables From The File. The Code Should Be Something Like This:
CALL print,"Loading INIT"
INIT

CALL print,"My name is:",name

STORE strAge
CALL str,age

CALL print,"My age is:",strAge