-
-
Notifications
You must be signed in to change notification settings - Fork 0
Writing Your First Easy Script
-
I Will Go ahead And Let You Know How To Code On Easy, It's Really Easy But Python Is Easier In The Current Time. I Created Easy To Be Some Sort Of ShortCut For My Code. Every time I Code Something I Should Code It Over Again Or I Should Copy It From an Old Project. In The Feature Easy Should Be Able To Handle More Stuff And Save Your Coding Time.
-
I Will Follow With You And Create a Simple Script That Checks If Some String Does Exist On a Web Page Response Content, I Will Use Requests And Some Simple Code.
- First Thing We Need To Define The Main Function That Import
requests
In Python. That's Will Be Easy UsingIMPORT
Key. So I Started With The Following Code.
FUNCTION Main.
IMPORT requests.
NEWLINE
CALL Main
- The First Two Lines Is The Function Definition And The Import Key That Imports Requests From Python. Then We Will Have To Call
requests.get
And Store Its Output On a Variable. We Can Do That UsingCALL
AndSTORE
. The Code Will Be Something Like Below
FUNCTION Main.
IMPORT requests.
STORE Response
CALL requests-get,"https://www.evil.com/".
TAB;IF ("evil",in,Response.text).
TAB;CALL print,"this's^evil".
CALL exit.
CALL print,"It^isn't^evil"
NEWLINE
CALL Main
-
I Used
TAB
Before The IF Condition To Make Sure It Will Take Its Place Inside The Main Function. The Dot Only Supports On Tab. And We Need Two Tabs In This Case. And On The Print Function, I Replaced Spaces With^
Due To The Fact Easy Is Sensitive To Spaces. -
Now Let's Translate The Code. Use This Command
python3 shell.py --file oureasycode.easy --mode show
. The Output Will Be Something Like This:
def Main():
import requests
Response = requests.get("https://www.evil.com/")
if ("evil" in Response.text):
print("this's evil")
exit()
print("It isn't evil")
Main()
- Let's Execute It And See The Results. Command:
python3 shell.py --file oureasycode.easy --mode exec
. The Output Will Bethis's evil
. Hope You Enjoy It.