{"action":"created","issue":{"url":"https://api.github.com/repos/frida/frida-gum/issues/8","labels_url":"https://api.github.com/repos/frida/frida-gum/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/frida/frida-gum/issues/8/comments","events_url":"https://api.github.com/repos/frida/frida-gum/issues/8/events","html_url":"https://github.com/frida/frida-gum/issues/8","id":58010750,"number":8,"title":"Add console.log on client side","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-18T01:17:43Z","updated_at":"2015-02-19T14:11:43Z","closed_at":null,"body":"Without having to implicitly pass messages, this is important because most of the time you will not have access to the console of the target app.\r\n\r\nas a workaround:\r\n\r\n```python\r\nimport frida\r\nimport sys\r\n\r\npid = int(sys.argv[1])\r\nfunction_address = int(sys.argv[2], 16)\r\n\r\nprocess = frida.attach(pid)\r\nscript = process.session.create_script(\"\"\"\r\n        function print(x) {\r\n                send({type:\"msg\",msg:x});\r\n        }\r\n        print (\"Hello World\");\r\n        \"\"\" % function_address)\r\n\r\ndef on_message(message, data):\r\n        payload = message['payload']\r\n        try:\r\n                type = payload['type']\r\n                if type == 'msg':\r\n                        print payload['msg']\r\n        except:\r\n                print(message)\r\n                pass\r\n\r\nscript.on('message', on_message)\r\nscript.load()\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/frida/frida-gum/issues/comments/75057421","html_url":"https://github.com/frida/frida-gum/issues/8#issuecomment-75057421","issue_url":"https://api.github.com/repos/frida/frida-gum/issues/8","id":75057421,"user":{"login":"oleavr","id":735197,"avatar_url":"https://avatars.githubusercontent.com/u/735197?v=3","gravatar_id":"","url":"https://api.github.com/users/oleavr","html_url":"https://github.com/oleavr","followers_url":"https://api.github.com/users/oleavr/followers","following_url":"https://api.github.com/users/oleavr/following{/other_user}","gists_url":"https://api.github.com/users/oleavr/gists{/gist_id}","starred_url":"https://api.github.com/users/oleavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleavr/subscriptions","organizations_url":"https://api.github.com/users/oleavr/orgs","repos_url":"https://api.github.com/users/oleavr/repos","events_url":"https://api.github.com/users/oleavr/events{/privacy}","received_events_url":"https://api.github.com/users/oleavr/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T14:11:43Z","updated_at":"2015-02-19T14:11:43Z","body":"Agreed. So then either we change `console.log()` to send this message, or introduce `print()` in the global scope. I would argue the former is rather useless as it is now."}}