0

Is there any way to implement a code saved on pastebin in your Python application?

Example:

a = 1
# [load pastebin content: a=a+1]
print(a)

Is that possible with any command?

enzo
  • 9,861
  • 3
  • 15
  • 38
  • 2
    Does this answer your question? [Python load a python script from a raw link (pastebin)](https://stackoverflow.com/questions/52588167/python-load-a-python-script-from-a-raw-link-pastebin) – Tomerikoo Jan 21 '21 at 17:30
  • You would have to have the text read in from the pastebin to be interpreted – MF- Jan 21 '21 at 17:30

1 Answers1

0

Yes, you can!

import requests

def pasterun(post):
    url = f"https://pastebin.com/raw/{post}"
    code = requests.get(url).text
    exec(code)

url = 'https://pastebin.com/JRfkiLM8'
*_, post = url.split('/')
pasterun(post)
enzo
  • 9,861
  • 3
  • 15
  • 38