GithubHelp home page GithubHelp logo

lookup's Introduction

lookup

Provides corresponding ip address or hostname for given input

Requirements

Requires Python 3.6+

Usage

Lookup will write EXCEPTION if cannot be resolved.

Inputs need not be uniform. Can be a mixture of ip and hostname.

Pass in hostnames file

./lookup.py hostnames
facebook.com             31.13.69.228
twitter.com              104.244.42.129
google.com               172.217.12.142
youtube.com              172.217.12.142
linkedin.com             108.174.10.10
...

Pass in ip file

./lookup.py ips
31.13.69.228     edge-star-mini-shv-01-iad3.facebook.com
104.244.42.1     104.244.42.1
172.217.11.14    lga25s60-in-f14.1e100.net
172.217.11.46    lga25s61-in-f14.1e100.net
108.174.10.10    108-174-10-10.fwd.linkedin.com
...

Command line pass in hostname

./lookup.py facebook.com
facebook.com 31.13.69.228

Command line pass in mixture of ip and hostnames

./lookup.py 31.13.69.228 twitter.com google.com
31.13.69.228 edge-star-mini-shv-01-iad3.facebook.com
twitter.com  104.244.42.65
google.com   172.217.10.14

Print only inputs

./lookup.py hostnames | awk '{print $1}'
facebook.com
twitter.com
google.com
youtube.com
linkedin.com
...

Print only outputs

./lookup.py hostnames | awk '{print $2}'
31.13.69.228
104.244.42.1
172.217.12.206
172.217.6.238
108.174.10.10
...

Write to file

./lookup.py hostnames | tee hostnames.out
twitter.com              104.244.42.129
google.com               172.217.12.142
youtube.com              172.217.12.142
linkedin.com             108.174.10.10
...

Get output from file

awk '{print $2}' hostnames.out
31.13.69.228
104.244.42.129
172.217.12.142
172.217.12.142
108.174.10.10
...

Exception example

grep EXCEPTION hostnames.out | head -1
miitbeian.gov.cn         EXCEPTION: [Errno 8] nodename nor servname provided, or not known

lookup's People

Contributors

raywong702 avatar rwong2888 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.