Banner Grabbing with Python

In the Previous post we saw the basics of banner grabbing techniques. Now here i wrote a basic python script, which grab banner for a given domain name.

The script will basically send https request using curl and print the http headers.

+=+=+=+=+=+==+=+=+=+=+
# Banner Grep Script #
# By : sec-art.net   #
+=+=+=+=+=+==+=+=+=+=+

usage: BannerGrab.py [-h] [-d DOMAIN] [-o OUTPUT]

optional arguments:
  -h, --help            show this help message and exit
  -d DOMAIN, --domain DOMAIN
                        Domain name to Grep Banner
  -o OUTPUT, --output OUTPUT
                        Output file name to store output

Usage :

To grep banner

python3 BannerGrab.py -d google.com 

Output :

HTTP/1.1 200 OK
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Date: Wed, 22 Sep 2021 18:34:50 GMT
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Transfer-Encoding: chunked
Expires: Wed, 22 Sep 2021 18:34:50 GMT
Cache-Control: private
Set-Cookie: 1P_JAR=2021-09-22-18; expires=Fri, 22-Oct-2021 18:34:50 GMT; path=/; domain=.google.com; Secure
Set-Cookie: NID=511=ByeoT-dMsiEmHkCol2cFejLygYosRRmT_LwqLzToAwOga2fLBHz9Ewix_jYOwoV0ncDssbdNifF3LMttyJhJMZS6jlZvnOv5Ud2LhiBEXMUYMi-6hw0KumFrwV_Tyki-6C3JmifKxP4_xa_MGqzpHtfl9wQ1nnYG26MqNe6JdnU; expires=Thu, 24-Mar-2022 18:34:50 GMT; path=/; domain=.google.com; HttpOnly

Store the output into a file

python3 BannerGrab.py -d google.com -o banner.txt

Github Repository Link : https://github.com/Ajaytekam/BannerGrab

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.