Sort:  

Um...that seems potentially very insecure...

You are right and I added the possibility to add the post timestamp as security check.
By this, it is guaranteed that nobody else edited the code and that the source code itself did not change.

My thoughts exactly

It is probably worth noting that this is fully trusting the steemd node to which the Steem client library is connecting—trusting it with full RCE, that is.. It probably shouldn't be run except pointed at a node you run/control/trust, and this script as written does not do that.

Good point, I added a line in which a node is specified. I'm using now the api.steemit.com node, which should be trustworthy.

eval(someshit) is evil.
eval(somshitstoredinablockchain) is still evil.
Funny idea though ;-)

I will look into IronPython and RestrictedPython

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

To listen to the audio version of this article click on the play image.

Brought to you by @tts. If you find it useful please consider upvoting this reply.

#!/usr/bin/python
from beem import Steem
from beem.comment import Comment
import getpass


if __name__ == "__main__":

    wif = getpass.getpass(prompt='Enter your posting key.')
    stm = Steem(keys=[wif])
    account = stm.wallet.getAccountFromPrivateKey(wif)
    comment = Comment("@holger80/execute-python-code-directly-from-a-steem-post")
    print("%s will upvote %s" % (account, comment["permlink"]))
    comment.upvote(voter=account)
    

You can upvote my post after storing the read_python_from_post script from the post by:

python read_python_from_post.py @holger80/re-holger80-execute-python-code-directly-from-a-steem-post-20181123t003450162z 2018-11-23T00:34:51

Hi, @holger80!

You just got a 2.27% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

You got a 54.88% upvote from @ocdb courtesy of @holger80!

@ocdb is a non-profit bidbot for whitelisted Steemians, current max bid is 20 SBD and the respective amount in Steem.
Check our website https://thegoodwhales.io/ for the whitelist, queue and delegation info. Join our Discord channel for more information.

If you like what @ocd does, consider voting for ocd-witness through SteemConnect or on the Steemit Witnesses page. :)

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.244 which ranks you at #69 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 213 contributions, your post is ranked at #2. Congratulations!

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62817.54
ETH 2573.14
USDT 1.00
SBD 2.74