Scan VNC script 01 #! /Usr/bin/perl02 03use IO: Socket; 04 05if ($ ARGV [0]) 06 {07 open (IN, "<$ ARGV [0]") | die "[-] Can't open $ ARGV [0]! \ N "; @ ips = <IN>; close (IN); 08 09 foreach $ ip (@ ips) 10 {11 chomp ($ ip); 12 if (! Fork () 13 {14 local $ SIG {ALRM} = sub {die ("-\ n") ;}; 15 alarm (4); 16 $ socket = IO :: socket: INET-> new (PeerAddr => $ ip, PeerPort => 5900, Proto => "tcp", Timeout => 2); 17 if ($ socket) 18 {19 $ socket-> read ($ protocol, 12); 20 $ socket-> print ($ protocol); 21 22 $ socket-> read ($ NoOfSecTypes, 1 ); 23 $ nost = unpack ("H2", $ NoOfSecTypes); 24 25 if ($ nost! = '00') 26 {27 $ socket-> read ($ chal, $ nost); 28 $ resp = pack ("H2", '01 '); 29 $ socket-> print ($ resp); 30 $ socket-> read ($ result, 4); 31 $ r = unpack ("H8", $ result ); 32 if ($ r eq "00000000") 33 {34 print ("-> $ ip <VULN> \ n"); 35 open (VL, "> vuln.txt") | die "[-] Can't open vuln.txt! \ N "; 36 print VL" $ ip \ n "; 37 close (VL); 38} 39} 40} 41 alarm 0; 42 exit (0 ); 43} 44 wait; 45} 46}