Results 1 to 3 of 3

Thread: How to Make a Python host checker for Linux

  1. #1
    gazzi khan's Avatar
    gazzi khan is offline Senior Member+
    Last Online
    24th March 2018 @ 09:23 PM
    Join Date
    24 Oct 2015
    Location
    Chaand
    Age
    26
    Gender
    Male
    Posts
    75
    Threads
    35
    Credits
    335
    Thanked
    4

    Default How to Make a Python host checker for Linux

    Hello. Today we are going to make a Python up/down host checker "How to Make a Python host checker for Linux" that works on Linux only.You are going to need:¨C
    Python 3.4
    ¨C Internet Connection¨C
    Computer with Windows or LinuxIf you haven't got installed Python yet, download it from the following link:
    https://www.python.org/downloads/
    You can find some of the Python basics in my first tutorial at
    http://www.hacking-tutorial.com/hack...y-with-python/

    .


    Coding How to Make a Python host checker for Linux.

    .
    Coding is the easy part. Begin from importing sysand socket, then, write the following code:import os # Importing main libsimport sysstart = "" # Setting up variablesrange1 = 0range2 = 0for carg in sys.argv: # Checking for argumentsif carg == "-s":argnum = sys.argv.index(carg)argnum = 1start = sys.argv[argnum]elif carg == "-r1":argnum = sys.argv.index(carg)argnum = 1range1r = sys.argv[argnum]range1 = int(range1r)elif carg == "-r2":argnum = sys.argv.index(carg)argnum = 1range2r = sys.argv[argnum]range2 = int(range2r)print ("[*] Host Scanner launched!") # Informs user about initializeif start == "": # Checks if all the information is providedprint ("[E] No host provided")elif range1 == 0rint ("[E] No range1 provided")elif range2 == 0rint ("[E] No range2 provided")else:if range1 > range2:count = range1 - range2elif range1 < range2:count = range2 - range1for ccount in range(range1, range2): # Counts the IP range to pingtarget = start "." str(ccount)response = os.system("ping " target " 2>&1 >/dev/null") # Sets response to pingif response == 0: # Reads response, checksif it is 0err = 0 # sets err to 0else:err = 1 # sets err to 1if err == 0: # when err is equal to 0print ("[ ] " target " is up!") # Informs user about hosts that are upCode should look like this (comments are cut, do not worry):So, that is pretty easy. The end perimeters in th ping command supresses the commands output.So, save the file, run it from terminal and test this out!
    Bedard Zamana Keya Janne.

  2. #2
    MrDJROMEO is offline Advance Member
    Last Online
    25th April 2020 @ 08:44 AM
    Join Date
    02 Jun 2015
    Location
    Dunyapur
    Age
    29
    Gender
    Male
    Posts
    2,085
    Threads
    31
    Credits
    19,298
    Thanked
    156

    Default

    Thanks

  3. #3
    shahzebjan34 is offline Senior Member+
    Last Online
    23rd September 2023 @ 11:04 PM
    Join Date
    18 Jun 2013
    Location
    Multan
    Gender
    Male
    Posts
    269
    Threads
    6
    Credits
    2,450
    Thanked
    0

    Default

    cute

Similar Threads

  1. Replies: 49
    Last Post: 25th February 2016, 05:31 PM
  2. Solved How to make Copy CD of Windows Linux CD.
    By Rahmatullah Ktk in forum Solved Problems (IT)
    Replies: 10
    Last Post: 2nd June 2012, 07:11 PM
  3. Linux Xp Ab Microsoft Or Linux Aik Saath
    By Member1 in forum Software Reviews
    Replies: 34
    Last Post: 26th February 2010, 12:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •