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

Getting auto Cookie for fully automation #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
128 changes: 75 additions & 53 deletions webcache.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import requests
#!/usr/bin/python3
#-*- coding: utf-8 -*-

import os
try:
import requests
except:
os.system("pip3 install requests")

import sys

try:
import browsercookie
except:
os.system("pip3 install browsercookie")

from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning

headers = {"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","Upgrade-Insecure-Requests":"1","Connection":"close","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36","Referer":"https://www.site.com/teams/","Accept-Language":"en-US,en;q=0.8"}
cookies = {"Paste Cookies Here"}
cookies = browsercookie.chrome()

short_extensions = ['css','png','jpg','gif','txt','js','swf','bmp']
large_extensions = ['aif','aiff','css','au','avi','bin','bmp','cab','carb','cct','cdf','class','css','doc',' dcr',' dtd',' gcf',' gff',' gif',' grv',' hdml',' hqx',' ico',' ini',' jpeg',' jpg',' js',' mov',' mp3',' nc',' pct',' ppc',' pws',' swa',' swf',' txt',' vbs',' w32',' wav',' wbmp',' wml',' wmlc',' wmls',' wmlsc',' xsd',' zip']
Expand All @@ -11,58 +27,64 @@
results=[]
possible_result=[]
urls = sys.argv[1]
try:
with open(urls,'r') as f:
for j in f.readlines():
j=j.strip('\n')
j=j.strip('\r')
url = j
#print url
unsession = requests.get(url)
session = auth.get(url, headers=headers, cookies=cookies)
print '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
print '[+] Authenticated Detail [+] '+'\n'
print 'URL : '+session.url
print 'Status Code : '+str(session.status_code)
print 'Content Length: '+str(len(session.content))
print '\n'
print '[+] UnAuthenticated Details [+] '+'\n'
print 'URL : '+unsession.url
print 'Status Code : '+str(unsession.status_code)
print 'Content Length : '+str(len(unsession.content))+'\n'
print '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
if unsession.history:
for resp in unsession.history:
print 'Redirected From : '+resp.url
print 'With Status Code : '+str(resp.status_code)
print '\n'
print '\n~~~~~ATTACK~~~~~\n'
for i in short_extensions:
i = i.strip('\n')
i = i.strip('\r')
i = 'testsheet.'+i
newurl=url+i
newsession = auth.get(newurl, headers=headers, cookies=cookies)
print 'Trying ... -> '+str(newurl)+'\n'
conditionContent = str(len(newsession.content)+100) # To Avoid False Positivie

#print conditionContent
if len(newsession.content) == len(session.content) | (newsession.status_code) == (session.status_code):
print '100% Cache at : '+newurl+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n'
results.append(newurl)
elif len(session.content) > len(newsession.content) & (newsession.status_code) == (session.status_code):
if conditionContent >= len(session.content):
print 'Possible Cache at : '+newurl+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n'
possible_result.append(newurl)
else:
print 'Not Possible , Status code : '+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n'
try:

try:
with open(urls,'r') as f:
for j in f.readlines():
j=j.strip('\n')
j=j.strip('\r')
url = j
unsession = requests.get(url, verify=False)
session = auth.get(url, headers=headers, cookies=cookies, verify=False)
print('\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n')
print('[+] Authenticated Detail [+] '+'\n')
print('URL : '+session.url)
print('Status Code : '+str(session.status_code))
print('Content Length: '+str(len(session.content)))
print('\n')
print('[+] UnAuthenticated Details [+] '+'\n')
print('URL : '+unsession.url)
print('Status Code : '+str(unsession.status_code))
print('Content Length : '+str(len(unsession.content))+'\n')
print('\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n')
if unsession.history:
for resp in unsession.history:
print('Redirected From : '+resp.url)
print('With Status Code : '+str(resp.status_code))
print('\n')
print('\n~~~~~ATTACK~~~~~\n')
for i in short_extensions:
i = i.strip('\n')
i = i.strip('\r')
i = 'testsheet.'+i
newurl=url+i
newsession = auth.get(newurl, headers=headers, cookies=cookies, verify=False)
print('Trying ... -> '+str(newurl)+'\n')
conditionContent = str(len(newsession.content)+100) # To Avoid False Positivie

#print conditionContent
if len(newsession.content) == len(session.content) | (newsession.status_code) == (session.status_code):
print('100% Cache at : '+newurl+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n')
results.append(newurl)
elif len(session.content) > len(newsession.content) & (newsession.status_code) == (session.status_code):
if conditionContent >= len(session.content):
print('Possible Cache at : '+newurl+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n')
possible_result.append(newurl)
else:
print('Not Possible , Status code : '+str(newsession.status_code)+', Length:'+str(len(newsession.content))+'\n')

except KeyboardInterrupt as e:
print 'Error occured : '+str(e)+'\n'
pass
except KeyboardInterrupt as e:
print('Error occured : '+str(e)+'\n')
pass

except:
print("\033[1;33;40m Program Can't Scan This Site: \033 " + url)
print("\033[1;34m------------------------------------------------------------------------------------------------------------ \033")

print '[+] Results '+str(len(results))+'\n'
print results
print('\033[1;32m[+]\033 Results: \033[1;32m ' + str(len(results)) + '\n' + ' \033')
print(results)

print '[+] Possible Results '+str(len(possible_result))+'\n'
print possible_result
print('\033[1;32m[+] \033 Possible Results: \033[1;32m ' + str(len(possible_result)) + '\n' + ' \033')
print(possible_result)