Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions ctfr.py

This file was deleted.

1 change: 1 addition & 0 deletions ctfr/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ctfr import *
42 changes: 42 additions & 0 deletions ctfr/console.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import argparse
from pyfiglet import figlet_format
from ctfr import get_domains


def print_banner():
""" Render and print the banner """

banner = []
banner.append("____ _____ _____ ____")
banner.append("/ ___|_ _| ___| _ \\")
banner.append("| | | | | |_ | |_) |")
banner.append("| |___ | | | _| | _ < ")
banner.append("\____| |_| |_| |_| \_\\")
banner.append("Version {v} - Hey don't miss AXFR!")
banner.append("Made by Sheila A. Berta (UnaPibaGeek)")
print('\r\n'.join(map(lambda x: x.center(35), banner)))


def main():
""" main function for the program """

print_banner()
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--domain', type=str,
required=True, help="Target domain.")
parser.add_argument('-o', '--output', type=str, help="Output file.")

args = parser.parse_args()

hosts = get_hostnames(args.domain)

print("[!] ---- TARGET: {d} ---- [!] \n".format(d=args.domain))
for host in hosts:
print("[-] {s}".format(s=host))

if args.output is not None:
with open(args.output,"w+") as f:
f.write('\n'.join(hosts))
f.close()

print("\n[!]Done")
23 changes: 23 additions & 0 deletions ctfr/ctfr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import json
import requests

def get_hostnames(domain):
""" query crt.sh and return an array with the list of hostnames"""

hostnames = []
try:
req = requests.get("https://crt.sh/?q=%.{d}&output=json".format(d=domain))

if req.status_code != 200:
raise Exception("Invalid domain or information not available!")

json_data = json.loads('[{}]'.format(req.text.replace('}{', '},{')))

for cert in json_data:
host = cert.get("name_value")
if host not in hostnames:
hostnames.append(host)
except:
return hostnames

return hostnames
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

34 changes: 34 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Project setup script."""

import os
import subprocess

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()

requires = [
'requests',
]

setup(name='CTFR',
version='0.0',
description='Get Transparency logs for getting HTTPS websites subdomains ',
long_description=README,
classifiers=[
],
author='',
author_email='',
url='',
keywords='',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=requires,
entry_points="""\
[console_scripts]
caca = console:main
""",
)