Python 3 Programming Tutorial - Sockets simple port scanner

Python 3 Programming Tutorial - Sockets simple port scanner


In this Python 3 tutorial, we cover using our newly found knowledge on sockets to create a port scanner. It's a pretty slow scanner, but allows us to see it in practice.

Sample code for this basics series: http://pythonprogramming.net/beginner...

Python 3 Programming tutorial Playlist: http://www.youtube.com/watch?v=oVp1vr...

http://seaofbtc.com
http://sentdex.com
http://hkinsley.com
https://twitter.com/sentdex

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Closed Caption:

everybody and welcome to the second part
of our socket tutorial series in this
video what i'm gonna be showing you guys
a simple what's known as a port scanner
basically what a port scanner is going
to do is exactly what it sounds like it
just scans ports and it tells you
whether or not the port is open and
close and generally we kind of have an
idea of what the lower ports are in
their situation is gonna be but you can
quickly find out someone's using
something like FTP or three using ssh or
whatever and obviously port 80 will be
open for like websites and stuff but you
can use this on other people's computers
or you can even use on your own computer
to find out your own vulnerabilities
naturally with this even though this
isn't very as good port scanner not
responsible for how you decide to use a
port scanner I'm just showing you how
they work basically so with that let's
go ahead and we'll keep s equals will
keep what I want to keep the poor don't
need any server IP we're going to make
this request we don't need to send any
requests and we don't need a results and
we don't need any of this
so now what we can do here is we can say
define p scan for define port scan and
we can say the parameters port then we
define what s define s . connect and
then we're going to connect server and
then to port
we've defined server up here finally
mobile actually what we'll do here is
will say try and if that works will
return a true except return false
start8 falls and so what this is asking
basically is we're going to attempt to
connect if we can connect then we'll
make a connection and it's going to
return true for us if we cannot connect
it means the port is not open and it's
going to return false for us okay
and in fact well I will leave this up
here you can put any of anything up here
you can also allow for like employed or
something I got but anyway and now we'll
do is we'll say 4x in range and will say
zero actually say 12 26 ok so this will
test port number 13 port number 25 and
then we're gonna say if peace can ex
print 4x is open so basically what we're
doing is we're passing that x value
whichever x is in this list of power
almost dropped those wounds
anyway for x in this list of one through
26 it's going to throw that value
through the port parameter of our peace
can function and it's going to test it
and then if peace can XO that what we're
asking is if true so if peace can xxxx
either it peace canít x is either
returning true or false so we can ask if
true or if false wet right so if peace
can is true
print that poor texts open otherwise we
have no else statement here so nothing
else will run so will only tell us that
port is open so let's go ahead and save
and run this python programming on that
ok and it's currently running we don't
really see anything occurring at the
moment
really who knows how long this will take
in fact let's go ahead and write a quick
else seems like one second port so
anyway port x is closed and then we'll
add some explanations make this easy
save number okay
actually we saw that port 22 is open
right away so it's just runs one last
time and support was closed for two is
closed for three is close you can see
it's very slow and you know we could run
this through 65,000 ports / thing we're
searching for so obviously this is not
the most efficient port scanner it's
pretty poor so generally what people do
is they will thread the airport scanner
so I thought it'd be kinda neat to show
you guys opportunities open to show you
guys a threaded port scanner so you can
scan multiple ports at one time so
that's the next thing I wanted to show
you guys is a quick threaded port
scanner and then we'll actually get back
on are on the path of sockets and learn
some more about sockets
so anyways stay tuned for that as always
thanks for watching thanks for all the
support subscriptions and until next
time

Video Length: 05:08
Uploaded By: sentdex
View Count: 26,578

Related Software Products
Open Ports Scanner
Open Ports Scanner

Published By:
Filesland

Description:
This utility monitors open TCP and UDP ports on your PC. It brings you an enhanced functionality of a similar tool that comes with Windows operating system: netstat. Open Ports Scanner in addition to the ports information available from your operating system, allows you to map an open port to the process running on your PC. You may easily catch spyware, malware and trojans when using this tool. Just search for suspicious TCP connections. You may instantly terminate unwanted connections right ...


Related Videos
NMap 101: Scanning Networks For Open Ports To Access, HakTip 94
NMap 101: Scanning Networks For Open Ports To Access, HakTip 94

NMap can be used to obtain a much more aggressive scan than the ones we have seen so far. It's very simple to do this too, by simply adding the -A command, like this: nmap -A 10.73.31.64 Aggressive scans simply put together some of the most popularly used commands in Nmap, into one command for you to type. It uses commands such as -O, -sC --traceroute and others. We'll go over these in more detail soon. For now, simply know that -O works for operating system detection, and -sC runs ...
Video Length: 08:51
Uploaded By: Hak5
View Count: 54,875

NMAP port scanning tool
NMAP port scanning tool

please use this tool as a security tool only hr / bClosed Caption:/b font color="#CCCCCC"ok this video is intended for my CIS 160/font classicfont color="#CCCCCC" cochise college it's an/font introduction to information systems classfont color="#E5E5E5" but/fontfont color="#CCCCCC" i understand that/fontfont color="#E5E5E5" this being/font on YouTube a lot of other peoplefont color="#CCCCCC" see/fontfont color="#E5E5E5" ...
Video Length: 04:02
Uploaded By: Clyne Namuo
View Count: 46,761

Netcat 101: Port Scanning in Netcat, Haktip 85
Netcat 101: Port Scanning in Netcat, Haktip 85

Netcat 101: Port Scanning in Netcat! Welcome to HakTip -- the show where we breakdown concepts, tools and techniques for hackers, gurus and IT ninjas. I'm Shannon Morse and today i'm checking out Netcat for port scanning. First off, let's back it up a bit. I got a question at tips@hak5.org that said, "What defines the banner?" so I wanted to clarify it a bit. Last week, we discussed Banner Grabbing with Netcat, which will give you a bit of information about any server or ...
Video Length: 08:29
Uploaded By: Hak5
View Count: 24,618

Visual Basic 2008 Port Scanner + Source Code.avi
Visual Basic 2008 Port Scanner + Source Code.avi

Code: Imports System.Net.Sockets Timer1: TextBox1.Text += 1 Try Dim Range As TcpClient = New TcpClient("127.0.0.1", TextBox1.Text) If Range.Connected = True Then ListBox1.Items.Add(TextBox1.Text & " is Open") End If Catch ex As Exception ListBox1.Items.Add(TextBox1.Text & " is Closed") ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1 End Try
Video Length: 06:40
Uploaded By: hacks1001
View Count: 23,485

Python 3 Programming Tutorial - Threaded port scanner
Python 3 Programming Tutorial - Threaded port scanner

Now that we've seen how to make a simple port scanner in Python 3, we've found that it is quite slow and cumbersome. So here, we tie in our knowledge of the threading module that we learned previously to dramatically improve our performance. Sample code for this basics series: http://pythonprogramming.net/beginner... Python 3 Programming tutorial Playlist: http://www.youtube.com/watch?v=oVp1vr... http://seaofbtc.com http://sentdex.combr ...
Video Length: 09:36
Uploaded By: sentdex
View Count: 19,809

How To Scan an IP Range for Open FTP Servers with Angry IP Scanner
How To Scan an IP Range for Open FTP Servers with Angry IP Scanner

[ http://geekblog.tv/1686 ] In this episode of GeekBlogTV, we take a look at Port Scanning for open FTP Servers to see what kind of juicy goodies we can find being given away! We will be using Angry IP Scanner which you can download from http://www.AngryIP.org for free. Angry IP Scanner runs on Windows, Linux and Apple for both 32 and 64 bit on all platforms; you can also compile from source, or fork a distribution by cloning this git repo from sourceforge: ...
Video Length: 03:31
Uploaded By: GEEKBLOGTV
View Count: 19,144

Visual Basic - How To Create A Port Scanner
Visual Basic - How To Create A Port Scanner

In this tutorial I'm going to show you how to create a port scanner in Visual Basic .net this code works incredibly well but is only a foundation base there's many additional features you can add to this function in order to make it more professional and user friendly. Dependent on this videos popularity I will release tutorials in the future on further advancements in this application. Why Scan Ports? Ports need to be opened / forwarded if you're wanting to allow incoming and ...
Video Length: 09:52
Uploaded By: WizzTechCommunity
View Count: 18,659

Copyright © 2025, Ivertech. All rights reserved.