Page 1 of 1

Getting variables to python script?

Posted: 17 Jan 2019 18:37
by hmast
How could I get Automagic to send variables to python script and vice versa?

Re: Getting variables to python script?

Posted: 18 Jan 2019 06:15
by Desmanto
There is no action to run the python script. But we have the action to execute bash script (terminal emulator command). So, most likely you have to convert the script into automagic scripting. I am currently also studying the EFE exploit POC.py and converting it to Automagic scripting.

Re: Getting variables to python script?

Posted: 18 Jan 2019 16:28
by hmast
Umn, sounds good. Could you give quick example/tutorial as to how it could specifically be done?

Re: Getting variables to python script?

Posted: 18 Jan 2019 17:50
by Desmanto
It is just some different syntax. For example at the python we have

Code: Select all

  if package != '':
        data = '{ "command":' + cmd + ', "appPackageName":' + package + ' }'
    else:
        data = '{ "command":' + cmd + ' }'
Then in Automagic, it will become

Code: Select all

if(package != '')
  data = '{ "command":' + cmd + ', "appPackageName":' + package + ' }'
else
  data = '{ "command":' + cmd + ' }'
It is just like switching from learning new language and syntax. But of course there are limitation and things you can or can't do in Automagic

Re: Getting variables to python script?

Posted: 18 Jan 2019 19:56
by hmast
Cheers! By the way, just found this: https://www.reddit.com/r/tasker/comment ... l4a_tasks/

That plugin there, which Automagic can most likely use too, sounds rather promising.

Re: Getting variables to python script?

Posted: 19 Jan 2019 18:29
by Desmanto
Oh, I don't know that it exists. Running a python script probably only to save some time from converting it. There are limits you can do with running python in plugin, the environment is most likely sandboxed only for those script only. But yeah, it can be done, that's more important.

BTW, I stop converting the python now, as the dev has patched out the app. So seems I am too late to exploit this to scare them to uninstall the shady app. :(