Ethical Experts
Ethical Experts

A Community Dedicated to Helping and Learning . Here You Will Get Hacking Tutorials and Monetizing Methods . We Hope You Have a Pleasant Stay
HomeHome  SearchSearch  FAQFAQ  RegisterRegister  Log in  
Still Currently working on the forum design, until I find a perfect design that can sit there for the whole life :p .. Please Bare with us if you see the design change while / after you refresh a page or return ! Sorry for the Inconvenience ~!

Display results as :
Rechercher Advanced Search
Latest topics
» Hack Pack : Largest Hacking Tools Collection
Tue Apr 28, 2015 9:35 am by THE-OUTSIDER

» Hi everyone!
Fri Nov 07, 2014 11:24 pm by zekrum

» Hacking Email ID's
Thu Sep 25, 2014 7:22 pm by NAVEEN KUMAR . S

» entering in a computer binary
Sat Sep 20, 2014 1:29 pm by erosh23

» hi hackers
Sat Sep 20, 2014 1:26 pm by erosh23

» Introduce Yourself !
Sat Sep 20, 2014 1:23 pm by erosh23

» Hello guys
Wed Jul 30, 2014 10:52 pm by RZero67

» need botnet like zues Betabot or any good botnet files please admin help me
Fri Jul 25, 2014 9:44 pm by sire_roktiv

» Extension Spoofer v0.1 [Beta Release]
Fri Jul 11, 2014 9:33 am by The Joker

Most Viewed Topics
Hack Pack : Largest Hacking Tools Collection
Hack Your BroadBand !! RISK FREE !!
How to Hack the Windows Admin Password Using OphCrack in Backtrack tutorial
Hacking With Keyloggers Prorat
How to Get Unlimited time in an Internet Cafe ... :D
How to Hack Websites & Servers - Tutorial
Cracking a WPA/WPA-2 Password.. ;)
Backtrack and Facebook
Credit Card Generating Sequence
LARGEST netcat hack wifi
Facebook Like
Similar topics

Share | 

 Making a SImple Port Scanner In Different languages

Go down 
The Joker
The Joker

Posts : 182
Join date : 2012-06-11
Age : 28

PostSubject: Making a SImple Port Scanner In Different languages    Wed Aug 15, 2012 7:39 am

Lets make a simple port scanner with opens a full TCP connection to detect if a port is open or not.
This is not the best way to scan because it makes a lot of noise, some other ways are Half TCP (TCP SYN) and TCP FIN.
Code in python::

import socket
i = “″
for p in range(19, 26):
spy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
spy.connect((i, p)
print p,” Open”
except :
print p,”closed”
It searches from port 19 to 25. The data is hard coded but sys.argv[] can be used to take arguments from command line.. Python is indent sensitive and here I can’t find any [code] tag so if you copy paste the above code it will give errors the indentation should be corrected to work properly.
Code in Perl::

use IO::Socket;
$port = 19;
while ($port < 26){
$spy = new IO::Socket::INET (PeerAddr => '',
PeerPort => $port,
Proto => 'tcp');
if ($spy){
close $spy;
print "$port -open\n";
$port = $port + 1;
print "$port -closed\n";
$port = $port + 1;

Code in Ruby::

require 'socket'
require 'timeout'
ports = 19..26
ports.each do |spy|
Timeout::timeout(10){"", spy)}
puts "closed : #{spy}"
puts "open : #{spy}"
Code in Java::

public class javaps {
public static void main(String[] args)
String remote = "";
for (int port = 19; port <= 26; port++) {
try {
Socket s = new Socket(remote, port);
System.out.println("The port " + port + " of " + remote + " is open");
catch (IOException ex) {
System.out.println("The port " + port + " of " + remote + " is closed");

These are just one way of coding port scanners
Back to top Go down
View user profile
Making a SImple Port Scanner In Different languages
Back to top 
Page 1 of 1
 Similar topics
» Exception in thread "main" Selenium is already running on port 4444. Or some other service is.
» Need to do a simple Left Click in a text box
» Loneliness. Do you find that Migraine is making you feel lonely...
» Pattern-Making Calculator
» Still getting "unable to connect to host on port 7055 after 45000 ms"

Permissions in this forum:You cannot reply to topics in this forum
Ethical Experts :: Hacking Section :: Hacking Tutorials-
Jump to: