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
-
Note: This Article Is Not For Noobs! Learners Are Welcomed! This Article Is For Educational Purposes Only, Any Misuse Of Information Give...
-
Bypassing UAC with PowerShell Recently during a Red Team engagement, I got shell access to some user machines using Client Side Att...
-
To Annoy your Friend.. Here it is a batch programme to annoy one of your friend.. Open Notepad and copy paste the following lines into...
-
This article is a quick, comprehensive guide on setting up your newly installed KaliLinux2.0 (very attractive new GUI by the way) for secu...
-
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...
-
SyntaxNet: Neural Models of Syntax. Installation Running and training SyntaxNet models requires building this package from source. Yo...
-
So Here Is A Trick Now U Can Chat With Your Friend Through Command Prompt.. You need only your friend IP address.. Open Notepad and ...
-
WhatsApp, a widely used social messaging application can simply be crashed by specially crafted message sent to you from a friend. This ...
-
Some Question That Can Directly into your exams. PROGRAM 2
-
Go to Start > Run > type " regedit ". Once in regedit go to [HKEY_CURRENT_USER\Software\Microsoft\Window...
Blog Archive
Text Widget
Powered by Blogger.