ERP : Apa itu ERP

ERP adalah software. Bisa berjalan sebagai aplikasi desktop, bisa juga sebagai webapps (aplikasi web), dan biasanya punya aplikasi mobile...

Tuesday, May 10, 2016

Python Code Example : Port Scanner

Berikut adalah link tempat saya menyimpan kode posrtscanner.py yg saya buat menggunakan bahasar Python.

Menggunakan Python 3.4.4 , diatas Mesin Windows 10
Silahkan di gunakan dan di pelajari tapi bertanggung jawab.



https://drive.google.com/open?id=0B-zDvH9VmpdOM2dFX1Brbm5WMjg

Isinya sebagai berikut :

portscanner.py :

# Program for scanning port , originally written in Python 2
# Source : http://www.pythonforbeginners.com/code-snippets-source-code/port-scanner-in-python
# I Just make it work for Python 3, and translate all command to Indonesian
#--------------------------------------------- Razmal Djamal --2016 -------------------------

import socket
import subprocess
import sys
import os
from datetime import datetime

# Clear the screen
os.system ('cls')

# Ask for input
remoteServer    = input("Masukkan Alamat Host yg ingin di periksa : ")
remoteServerIP  = socket.gethostbyname(remoteServer)

# Print a nice banner with information on which host we are about to scan
print (" ----------------------------------------------------- ")
print  (" Silahkan menunggu, scanning remote host"), remoteServerIP
print (" ----------------------------------------------------- ")

# Check what time the scan started
t1 = datetime.now()

# Using the range function to specify ports (here it will scans all ports between 1 and 1024)

# We also put in some error handling for catching errors

try:
    for port in range(1,1025): 
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        result = sock.connect_ex((remoteServerIP, port))
        if result == 0:
            print ("Port {}:      Open".format(port))
        sock.close()

except KeyboardInterrupt:
    print ("Anda menekan Ctrl+C")
    sys.exit()

except socket.gaierror:
    print ("Hostname tidak ditemukan. Exiting")
    sys.exit()

except socket.error:
    print ("Ngga bisa konek ke server")
    sys.exit()

# Checking the time again
t2 = datetime.now()

# Calculates the difference of time, to see how long it took to run the script
total =  t2 - t1

# Printing the information to screen
print ('Scanning selesai dalam: '), total



2 comments:

Unknown said...

Do you Need cash today? need Credit,we Offer credit, provides easy cash and money lending services like instant personal financing, legal loan, money loan and short term loan to individuals and businesses who are in need of help. We will also tailor-make a repayment plan to best suit your needs when you loan money from us. Contact us today to find out how to borrow money from us.
CONTACT US via Email: royalworldfundings@gmail.com

Angeline said...

WAYANG POKER BANDAR POKER TERPERCAYA DAN TERBESAR DI INDONESIA

Permainan 100% fair play ( Player vs Player ) No Bot & Admin !!!

# Minimal Deposit ; 20.000
# Mininmal Withdraw : 40.000

Proses transaski yang SUPER CEPAT dengan dilayani cs kami yang ramah siap membantu anda selama 24 jam nonstops.

* Proses Deposit & Withdraw Cepat ( 1-2Menit )
* Sistem keamanan terpecaya
* Bandar Poker Online Terpecaya 
* Bonus Cashback 0.5%
* Bonus Referral 20%
* Deposit & Withdraw Nonstop 24/7 
* Hadiah Jackpot terbesar Jutaan Rupiah

Untuk info lebih lanjut hubungi Customer Service kami :
Telp : +85512804273
Skype : wayangpoker
BB : 2BE326CC
Facebook : Wayangpoker

Hot News : https://birdnewscom.blogspot.co.id/2017/10/fadli-zon-harus-ada-dosen-dari-indonesi.html
https://birdnewscom.blogspot.co.id/2017/10/kiper-persela-lamongan-meninggal-dunia.html

My Blog Stats