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

Add proxy support #16

Open
wants to merge 4 commits 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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ $ python3 ctfr.py -d starbucks.com
$ python3 ctfr.py -d facebook.com -o /home/shei/subdomains_fb.txt
```

### Use through a proxy
Just uncomment and modify variables 'http' and 'https' from 'proxies' array:
```
proxies = {
# Uncomment 'http' and 'https' variables if you need:
# 'http': 'http://username:password@hostname:port',
# 'https': 'http://username:password@hostname:port',
}
```

### With Docker
I think it's a little bit crazy to use Docker for running such a little python script, but if you want to do it anyway, you can download [this lightweight (97.8MB) Docker image](https://hub.docker.com/r/johnpaulada/ctfr/) made by John Paulada.

Expand All @@ -58,5 +68,9 @@ The instructions are there.
</p>



## Author
* *Sheila A. Berta - [(@UnaPibaGeek)](https://www.twitter.com/UnaPibaGeek).*

### Proxy support
* *Javier L. Ceron - [(@neohitokiri)](https://www.twitter.com/neohitokiri).*
17 changes: 14 additions & 3 deletions ctfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## # CONTEXT VARIABLES # ##
version = 1.2


## # MAIN FUNCTIONS # ##

def parse_args():
Expand Down Expand Up @@ -46,20 +47,30 @@ def save_subdomains(subdomain,output_file):
f.close()

def main():

proxies = {
# Uncomment http and https variables:
# 'http': 'http://username:password@hostname:port',
# 'https': 'http://username:password@hostname:port',
}

banner()
args = parse_args()

subdomains = []
target = clear_url(args.domain)
output = args.output

req = requests.get("https://crt.sh/?q=%.{d}&output=json".format(d=target))
req = requests.Session()
req.proxies = proxies

if req.status_code != 200:
response = req.get("https://crt.sh/?q=%.{d}&output=json".format(d=target))

if response.status_code != 200:
print("[X] Information not available!")
exit(1)

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

for (key,value) in enumerate(json_data):
subdomains.append(value['name_value'])
Expand Down