Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <windows.h>
- #include <conio.h>
- #include <bits/stdc++.h>
- #define clrscr() system("cls")
- #ifndef WINVER
- #define WINVER 0x0500
- #endif
- using namespace std;
- const int SZMAX = 1e8, WIDTH = 20;
- const char mcolor[] = "color 0b";
- const string unit = "(in miliseconds)";
- char op;
- string message;
- typedef struct {
- vector<string> CLI_data;
- function<bool()> valid_break_cond;
- } CLI_params;
- int reps;
- DWORD start_delay, delay, spam_delay;
- unordered_map<string, CLI_params> CLI_mapper;
- void map_CL_funs_strs() {
- function<bool()> f;
- CLI_mapper["mess_input_source"] = {
- {
- "Read message from:(1/2):",
- "1.Console!",
- "2.File!"
- },
- []()->bool {
- op = getch();
- return strchr("12", op);
- }
- };
- CLI_mapper["source:keyboard"] = {
- {
- "Type the message:"
- },
- []()->bool {
- getline(cin, message);
- return !message.empty();
- }
- };
- CLI_mapper["source:file"] = {
- {
- "Type file adress or file and make sure that the file is in folder with app:"
- },
- []()->bool {
- string fsource;
- ifstream fhandler;
- fhandler.open(fsource.c_str());
- if (!fhandler.good() || !fhandler.is_open()) {
- Beep(523,1500);
- std::cerr << "File not found/couldn't be opened!" << '\n';
- Sleep(5000);
- return false;
- }
- string temp;
- while (getline(fhandler, temp))
- message += temp;
- return true;
- }
- };
- CLI_mapper["time data: start_delay"] = {
- {
- "Delay until spammer start" + unit + ":"
- },
- []()->bool {
- cin >> start_delay;
- return (start_delay > 2000);
- }
- };
- CLI_mapper["time data: delay"] = {
- {
- "Delay between message characters" + unit + ":"
- },
- []()->bool {
- cin >> delay;
- return (delay >= 0);
- }
- };
- CLI_mapper["time data: spam_delay"] = {
- {
- "Delay between messages" + unit + ":"
- },
- []()->bool {
- cin >> spam_delay;
- return (spam_delay >= 0);
- }
- };
- CLI_mapper["loop"] = {
- {
- "Repeat by(times):"
- },
- []()->bool {
- cin >> reps;
- return (reps > 0);
- }
- };
- }//*/
- void __attribute__((constructor)) Setup();
- void Setup() {
- ios::sync_with_stdio(true);
- cout.tie(nullptr);
- system(mcolor);
- map_CL_funs_strs();
- cout.fill('\t');
- cout.width(WIDTH);
- cout << "SPAMMER BOT!!!" << endl;
- }
- void SendKbInp(const char *str, const DWORD delayT = 0, bool pressEnter = true) {
- INPUT ip;
- ip.type = INPUT_KEYBOARD;
- ip.ki.wScan = 0;
- ip.ki.time = 0;
- ip.ki.dwExtraInfo = 0;
- for (int i = 0;;) {
- char c;
- if (!str[i]) {
- if (!pressEnter)
- return;
- c = VK_RETURN;
- pressEnter = false;
- }
- else
- c = str[i++];
- ip.ki.wVk = VkKeyScanA(c);
- ip.ki.dwFlags = false;
- SendInput(1, &ip, sizeof(INPUT));
- ip.ki.dwFlags = KEYEVENTF_KEYUP;
- SendInput(1, &ip, sizeof(INPUT));
- Sleep(delayT);
- }//*/
- }
- void choice_CLI(CLI_params cli_params) {
- while (true) {
- for (auto it : cli_params.CLI_data)
- puts(it.c_str());
- if (cli_params.valid_break_cond())
- break;
- }
- }
- void exit_app() {
- cout << "Exiting";
- for (int i = 0; i < 3; i++) {
- Sleep(1200);
- cout << '.';
- }
- exit(EXIT_SUCCESS);
- }
- int main() {
- while (true) {
- choice_CLI(CLI_mapper["mess_input_source"]);
- if (op == '1')
- choice_CLI(CLI_mapper["source:keyboard"]);
- else if (op == '2')
- choice_CLI(CLI_mapper["source:file"]);
- choice_CLI(CLI_mapper["time data: start_delay"]);
- choice_CLI(CLI_mapper["time data: delay"]);
- choice_CLI(CLI_mapper["time data: spam_delay"]);
- choice_CLI(CLI_mapper["loop"]);
- cout << "Process is about to start in aprox " << start_delay / 1000 << " seconds. Put the cursor where u want to spam or program crashes!";
- cin.get();
- Sleep(start_delay);
- for (int reps = 1; reps <= ::reps; reps++) {
- SendKbInp(message.c_str(), delay, true);
- if (reps != ::reps)
- Sleep(spam_delay);
- }
- cout << "Process finished" << endl;
- cout << "To reuse press space:" << endl;
- op = getch();
- clrscr();
- if (op != ' ')
- break;//*/
- }//*/
- //getchar();
- exit_app();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement