Как написать бота для спама

Вечер в хату чуваки и тянки!

1. Предисловие

Сегодня будем писать простенький скрипт на Питоне, который будет проводить спам атаку в сторону нашей жертвы.
Механизм работы кода прост, он пишет выбранное нами слово и нажимая ‘Enter’ отправляет его нашей жертве.
Инструкция написана так, чтобы даже ребенок понимал каждый шаг, так что особых знаний тут не надо, кроме умения пользоваться мышкой и клавиатурой.

2. Подготовка

Сначала создадим папку и там же два блокнота, один с них сохраняем, дав название «script.py», второй называем, как «text.txt».
В первый файл будем писать наш код, в второй файл вставим текст на ваш выбор (ТОЛЬКО НА ЛАТИНИЦЕ).

3. Приступаем

Импортируем модули для автоматизации и заморозки сценария:

Python:

import time # Модуль для работы с временем.
import pyautogui # Модуль для управления мышью и клавиатурой, точнее главный модуль в нашем программном коде.

Модуль «Time» нужен нам для того, чтобы мы успели активировать поле ввода, прежде чем скрипт начнет спамить.

Теперь создаем первую функцию, роль которой «стрелять» одним сообщением N-ое количество раз:

Python:

def SendMessage():
    time.sleep(2) # Замораживает скрипт на 2 секунды, чтобы мы успели активировать поле ввода.
    message = "U ARE UGLY" # Сообщение которое мы хотим отправлять пишем в кавычках.
    iterations = 1000 # 1000 раз отправляет данное сообщение.

    for i in range(iterations):
        pass

    while iterations > 0:
        iterations -= 1
 
        pyautogui.typewrite(message.strip()) # Пишет слово/текст написанный в переменной "message"
        pyautogui.press('enter') # и нажимая Enter, отправляет его нашей "жертве".
    print("Вся обойма попала в нашу жертву!")

Затем создаем вторую функцию, которая уже отправляет текст вписанный в наш блокнот:

Python:

def SendText():
    time.sleep(2)
    with open('text.txt') as f: # Открывает блокнот с названием text.txt (документ с содержанием того, что мы хотим отправлять).
        lines = f.readlines()
    for line in lines:
        pyautogui.typewrite(line.strip()) # В этой функции оно будет писать текст с каждой строки
        pyautogui.typewrite('enter') # и так же отправлять его "жертве".
    print("Дело сделано, осталось успокоить нашу жертву ^_^")

Подходим уже к концу, осталось лишь добавить «панель управления»:

Python:

print('~'*50)
print("[1] ===> Стрелять одним сообщением указанным в переменной ")
print("[2] ===> Отправлять строки из блокнота ")
print('~'*50)
option = input("[Выбирай функцию]===> ")

if option == "1":
    SendMessage()
elif option == "2":
    SendText()
else:
    print('Выбирай функция 1 или 2!')

4. Заканчиваем

Осталось лишь найти текст песни/стих или что-то там еще на английском языке и вставить его в наш «text.txt».

Для тех кому лень найти:

They say, oh my god, I see the way you shine
Take your hands, my dear, and place them both in mine
You know you stopped me dead while I was passing by
And now I beg to see you dance just one more time
Ooh I see you, see you, see you every time
And, oh my, I, I, I like your style
You, you make me, make me, make me wanna cry
And now I beg to see you dance just one more time
So they say
Dance for me
Dance for me
Dance for me oh oh oh
I’ve never seen anybody do the things you do before
They say
Move for me
Move for me
Move for me ay ay ay
And when you’re done, I’ll make you do it all again
I said, oh my god, I see you walking by
Take my hands, my dear, and look me in my eyes
Just like a monkey I’ve been dancing my whole life
But you just beg to see me dance just one more time
Ooh I see you, see you, see you every time
And, oh my, I, I, I,
I like your style
You, you make me, make me, make me wanna cry
And now I beg to see you dance just one more time
So they say
Dance for me
Dance for me
Dance for me oh oh oh
I’ve never seen anybody do the things you do before
They say
Move for me
Move for me
Move for me ay ay ay
And when you’re done I’ll make you do it all again
They say
Dance for me
Dance for me
Dance for me oh oh oh
I’ve never seen anybody do the things you do before
They say
Move for me
Move for me
Move for me ay ay ay
And when you’re done I’ll make you do it all again
They say
Dance for me
Dance for me
Dance for me oh oh oh
I’ve never seen anybody do the things you do before
They say
Move for me
Move for me
Move for me ay ay ay
And when you’re done I’ll make you do it all again
They say
Dance for me
Dance for me
Dance for me oh oh oh
I’ve never seen anybody do the things you do before
They say
Move for me
Move for me
Move for me ay ay ay
And when you’re done I’ll make you do it all again
All again

По неизвестным мне причинам, скрипт НЕ пишет слова или текст на кириллице, только на латинском.
Чтобы остановить работу нашей машины, нажмите на командую строку и выполните комбинацию Ctrl + C, либо просто закройте командую строку.

Какой-то серьезной опасности или важной опции данный скриптик не выполняет, больше предназначен для забавы.
Идею написания такого я взял у одного иностранца которого именно уже не помню, а сам выполняемый файл был написан мной, так что эта статья её первоисточник :D

Также приложил видео с обзором работы скрипта:

Это моя первая статья и в Python’e я лишь новичок, так что строго не судите.

«Цветная» версия скриптика:

Python:

from termcolor import colored
import subprocess
import time
import pyautogui
subprocess.call('', shell=True)

def SendMessage():
    time.sleep(2)
    # The message you want to send
    message = "U ARE UGLY"
    # How many times do i send a message?
    iterations = 5

    for i in range(iterations):
        pass

    while iterations > 0:
        iterations -= 1

        pyautogui.typewrite(message.strip())
        pyautogui.press('enter')

    print('Done, high five')
def SendScript():
    time.sleep(2)
    with open('script.txt') as f:
        lines = f.readlines()
    for line in lines:
        pyautogui.typewrite(line.strip())
        pyautogui.press('enter')

    print('It was hard, but we did it, high five.')

print(colored('~'*50, 'red'))
print(colored('Welcome bro (O V O)/', 'green'))
print(colored("Let's make fun of someone?", 'green'))
print(colored('~'*50, 'red'))


print(colored("t[1] ===> Resend the same message (─__─)", 'magenta' ))
print(colored("t[2] ===> Send titles from the script (v _ v)/", 'magenta'))

print(colored('~'*50, 'red'))
print('n')
option = input(colored('[Choose an option]==> ', 'cyan'))

if option == "1":
    SendMessage()
elif option == "2":
    SendScript()
else:
    print(colored('Choose a function! ¯_(-_-)_/¯', 'red'))

Improve Article

Save Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    PyAutoGUI is a Python module that helps us automate the key presses and mouse clicks programmatically. In this article we will learn to develop a spam bot using PyAutoGUI.

    Spamming – Refers to sending unsolicited messages to large number of systems over the internet. 

    This mini-project can be used for many real-life applications like:

    • Remind your friends or relatives to do a particular task after every particular time interval
    • Can be used for advertisement purpose

    In this article we will show the working of spam bot on telegram, but the code can also work for WhatsApp, Instagram etc. i.e. anywhere we find a text field it will work the same way.

    Approach

    • Import module
    • Add delay of 2 second in the execution of the program
    • Create mechanism to generate text messages. typewrite() function of pyautogui helps to write the text and sleep function helps us specify the particular time interval (in seconds) after which the next instruction has to be executed. datetime.datetime.now() function helps the user keep a track of when the message was sent.

    Syntax:

    typewriter(“<message>”)

    • Execute code

    Follow these simple steps to develop a spam bot using python:

    Example:

    Python3

    import pyautogui, time, datetime

    time.sleep(2)

    while True:

        print(datetime.datetime.now())

        pyautogui.typewrite("Reminder: Drink water!"

        pyautogui.press("enter")

        time.sleep(31)

        print(datetime.datetime.now())

        pyautogui.typewrite("Reminder: Take medicine!")

        pyautogui.press("enter")

        time.sleep(31)

        print(datetime.datetime.now())

        pyautogui.typewrite("Reminder: Take the dog for a walk!")

        pyautogui.press("enter")

        time.sleep(31)

        print(datetime.datetime.now())

        pyautogui.typewrite("Reminder: Drink water!")

        pyautogui.press("enter")

        time.sleep(31)

        print(datetime.datetime.now())

        pyautogui.typewrite("Reminder: Drink water!")

        pyautogui.press("enter")

        time.sleep(31)

    Output:  

    Date and time at which the message was sent 

    Simple Spam Bot

    A Simple and easy way to be the most hated person between your friends, All you have to do is spam the group chat
    using this bot until you get kicked…

    Please don’t bully me if my readme file does not look that professional, it’s my first time writing a readme.

    NOTE

    This is the beta version of this project, Do not expect it to be polished/fully featured/not buggy, I’m trying to fix as much bugs as I can and I’ll be trying to add more features.

    How it works

    Basically, the bot takes the text you entered in the first input and takes the number you entered in the second input and uses it
    to know how many times you want to type the text you entered, and then it types it for you. Simple as that!

    Installation

    First, you need to install Python and make sure it’s added to PATH,
    Then open the Command Prompt and type this command:

    That’s it. you’re done!

    How to use

    • Text Spam mode:

      This mode will spam the text you entered the amount of times you want

      1. Open main.py file
      2. Type whatever you want to spam
      3. Enter how many times do you want to spam
      4. press the Start Spamming button
      5. Quickly switch to the window that you want to spam in and click on the input you want to type messages in
    • Infinite Spam mode:

      This mode will spam the text you entered and it will never stop until you stop yourself it or close the terminal

      1. Open main.py file
      2. Type whatever you want to spam
      3. press the Start Spamming button
      4. Quickly switch to the window that you want to spam in and click on the input you want to type messages in
    • File Spam mode:

      This mode will spam the content of any text file you want

      1. Open main.py file
      2. Click Select File
      3. Navigate to the file you want to spam it’s content and select it
      4. press the Start Spamming button
      5. Quickly switch to the window that you want to spam in and click on the input you want to type messages in

    NOTE: this gif is showing the spambot with 0.2 message delay, it can type faster if the message delay is 0 which you can change in the settings
    ANOTHER NOTE: this gif is showing the first alpha version of the spambot not the latest version

    Introduction: Simple Spam Bot — VB.net

    This is a quick tutorial I made on how to make a spam bot. What is a spam bot? A Spam bot is basically used to send a repetitive message over one hundred times over. Spam is a great to get the attention of somebody, or just really annoy them. This tutorial can be used for other reasons besides a spam bot by using the same code with different put outs.

    Step 1: Step 1: Make a New Windows Form

    This tutorial will be created and designed in Visual Studio 2010 which can be downloaded here.

    Step 2: Step 2: Add Form Items

    Add the Following form items: Button x3 and a single Textbox.

    Step 3: Step 3: Make the Textbox Multiline

    This will allow the Textbox to be stretched out large, and not in a long line.

    Step 4: Step 4: Move Your Items Around

    Move your items around how you would like them. Not much to say here.

    Step 5: Step 5: Make It Look Pretty

    I made the Form look pretty.

    Step 6: Step 6: Add the Timer

    The timer is the magic of the Spammer, Without the timer you have a form with 3 buttons and a textbox on it.

    Step 7: Step 7: Double Tap the Timer1 on the Button of the Window

    Step 8: Step 8: Copy the Code As Shown for Timer1

    Code:

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick SendKeys.Send(TextBox1.Text) SendKeys.Send(«{ENTER}»)

    End Sub

    Step 9: Step 9: Copy the Code As Shown for Button 1, 2, and 3

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Timer1.Start() End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer1.Stop() End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = «» End Sub

    Step 10: Finished Product

    Disclaimer:

    If you using this on a Laptop, Make sure you have a PC Mouse connected, or else the Spammer recognizes the mouse as a source and all hell breaks loose. Thank you for this honor to teach you how to create the Spammer.

    Be the First to Share

    Recommendations

    Introduction: Simple Spam Bot — VB.net

    This is a quick tutorial I made on how to make a spam bot. What is a spam bot? A Spam bot is basically used to send a repetitive message over one hundred times over. Spam is a great to get the attention of somebody, or just really annoy them. This tutorial can be used for other reasons besides a spam bot by using the same code with different put outs.

    Step 1: Step 1: Make a New Windows Form

    This tutorial will be created and designed in Visual Studio 2010 which can be downloaded here.

    Step 2: Step 2: Add Form Items

    Add the Following form items: Button x3 and a single Textbox.

    Step 3: Step 3: Make the Textbox Multiline

    This will allow the Textbox to be stretched out large, and not in a long line.

    Step 4: Step 4: Move Your Items Around

    Move your items around how you would like them. Not much to say here.

    Step 5: Step 5: Make It Look Pretty

    I made the Form look pretty.

    Step 6: Step 6: Add the Timer

    The timer is the magic of the Spammer, Without the timer you have a form with 3 buttons and a textbox on it.

    Step 7: Step 7: Double Tap the Timer1 on the Button of the Window

    Step 8: Step 8: Copy the Code As Shown for Timer1

    Code:

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick SendKeys.Send(TextBox1.Text) SendKeys.Send(«{ENTER}»)

    End Sub

    Step 9: Step 9: Copy the Code As Shown for Button 1, 2, and 3

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Timer1.Start() End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer1.Stop() End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = «» End Sub

    Step 10: Finished Product

    Disclaimer:

    If you using this on a Laptop, Make sure you have a PC Mouse connected, or else the Spammer recognizes the mouse as a source and all hell breaks loose. Thank you for this honor to teach you how to create the Spammer.

    Be the First to Share

    Recommendations

    Понравилась статья? Поделить с друзьями:
  • Как написать бота для мафии
  • Как написать бота для майнкрафт на python
  • Как написать бота для компьютера
  • Как написать бота для дискорда на питоне
  • Как написать бота для дискорда на пайтоне