FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Hacking-with-Python/01/inforecon.py at main · flypythoncom/Hacking-with-Python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
flypythoncom
/
Hacking-with-Python
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Hacking-with-Python
/
01
/
inforecon.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (18 loc) · 571 Bytes
Breadcrumbs
Hacking-with-Python
/
01
/
inforecon.py
Copy path
File metadata and controls
24 lines (18 loc) · 571 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import
sys
import
requests
import
socket
import
json
if
len
(
sys
.
argv
)
<
2
:
print
(
"Usage: "
+
sys
.
argv
[
0
]
+
"<url>"
)
sys
.
exit
(
1
)
req
=
requests
.
get
(
"https://"
+
sys
.
argv
[
1
])
print
(
"
\n
"
+
str
(
req
.
headers
))
gethostby_
=
socket
.
gethostbyname
(
sys
.
argv
[
1
])
print
(
"
\n
The IP address of "
+
sys
.
argv
[
1
]
+
" is: "
+
gethostby_
+
"
\n
"
)
#ipinfo.io
req_two
=
requests
.
get
(
"https://ipinfo.io/"
+
gethostby_
+
"/json"
)
resp_
=
json
.
loads
(
req_two
.
text
)
print
(
"Location: "
+
resp_
[
"loc"
])
print
(
"Region: "
+
resp_
[
"region"
])
print
(
"City: "
+
resp_
[
"city"
])
print
(
"Country: "
+
resp_
[
"country"
])
Back
|
FazBrowse Home
|
New Git URL