mpaste/mpaste.py

52 lines
1.4 KiB
Python

from pastebins.cpaste import publish_to_multiple_cpastes
from pastebins.paste_python import publish_to_pinnwand
from pastebins.termbin import publish_to_termbin
from pastebins.paste_mozilla import publish_to_mozilla
from pastebins.dpaste import publish_to_dpaste
from gen_test_upload import new_upload
def publish_to_multiple_pastebins(file_path):
# Read the file content
with open(file_path, 'r') as file:
file_content = file.read()
results = {}
# Publish to Termbin
termbin_url = publish_to_termbin(file_content)
if termbin_url:
results['Termbin'] = termbin_url
# Publish to Mozilla Pastebin
mozilla_url = publish_to_mozilla(file_content)
if mozilla_url:
results['Mozilla Pastebin'] = mozilla_url
# Publish to Dpaste
dpaste_url = publish_to_dpaste(file_content)
if dpaste_url:
results['Dpaste'] = dpaste_url
# Publish to CPaste
cpaste_results = publish_to_multiple_cpastes(file_path)
if cpaste_results:
results['CPaste'] = cpaste_results
# Publish to paste python org
pbin_url = publish_to_pinnwand(file_content)
if pbin_url:
results['pbin'] = pbin_url
return results
# Make new file to upload and then upload it to all the pastebins
file_path = 'test.txt'
new_upload(file_path)
results = publish_to_multiple_pastebins(file_path)
# Print the return links from the pastebins
for service, url in results.items():
print(f"{service}: {url}")