C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Valek
    FFR Player
    • Jun 2003
    • 30

    #16
    Originally posted by makaveli121212
    ...fucking wiz
    He's just literate. If you look at the syntax, it's pretty much just like basic english and the way words are put, with variables and math equations.
    It also helps if you already know C++. :P



    <PRE>#include "RenBot.h"

    void __cdecl uithread(void *param) {
    HWND mainwnd, hEditWindow;
    HANDLE hTmp;
    Event quitevent;
    hTmp = quitevent;
    char titlebuf[255];
    GetConsoleTitle(titlebuf, sizeof(titlebuf));
    SetConsoleTitle("finder");
    while(!(mainwnd = FindWindow(0, "finder"))) ;
    SetConsoleTitle(titlebuf);
    hEditWindow = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Send message",
    ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX | WS_VISIBLE | WS_OVERLAPPED,
    10, 10, 200, 50, mainwnd, 0, GetModuleHandle(0), 0);
    // 10, 10, 200, 50, 0, 0, GetModuleHandle(0), 0);
    MSG msg;
    ShowWindow(hEditWindow, SW_SHOW);
    UpdateWindow(hEditWindow);
    while(true) {
    if(MsgWaitForMultipleObjects(1, &hTmp, 0, INFINITE, QS_ALLINPUT) != WAIT_OBJECT_0 + 1)
    break;
    while(PeekMessage(&msg, hEditWindow, 0, 0, PM_REMOVE)) {
    TranslateMessage(&msg);
    if(msg.message == WM_CHAR) {
    if(msg.wParam == 13) {
    bool wascmd = true;
    char buf[512];
    char msgbuf[512];
    GetWindowText(hEditWindow, buf, 510);
    SetWindowText(hEditWindow, "");
    strtok(buf, "\r\n");
    strcpy(msgbuf, buf);
    if(psbBot-&IsLoggedOn()) {
    psbBot-&SendText(msgbuf);
    }
    } else {
    DispatchMessage(&msg);
    }
    } else {
    DispatchMessage(&msg);
    }
    }
    }
    DestroyWindow(hEditWindow);
    }

    unsigned long ResolveHost(const char *hostname) {
    ENCRYPT_START;
    unsigned long result;
    const char *checkhost = hostname;
    while(*checkhost && (isdigit(*checkhost) || (*checkhost == '.')))
    checkhost++;
    if(*checkhost) {
    hostent *resolve = 0;
    resolve = gethostbyname(hostname);
    if(resolve == 0) {
    result = 0;
    } else {
    memcpy(&result, resolve-&h_addr, resolve-&h_length);
    }
    } else {
    result = inet_addr(hostname);
    }
    ENCRYPT_END;
    return result;
    }

    int main(int argc, char *argv[], char *envp[]) {
    INITENCRYPT;
    InitializeCRC32Table();
    Event hEvent;
    // hEvent.Wait();
    // printf("%u\n", GetLastError());
    SOCKET sSocket;
    WinsockInstance winsock;
    unsigned long Server = 0, SocksServer = 0;
    char CDkey[32], username[16] = "Noname", password[255] = "Nopass", master[255] = "RenBot", channel[255] = "Clan Ren";
    unsigned long ret;
    bool stop = false;
    {
    ENCRYPT_START_NAMED(block1);
    FILE *config = fopen("SimpleBot.cfg", "rt");
    if(config) {
    char readstr[1024];
    while(fgets(readstr, 1024, config)) {
    strtok(readstr, "\r\n");
    if(!strnicmp(readstr, "socks=", 6)) {
    SocksServer = ResolveHost(readstr + 6);
    if(!SocksServer)
    printf("Warning: Bad SOCKS server!\n");
    } else if(!strnicmp(readstr, "cdkey=", 6)) {
    strcpy(CDkey, readstr + 6);
    } else if(!strnicmp(readstr, "server=", 7)) {
    Server = ResolveHost(readstr + 7);
    if(!Server)
    printf("Fatal error: Bad Battle.net server!\n");
    } else if(!strnicmp(readstr, "username=", 9)) {
    strcpy(username, readstr + 9);
    } else if(!strnicmp(readstr, "password=", 9)) {
    strcpy(password, readstr + 9);
    } else if(!strnicmp(readstr, "master=", 7)) {
    strcpy(master, readstr + 7);
    } else if(!strnicmp(readstr, "homechannel=", 12)) {
    strcpy(channel, readstr + 12);
    }
    }
    fclose(config);
    }
    ENCRYPT_END;
    }
    _beginthread(uithread, 0, 0);
    if(!Server)
    return 0;
    {
    ENCRYPT_START_NAMED(block2);
    psbBot = new SimpleBot(&sSocket, hEvent.GetHandle(), username, password, CDkey, Server, SocksServer);
    psbBot-&SetHomeChannel(channel);
    psbBot-&SetMaster(master);
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    ENCRYPT_END;
    }
    while(stop == false) {
    ENCRYPT_START_NAMED(block3);
    switch(ret=hEvent.Wait()) {
    case WAIT_TIMEOUT:
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    case WAIT_FAILED:
    stop = true;
    break;
    case WAIT_OBJECT_0:
    switch(psbBot-&DispatchEvent()) {
    case BinaryBot:ISCONNECTED:
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Disconnected!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    break;
    case BinaryBot::CONNECTED:
    psbBot-&Output-&WriteEx(ConsoleOutput::GREEN, "Connected!\n");
    if(!psbBot-&SendStartup()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Disconnected while sending startup!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    }
    break;
    case BinaryBot::SENDVERSIONCHECK:
    psbBot-&Output-&WriteEx(ConsoleOutput::GRAY, "Checking versions...\n");
    if(!psbBot-&SendVersionCheck()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Error executing version check!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    }
    break;
    case BinaryBot::SENDCDKEY:
    psbBot-&Output-&WriteEx(ConsoleOutput::GRAY, "Sending CD-key...\n");
    if(!psbBot-&SendCDkey()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Error sending CD-key!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    }
    break;
    case BinaryBot::LOGON:
    psbBot-&Output-&WriteEx(ConsoleOutput::GRAY, "Logging on...\n");
    if(!psbBot-&SendLogon()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Error sending logon!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    }
    break;
    case BinaryBot::CREATEACCOUNT:
    psbBot-&Output-&WriteEx(ConsoleOutput::GRAY, "Creating account...\n");
    if(!psbBot-&CreateAccount()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Error sending account create!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    }
    break;
    case BinaryBot::SENDSTATS:
    psbBot-&Output-&WriteEx(ConsoleOutput::GREEN, "Logged on!\n");
    if(!psbBot-&SendStats()) {
    psbBot-&Output-&WriteEx(ConsoleOutput::RED, "Error sending statstring!\n");
    psbBot-&Connect(SocksServer ? BinaryBot::SOCKS5 : BinaryBot::PLAIN);
    break;
    }
    psbBot-&JoinHomeChannel();
    break;
    case BinaryBot::WAIT:
    break;
    default:
    break;
    }
    break;
    }
    ENCRYPT_END;
    }
    return 0;
    }
    </PRE>


    [B]

    Just the main.cpp for a bot that runs on B.net running the binary protocols that used to work. (Emulates game clients, but is a chat client)

    Simple! ^.^

    *Edit: I don't understand this code for the forum, its showing it all gayed when I'm copying it from my thingy. t.t;
    Er: edit again, I don't like the board code tag, so I removed em, and they work with html, so meh.

    Comment

    • makaveli121212
      FFR Player
      • May 2003
      • 3823

      #17
      i do know c++, and i know how the program works, and why it works; i say hes a fucking wiz because i know him personally, and hes a fucking wiz; hes one of the smartest kids i know, hands down; after all we take the same classes, go to the same school, and the same damn c++ teacher; damn you mr dzwonkiewicz
      Originally posted by VxDx
      Stick it in her butt and pee.

      Comment

      • VxDx
        FFR Player
        • May 2003
        • 1871

        #18
        Schwantz

        Comment

        • makaveli121212
          FFR Player
          • May 2003
          • 3823

          #19
          damn schwantz; hey whats that website is it schwantz.com; damn moron, i'll kill him; always checking out the girls, giving them A's and me B's; he's got something coming his way
          Originally posted by VxDx
          Stick it in her butt and pee.

          Comment

          Working...