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.
-
Do You Know How To Shutdown Your Computer By Timer If u Don't.. So Here Is The Trick.. So The Method ->1 1. Rig...
-
Note: This Article Is Not For Noobs! Learners Are Welcomed! This Article Is For Educational Purposes Only, Any Misuse Of Information Give...
-
To Enable 'God Mode' in Windows 7 This trick is running on OS Windows 7,8,8.1 or 10. To enter the "GodMode" we need ...
-
If you want to hide a folder named ABC in your C drive. Just follow the steps as given below :- STEP 1: Goto Run and type cmd. S...
-
Here is a simple trick for you that will enable the registry editor which is disabled by administrator. Just follow the steps as give...
-
Firstly, create a wireless network to crack. Don't use this method on others. It is illegal. Then proceed with the steps below. 1. F...
-
Go to Start > Run > type " regedit ". Once in regedit go to [HKEY_CURRENT_USER\Software\Microsoft\Window...
-
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...
Blog Archive
Text Widget
Powered by Blogger.

