FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
some-scripts/HTTP_Extract_HTML_Comments.py at main · itaymigdal/some-scripts · GitHub
itaymigdal
/
some-scripts
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
18
Code
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
some-scripts
/
HTTP_Extract_HTML_Comments.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (27 loc) · 797 Bytes
Breadcrumbs
some-scripts
/
HTTP_Extract_HTML_Comments.py
Copy path
File metadata and controls
32 lines (27 loc) · 797 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
25
26
27
28
29
30
31
32
from
bs4
import
BeautifulSoup
,
Comment
import
requests
from
sys
import
argv
from
os
import
path
def
get_soup
(
url
):
try
:
downloaded_html
=
requests
.
get
(
url
)
if
downloaded_html
.
status_code
!=
200
:
raise
except
:
print
(
"
\n
[-] ERROR: Invalid URL
\n
"
)
exit
(
0
)
soup
=
BeautifulSoup
(
downloaded_html
.
text
,
'html.parser'
)
return
soup
def
get_comments
(
soup
):
for
comments
in
soup
.
findAll
(
text
=
lambda
text
:
isinstance
(
text
,
Comment
)):
print
(
""
)
print
(
comments
.
extract
())
print
(
""
)
def
main
():
if
len
(
argv
)
!=
2
:
print
(
"
\n
[-] Usage: python {} <URL>
\n
"
.
format
(
path
.
basename
(
__file__
)))
exit
(
0
)
url
=
argv
[
1
]
soup
=
get_soup
(
url
)
get_comments
(
soup
)
main
()
Back
|
FazBrowse Home
|
New Git URL