Python Website Scanner Tutorial – 3 – IP Address

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

12 responses to “Python Website Scanner Tutorial – 3 – IP Address”

  1. Abeer Hussain Avatar

    we can also use socket.gethostbyname() to get ip address

  2. baysunny Avatar

    'host' is not recognized as an internal or external command, operable program or batch file.
    what should i do??

  3. malin hess Avatar

    import socket

    # a simple example

    def main():

    # get fully qualified domain name
    ip = raw_input('Enter url ')

    fqdn = socket.gethostbyname(socket.getfqdn(ip))

    print fqdn

    if _name_ == '__main__':
    main()

  4. Carson Avatar

    Where does he get the ava@computer from?
    I get
    'host ' is not recognized as an internal or external command,
    operable program or batch file.
    I am assuming that is because I dont have the ava@computer thing? I am new to this 🙂

  5. Tactical Almonds Avatar

    So doing this on windows with ping and its sort of the same. Running into the problem of trying to truncate the final ~22 characters from the results. Any suggestions??

    Edit: I got it to work.

  6. dhg1234 Avatar

    use split(' ') function

  7. tyubnm564 Avatar

    "has address" will not exist for another languages 🙂

  8. EGN SHOCK Avatar

    is this only for mac?

  9. Mohhinder Suresh Avatar

    You could replace your results line with this:

    results = str(process.read()).split()[3]

  10. Chiab8 Avatar

    It can be done like this:

    from socket import gethostbyname

    def get_ip_address(url)
    return gethostbyname(url)

    Hope it helps!

  11. Mathew Scolari Avatar

    Im getting an error at compile saying that the list index is out of range.

  12. lhamil64 Avatar

    I would have used a regular expression. Just search for /d{1-3}.d{1-3}.d{1-3}.d{1-3}/ and return the first match.

Leave a Reply

Your email address will not be published. Required fields are marked *