File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ # IP from Hostname
2
+
3
+ ## 📝 Description
4
+ * This Python script takes a URL as an input and returns the corresponding IP address
5
+ * The script uses <a href =" https://docs.python.org/3/library/socket.html " >socket library</a > for this purpose
6
+
7
+ <br >
8
+
9
+ ## ⚙️ How To Use
10
+
11
+ Navigate to the project directory and run the following command :
12
+ ``` bash
13
+ python ip_from_hostname.py
14
+ ```
15
+
16
+ ## Output Screenshot
17
+
18
+ <img src =" output.png " >
19
+
20
+ ## Author
21
+
22
+
23
+ * <a href =" https://github.com/singhchanmeet " > Chanmeet Singh </a >
24
+
25
+
Original file line number Diff line number Diff line change
1
+ import socket
2
+
3
+ hostname = input ("Enter the URL: " )
4
+
5
+ try :
6
+ ip_address = socket .gethostbyname (hostname )
7
+ print (ip_address )
8
+ except :
9
+ print ('Invalid URL' )
10
+
You can’t perform that action at this time.
0 commit comments