From f5ce5034107de95cfb9354dbec3f32277d15086b Mon Sep 17 00:00:00 2001 From: Ammey Saini Date: Mon, 2 Aug 2021 22:12:06 +0530 Subject: [PATCH] Incapsula/VPN Detected Bypass --- bot.py | 84 ++++++++++++++++++++++++++++++++++------------ helper.py | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 3 files changed, 163 insertions(+), 22 deletions(-) create mode 100644 helper.py diff --git a/bot.py b/bot.py index 73096e9..ee60cc1 100644 --- a/bot.py +++ b/bot.py @@ -4,25 +4,24 @@ import random import sys import colorama -from selenium import webdriver -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +from seleniumwire import webdriver from selenium.webdriver.common.keys import Keys -from selenium.webdriver.common.action_chains import ActionChains -from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import Select +import seleniumwire.undetected_chromedriver.v2 as uc from random import randint from __constants.const import * from __banner.myBanner import bannerTop from __colors__.colors import * +from helper import EduHelper ######## This script is only for educational purpose ######## ######## use it on your own RISK ######## ######## I'm not responsible for any loss or damage ######## ######## caused to you using this script ######## -######## Github Repo - https://git.io/JJisT/ ######## +######## Github Repo - https://git.io/JJisT/ ########bannerTop def postFix(n): range_start = 10**(n-1) @@ -37,7 +36,15 @@ def random_phone_num_generator(): last = (str(random.randint(1, 9998)).zfill(4)) return '{}-{}-{}'.format(first, second, last) -def start_bot(start_url, email, college, collegeID): +def interceptor(request): + if request.method == 'POST' and request.url == 'https://www.openccc.net/f-vs-stand-I-hat-of-yout-ands-Banquoh-Cumberland?d=www.openccc.net': + request.abort(403) + +def start_bot(start_url, email, college, collegeID, cookies, token): + + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Parsing Incap Cookies (success)') + cookies['reese84'] = token + studentPhone = random_phone_num_generator() ex_split = studentAddress.split("\n") @@ -64,21 +71,15 @@ def start_bot(start_url, email, college, collegeID): fp = open('prefBrowser.txt', 'r') typex = fp.read() - try: # For Chrome if typex == 'chrome': driver = webdriver.Chrome(executable_path=r'./webdriver/chromedriver') # For Firefox elif typex == 'firefox': - # cap = DesiredCapabilities().FIREFOX - # cap['marionette'] = True driver = webdriver.Firefox(executable_path=r'./webdriver/geckodriver') elif typex == 'chrome_undetected': - import undetected_chromedriver.v2 as uc driver = uc.Chrome() - # with driver: - # driver.get('https://google.com') elif typex == '': print(fr + 'Error - Run setup.py first') exit() @@ -86,19 +87,47 @@ def start_bot(start_url, email, college, collegeID): time.sleep(0.4) print('\n' + fr + 'Error - '+ str(e)) exit() - + driver.request_interceptor = interceptor + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Interceptor Addition (success)') driver.maximize_window() + + driver.get('https://www.openccc.net') + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Injecting Incap Cookies', end='') + for cookie in cookies.keys(): + ck = {'name': cookie, 'value': cookies[cookie], 'domain': '.openccc.net'} + driver.add_cookie(ck) + print(fg + ' (success)') + + print('\n' + fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Incapsula Bypass Successfull') + + + print('\n' + fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Hold on Starting now, Keep checking this terminal for instructions') + + driver.get(start_url) time.sleep(1) - driver.find_element_by_xpath('//*[@id="portletContent_u16l1n18"]/div/div[2]/div/a[2]').click() + # extra_click = 0 - time.sleep(1) + # try: + # WebDriverWait(driver, 5).until( + # EC.presence_of_element_located((By.CLASS_NAME, "instructions")) + # ).click() + # extra_click = 1 + # except: + # extra_click = 0 + + try: + WebDriverWait(driver, 10).until( + EC.presence_of_element_located((By.ID, "inputFirstName")) + ) + except: + WebDriverWait(driver, 10).until( + EC.presence_of_element_located((By.ID, "accountFormSubmit")) + ).click() - WebDriverWait(driver, 60).until( - EC.presence_of_element_located((By.ID, "accountFormSubmit")) - ).click() + time.sleep(5) print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fy + 'Account Progress - 1/3', end='') @@ -448,11 +477,22 @@ def start_bot(start_url, email, college, collegeID): time.sleep(0.7) + WebDriverWait(driver, 60).until( EC.element_to_be_clickable( (By.CSS_SELECTOR, '#inputEduGoal option[value="B"]')) ).click() + time.sleep(0.7) + + try: + time.sleep(1) + dropdown_menu = Select(driver.find_element_by_id('inputMajorCategory')) + dropdown_menu.select_by_index(random.randint(1, 7)) + time.sleep(0.7) + except: + pass + time.sleep(2) dropdown_menu = Select(driver.find_element_by_id('inputMajorId')) @@ -1115,13 +1155,15 @@ def main(): userEmail = input() time.sleep(0.4) - - print('\n' + fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Hold on Starting now, Keep checking this terminal for instructions') + + print('\n' + fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Performing Incapsula Bypass') + fg_lp = EduHelper(clg_ids[userInput]) + start_url, cookies, token = fg_lp._tryHarder() time.sleep(1) reg_url = start_url + clg_ids[userInput] - start_bot(reg_url, userEmail, allColleges[userInput], userInput + 1) + start_bot(start_url, userEmail, allColleges[userInput], userInput + 1, cookies, token) if __name__ == '__main__': main() \ No newline at end of file diff --git a/helper.py b/helper.py new file mode 100644 index 0000000..227c509 --- /dev/null +++ b/helper.py @@ -0,0 +1,99 @@ +import requests +import json +import urllib3 +import string +import random +from __colors__.colors import * + +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + +class EduHelper: + def __init__(self, id): + self.url = 'https://www.openccc.net/f-vs-stand-I-hat-of-yout-ands-Banquoh-Cumberland?d=www.openccc.net' + self.h = { + 'accept': 'application/json; charset=utf-8', + 'sec-ch-ua-mobile': '?0', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36', + 'content-type': 'text/plain; charset=utf-8', + 'origin': 'https://www.openccc.net' + } + + self.url1 = 'https://www.openccc.net/cccacct-proxy/createAccount?locale=en&source=https://www.opencccapply.net/SSOLogin/{idd}/false/en'.format(idd=id) + + + self.urlxd = 'https://www.openccc.net/cccacct-proxy/createAccount?locale=en&source=https://www.opencccapply.net/SSOLogin/{idd}/false/en'.format(idd=id) + + self.url2 = 'https://www.openccc.net/f-vs-stand-I-hat-of-yout-ands-Banquoh-Cumberland?d=www.openccc.net' + + self.h2 = { + 'accept': 'application/json; charset=utf-8', + 'sec-ch-ua-mobile': '?0', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36', + 'content-type': 'text/plain; charset=utf-8', + 'origin': 'https://www.openccc.net', + 'sec-fetch-site': 'same-origin' + } + + self.url3 = 'https://www.openccc.net/uPortal/p/AccountCreation.ctf1/max/action.uP?pP_execution=e1s1' + self.h3 = { + 'origin': 'https://www.openccc.net', + 'content-type': 'application/x-www-form-urlencoded', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36', + 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'sec-fetch-site': 'same-origin' + } + self.cookie = { + 'reese84': None + } + + self.session = requests.Session() + + def getAuthToken(self): + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Fetching Token', end='') + data = { + 'solution': { + 'interrogation': { + 'p': ''.join(random.choices(string.ascii_lowercase + string.digits, k=40)), + 'st': 1627823618, + 'sr': 9090987876, + 'cr': 678989098 + }, + 'version': 'stable' + }, + 'old_token': None, + 'error': None, + 'performance': { + 'interogation': 248 + } + } + + res = self.session.post(url=self.url, data=json.dumps(data), headers=self.h, verify=False) + + js = res.json() + token = js['token'] + self.cookie['reese84'] = token + print(fg + ' (success)') + return token + + def _tryHarder(self): + token = self.getAuthToken() + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Fetching Cookies', end='') + self.session.get(url=self.url1, cookies=self.cookie, headers=self.h, verify=False) + print(fg + ' (success)') + + data2 = '"{tok}"'.format(tok=token) + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Sending Custom Fields and Token to Server', end='') + resp = self.session.post(url=self.url2, data=data2, headers=self.h2, verify=False) + print(fg + ' (success)') + js = resp.json() + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Setting Incap Token', end='') + token = js['token'] + self.cookie['reese84'] = token + print(fg + ' (success)') + + print(fc + sd + '[' + fm + sb + '*' + fc + sd + '] ' + fg + 'Sending Custom Cookies', end='') + data3 = '_eventId_continue=&flowId=e1s1' + resp3 = self.session.post(url=self.url3, data=data3, headers=self.h3, cookies=self.cookie, verify=False) + print(fg + ' (success)') + + return resp3.url, self.session.cookies, token \ No newline at end of file diff --git a/setup.py b/setup.py index 1cb1c82..0419b17 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def install(name): def main(): - my_packages = ['requests', 'clint', 'faker', 'selenium', 'colorama', 'undetected-chromedriver'] + my_packages = ['requests', 'clint', 'faker', 'selenium', 'colorama', 'undetected-chromedriver', 'selenium-wire'] installed_pr = []