Author Topic: [Perl] Port Scanner  (Read 2291 times)

0 Members and 3 Guests are viewing this topic.

Offline Axon

  • VIP
  • King
  • *
  • Posts: 2047
  • Cookies: 319
    • View Profile
[Perl] Port Scanner
« on: February 19, 2012, 12:17:54 am »
Code: [Select]
use Socket;
$host="xxx.xxx.xxx.xxx.";                                (XXX.xxxx.xxxx.xxx)  Type here your ip
 
print("Scan $host:\n");
for($i=0; $i<65000; $i++){                ( Type here what ports do you want to scan )                           
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
$iaddr = inet_aton($host);
$paddr = sockaddr_in($i, $iaddr);
if(connect(SOCK, $paddr)){
print("$i - OK\n");
}else{
print("$i - NO\n");
}
}
« Last Edit: February 19, 2012, 12:19:22 am by Axon »

Offline FuyuKitsune

  • Knight
  • **
  • Posts: 292
  • Cookies: 21
    • View Profile
Re: [Perl] Port Scanner
« Reply #1 on: February 19, 2012, 03:25:22 am »
How is Perl? The syntax looks so much nicer than Python, I am trapped in C++ style syntax.

Offline 10n1z3d

  • Serf
  • *
  • Posts: 42
  • Cookies: 8
    • View Profile
Re: [Perl] Port Scanner
« Reply #2 on: February 19, 2012, 09:26:44 am »
How is Perl? The syntax looks so much nicer than Python, I am trapped in C++ style syntax.

/facepalm

I was going to argue here, but I will just say that Perl got a reputation of a write-only language, guess why.
Code: [Select]
python -c "print ''.join(chr(x) for x in [int(oct(39)) + 2, 24 * 2, 313 % 203, 0x31, (2 ** 7) - 6, int('051'), (3 << 6) - 92])"

Offline FuyuKitsune

  • Knight
  • **
  • Posts: 292
  • Cookies: 21
    • View Profile
Re: [Perl] Port Scanner
« Reply #3 on: February 20, 2012, 12:06:14 am »
So people write crappy code with it because they can.

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: [Perl] Port Scanner
« Reply #4 on: February 22, 2012, 11:36:02 pm »
TCP connect scan, huge range of ports, hmm