Works now with 3 pastebins.

This commit is contained in:
kalzu rekku 2024-07-26 17:43:15 +03:00
parent d0e5e7b679
commit 9977b834e2
2 changed files with 73 additions and 20 deletions

View File

@ -1,20 +1,6 @@
import requests
import json
import socket
def publish_to_mozilla(content):
url = 'https://pastebin.mozilla.org/api/'
data = {
'content': content,
'expires': '86400', # 24 hours
'format': 'text',
'lexer': '_text'
}
response = requests.post(url, data=data)
if response.status_code == 200:
return f"https://pastebin.mozilla.org/{response.text}"
return None
def publish_to_termbin(content):
host = 'termbin.com'
port = 9999
@ -29,28 +15,95 @@ def publish_to_termbin(content):
print(f"Error connecting to Termbin: {e}")
return None
def publish_to_multiple_pastebins(file_path):
def publish_to_mozilla(content):
url = 'https://pastebin.mozilla.org/api/'
data = {
'content': content,
'expires': '86400', # 24 hours
'format': 'text',
'lexer': '_text'
}
response = requests.post(url, data=data)
if response.status_code == 200:
return f"https://pastebin.mozilla.org/{response.text}"
return None
def publish_to_paste2(content):
url = 'https://paste2.org/api/create'
data = {
'content': content,
'lang': 'text'
}
response = requests.post(url, data=data)
if response.status_code == 200:
return f"https://paste2.org/{response.text}"
return None
def publish_to_dpaste(content):
url = 'https://dpaste.org/api/'
data = {
'content': content,
'format': 'url'
}
response = requests.post(url, data=data)
if response.status_code == 200:
return response.text.strip()
return None
def publish_to_pasteee(content, api_key):
url = 'https://paste.ee/api/v1/pastes'
headers = {
'X-Auth-Token': api_key
}
data = {
'description': 'File content',
'sections': [{'contents': content}]
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 201:
return response.json()['link']
return None
def publish_to_multiple_pastebins(file_path, pasteee_api_key=None):
# 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 Termbin
termbin_url = publish_to_termbin(file_content)
if termbin_url:
results['Termbin'] = termbin_url
# Publish to Paste2
paste2_url = publish_to_paste2(file_content)
if paste2_url:
results['Paste2'] = paste2_url
# Publish to Dpaste
dpaste_url = publish_to_dpaste(file_content)
if dpaste_url:
results['Dpaste'] = dpaste_url
# Publish to Paste.ee (if API key is provided)
if pasteee_api_key:
pasteee_url = publish_to_pasteee(file_content, pasteee_api_key)
if pasteee_url:
results['Paste.ee'] = pasteee_url
return results
# Example usage
file_path = 'test.txt'
#pasteee_api_key = 'YOUR_PASTE_EE_API_KEY' # Optional, remove if not using
results = publish_to_multiple_pastebins(file_path)
for service, url in results.items():

View File

@ -1 +1 @@
This is a test file.
This is a test file. Please be gentle with me. Gentlemens.