-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchanakya.py
185 lines (166 loc) · 7.44 KB
/
chanakya.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Copyright Cyb3r3x3r - Indian Cyber Ghosts
# New update = v0.1.7
from re import search, sub
import requests
import socket
import os
import sys
import whois
import time
w = '\033[1;97m'
g = '\033[1;32m'
r = '\033[1;31m'
y = '\033[1;33m'
e = '\033[1;m'
# This program is free to modify and develop
# Add your own ideas to it....but don't try to own in....atleast mention my name .. Cyb3r3x3r
# http://www.sniperhacks.wordpress.com/
Version = 'v0.1.7'
class chanakya:
def __init__(self):
self.clscr()
self.logo()
self.help()
print('')
victim = str(input('{}[?] Enter the target url{} > '.format(y,e)))
try:
if victim.startswith('http://'):
victim = victim.replace('http://','')
elif victim.startswith('https://'):
victim = victim.replace('https://','')
except:
pass
print('{} [~] Starting getting informations ...... {}'.format(g,e))
time.sleep(3)
ip = socket.gethostbyname(victim)
print('{} [+] IP Address = {}{}'.format(g,ip,e))
print('')
self.check_joom(victim)
print('')
self.wp_check(victim)
print('')
self.check_drup(victim)
print('')
print('{} [~] Getting robots.txt.....be patient {}'.format(y,e))
try:
self.robots(victim)
except:
print('{} [-] looks like robots.txt can\'t be retrieved{}'.format(r,e))
print('')
self.honey(ip)
print('')
print('{} [~] Scanning port with nmap scanner....{}'.format(y,e))
self.portscan(ip)
print('')
self.whois(victim)
print('{} [!] Done Getting Info....Exitting....{}'.format(w,e))
def logo(self):
print("""{}
_______ __ __
| _ | | |--. .---.-. .-----. .---.-. | |--. .--.--. .---.-.
|. 1___| | | | _ | | | | _ | | < | | | | _ |
|. |___ |__|__| |___._| |__|__| |___._| |__|__| |___ | |___._|
|: 1 | |_____|
|::.. . | Developed By Cyb3r3x3r - ICG
`-------'
{}""".format(y,e))
def clscr(self):
lin = 'clear'
win = 'cls'
os.system([lin,win][os.name == 'nt'])
def help(self):
print('{}----------------------------------------{}'.format(y,e))
print('{}[!] Usage : python chanakya.py {}'.format(y,e))
def robots(self,victim):
try:
robot = requests.get('http://' + victim + '/robots.txt',timeout=10).text
print('{}--------------------------------------{}'.format(y,e))
if '<title>' in robot:
print('{} [-] Looks like there is a problem retrieving robots.txt {}'.format(r,e))
else:
print('{} [+] Robots.txt retrieved {}'.format(g,e))
print('{}{}{}'.format(g,robot,e))
except:
pass
def portscan(self,ip):
try:
scan = requests.get('http://api.hackertarget.com/nmap/?q=' + ip,timeout=10).text
result = sub(r'Starting[^<]*\)\.', '', scan)
result = sub(r'Service[^<]*seconds', '', scan)
print('{}[+]{}{}'.format(g,result,e))
except:
print('{}[-]Port Scan can not be completed....Skipping...{}'.format(r,e))
time.sleep(2)
def honey(self,ip):
print('{} [~] Checking Honeypot Probability from online source.........{}'.format(w,e))
match = {"0.0": 0, "0.1": 10, "0.2": 20, "0.3": 30, "0.4": 40, "0.5": 50, "0.6": 60, "0.7": 70, "0.8": 80, "0.9": 90, "1.0": 10}
try:
gethoney = requests.get('https://api.shodan.io/labs/honeyscore/' + str(ip) + '?key=C23OXE0bVMrul2YeqcL7zxb6jZ4pj2by',timeout=10).text
print('{} [+] HoneyPot Check Result = {}{}'.format(g,gethoney,e))
print('{} [+] HoneyPot Probability Result = {}{}'.format(g,match[gethoney],e))
check = float(gethoney)
if check >= 0.0 and check <= 0.4:
print('{} [+] Looks like it is a REAL SYSTEM {}'.format(g,e))
else:
print('{} [-] Oh! It is a HONEYPOT SYSTEM {}'.format(r,e))
except:
print('{}[-] It looks like HoneyPot Check can not be completed.{}'.format(r,e))
def whois(self,url):
print('{} [~] Doing Whois Lookup.......{}'.format(y,e))
try:
info = whois.whois(url)
print('\033[1;32m[+] Domain Name = ',info.domain_name)
print('[+] Registrar = ',info.registrar)
print('[+] Whois Server = ',info.whois_server)
print('[+] Referral Url = ',info.referral_url)
print('[+] Update Date = ',info.updated_date)
print('[+] Creation Date = ',info.creation_date)
print('[+] Expiration Date = ',info.expiration_date)
print('[+] Name Servers = ',info.name_servers)
print('[+] Status = ',info.status)
print('[+] Emails = ',info.emails)
print('[+] DNSSEC = ',info.dnssec)
print('[+] Name = ',info.name)
print('[+] Organization = ',info.org)
print('[+] Address = ',info.address)
print('[+] City = ',info.city)
print('[+] State = ',info.state)
print('[+] Zipcode = ',info.zipcode)
print('[+] Country = \033[1;m',info.country)
except Exception:
print('{} [-] Some Error occurred while getting whois information..{}'.format(r,e))
def check_joom(self,url):
try:
print('{} [~] Checking Joomla Installation.......{}'.format(y,e))
time.sleep(2)
joom = requests.get('http://' + url,timeout=5).text
if '/administrator' in joom or '/joomla/' in joom or 'content=\"Joomla!' in joom:
print('{}[+] Joomla Installation Found...{}'.format(g,e))
else:
print('{}[!] No Joomla Installation Found...{}'.format(y,e))
except Exception:
print("{}[-] Some error Occurred....Continuing....{}".format(r,e))
def wp_check(self,url):
try:
print('{} [~] Checking Wordpress Installation.......{}'.format(y,e))
time.sleep(2)
wp = requests.get('http://' + url,timeout=5).text
if '/wp-admin' in wp or '/wp-content' in wp:
print('{}[+] Wordpress Installation Found...{}'.format(g,e))
else:
print('{}[!] No Wordpress Installation Found...{}'.format(y,e))
except Exception:
print("{}[-] Some error Occurred....Continuing....{}".format(r,e))
def check_drup(self,url):
try:
print('{} [~] Checking Drupal Installation.......{}'.format(y,e))
time.sleep(2)
drupal = requests.get('http://' + url,timeout=5).text
if '/user' in drupal:
print('{}[+] Drupal Installation Found...{}'.format(g,e))
else:
print('{}[!] No Drupal Installation Found...{}'.format(y,e))
except Exception:
print("{}[-] Some error Occurred....Continuing....{}".format(r,e))
cyb = chanakya()
cyb