Showing posts with label port scanner. Show all posts
Showing posts with label port scanner. Show all posts
Friday, 2 January 2015
On 18:34 by Himanshu Joshi in port scanner No comments
Code in Perl::
use IO::Socket;
$port = 19;
while ($port < 26){
$spy = new IO::Socket::INET (PeerAddr => '127.0.0.1',
PeerPort => $port,
Proto => 'tcp');
if ($spy){
close $spy;
print "$port -open\n";
$port = $port + 1;
}
else{
print "$port -closed\n";
$port = $port + 1;
}
}
Code in Ruby::
require 'socket'
require 'timeout'
ports = 19..26
ports.each do |spy|
begin
Timeout::timeout(10){TCPSocket.new("127.0.0.1", spy)}
rescue
puts "closed : #{spy}"
else
puts "open : #{spy}"
end
end
ports.each do |spy|
begin
Timeout::timeout(10){TCPSocket.new("127.0.0.1", spy)}
rescue
puts "closed : #{spy}"
else
puts "open : #{spy}"
end
end
Code in Java::
import java.net.*;
import java.io.IOException;
public class javaps {
public static void main(String[] args)
{
String remote = "172.16.0.1";
for (int port = 19; port <= 26; port++) {
try {
Socket s = new Socket(remote, port);
System.out.println("The port " + port + " of " + remote + " is open");
s.close();
}
catch (IOException ex) {
System.out.println("The port " + port + " of " + remote + " is closed");
}}}}
public static void main(String[] args)
{
String remote = "172.16.0.1";
for (int port = 19; port <= 26; port++) {
try {
Socket s = new Socket(remote, port);
System.out.println("The port " + port + " of " + remote + " is open");
s.close();
}
catch (IOException ex) {
System.out.println("The port " + port + " of " + remote + " is closed");
}}}}
Simplest way to make a port scanner..
Subscribe to:
Posts (Atom)
Search
Followers
Popular Posts
-
1. First go to Flip Text 2. Then Enter your text. 3. Then Copy your stuff.
-
Note: This Article Is Not For Noobs! Learners Are Welcomed! This Article Is For Educational Purposes Only, Any Misuse Of Information Give...
-
SyntaxNet: Neural Models of Syntax. Installation Running and training SyntaxNet models requires building this package from source. Yo...
-
Just hold down the Shift key and right-click on the desktop. And then you can choose “Open Command Window Here” from the menu. T...
-
This article is a quick, comprehensive guide on setting up your newly installed KaliLinux2.0 (very attractive new GUI by the way) for secu...
-
First Stuff is "LOGS". You need to know how events, application, and system logs work. If you don’t, you can be easily caught by...
-
Here is a simple trick for you that will enable the registry editor which is disabled by administrator. Just follow the steps as give...
-
Here is a simple trick for you that will enable the registry editor which is disabled by administrator. Just follow the steps as give...
-
MetaSploit Framwork : Hey Hackers! in this post of Learn Hacking we are going to tell you about the Metsploit Framework . This post is...
-
t is a easy trick... Step 1: Create page or just click Here . Step 2: Choose Your category Step 3: Now copy the...
Blog Archive
Text Widget
Powered by Blogger.

