thedynasty22
Registered Member
- Jul 12, 2008
- 96
- 90
so i made this pastebin auto poster in python. i have been getting decent traffic from pastebin so this helps me get visitors to whatever link i want.
here is the source code.
here is the source code.
Python:
import tkinter as tk
from tkinter import filedialog, messagebox
import threading
import requests
import random
import time
# Generate a serial code for uniqueness
def generate_serial_code():
return f"{random.randint(10000000, 99999999)}"
# Function to create a paste on Pastebin
def create_paste(api_user_key, content, title, visibility="0", expiration="N", proxy=None):
url = "https://pastebin.com/api/api_post.php"
data = {
"api_dev_key": dev_key_entry.get(),
"api_option": "paste",
"api_paste_code": content,
"api_paste_name": title,
"api_paste_expire_date": expiration,
"api_paste_private": visibility,
"api_user_key": api_user_key,
}
try:
response = requests.post(url, data=data, proxies=proxy, timeout=10)
if response.status_code == 200:
return response.text # Returns the URL of the created paste
else:
return f"Error: {response.status_code} - {response.text}"
except requests.exceptions.RequestException as e:
return f"Proxy error: {str(e)}"
# Function to generate the API user key
def generate_api_user_key():
url = "https://pastebin.com/api/api_login.php"
data = {
"api_dev_key": dev_key_entry.get(),
"api_user_name": username_entry.get(),
"api_user_password": password_entry.get(),
}
try:
response = requests.post(url, data=data, timeout=10)
if response.status_code == 200:
global api_user_key
api_user_key = response.text.strip()
messagebox.showinfo("Success", "API User Key Generated!")
else:
messagebox.showerror("Error", f"Failed to generate API User Key: {response.text}")
except requests.exceptions.RequestException as e:
messagebox.showerror("Error", f"Request Exception: {str(e)}")
# Function to post messages
def post_messages():
global stop_flag
if not api_user_key:
messagebox.showerror("Error", "Generate API User Key before starting.")
return
message_content = content_text.get("1.0", tk.END).strip()
titles = [title.strip() for title in titles_text.get("1.0", tk.END).splitlines() if title.strip()]
visibility = "1" # 0=public, 1=unlisted, 2=private
expiration = "N" # N=never, 10M=10 minutes, 1H=1 hour, etc.
if not message_content or not titles:
messagebox.showerror("Error", "Please fill out all required fields (Message Content and Titles).")
return
title_index = 0
while not stop_flag:
# Cycle through titles
current_title = titles[title_index]
title_index = (title_index + 1) % len(titles)
# Append a unique serial code to the message content
unique_content = message_content + f"\n\nUnique Code: {generate_serial_code()}"
# Pick a random proxy from the list
raw_proxy = random.choice(proxy_list) if proxy_list else None
proxy = (
{"http": raw_proxy, "https": raw_proxy}
if raw_proxy
else None
)
# Create the paste
result = create_paste(api_user_key, unique_content, current_title, visibility, expiration, proxy=proxy)
output_text.insert(tk.END, f"Title: {current_title}\nResult: {result}\n\n")
output_text.see(tk.END)
time.sleep(1) # Optional delay between posts
# Function to start posting
def start_posting():
global stop_flag
stop_flag = False
threading.Thread(target=post_messages, daemon=True).start()
# Function to stop posting
def stop_posting():
global stop_flag
stop_flag = True
# Function to load proxies from a file
def load_proxies():
global proxy_list
proxy_file = filedialog.askopenfilename(filetypes=[("Text files", "*.txt")])
if proxy_file:
with open(proxy_file, "r") as file:
proxy_list = [line.strip() for line in file.readlines() if line.strip()]
messagebox.showinfo("Proxies Loaded", f"Loaded {len(proxy_list)} proxies.")
# Global variables
api_user_key = None
proxy_list = []
stop_flag = False
# GUI Setup
root = tk.Tk()
root.title("Pastebin Auto Poster")
tk.Label(root, text="API Developer Key:").grid(row=0, column=0, sticky="e")
dev_key_entry = tk.Entry(root, width=40)
dev_key_entry.grid(row=0, column=1)
tk.Label(root, text="Username:").grid(row=1, column=0, sticky="e")
username_entry = tk.Entry(root, width=40)
username_entry.grid(row=1, column=1)
tk.Label(root, text="Password:").grid(row=2, column=0, sticky="e")
password_entry = tk.Entry(root, width=40, show="*")
password_entry.grid(row=2, column=1)
tk.Button(root, text="Generate API User Key", command=generate_api_user_key).grid(row=3, column=0, columnspan=2)
tk.Label(root, text="Message Content:").grid(row=4, column=0, sticky="ne")
content_text = tk.Text(root, width=50, height=10)
content_text.grid(row=4, column=1)
tk.Label(root, text="Titles (one per line):").grid(row=5, column=0, sticky="ne")
titles_text = tk.Text(root, width=50, height=5)
titles_text.grid(row=5, column=1)
tk.Button(root, text="Load Proxies", command=load_proxies).grid(row=6, column=0, columnspan=2)
tk.Button(root, text="Start Posting", command=start_posting, bg="green").grid(row=7, column=0, columnspan=2)
tk.Button(root, text="Stop Posting", command=stop_posting, bg="red").grid(row=8, column=0, columnspan=2)
output_text = tk.Text(root, width=70, height=15)
output_text.grid(row=9, column=0, columnspan=2)
root.mainloop()