Example #1
0
def checkTcLoop(iden):
    store = auth.login(config.acc_ver, config.acc_os, crypto.basic(iden),
                       False)
    if 'error' not in store:
        if 'reason' not in store:
            store1 = transfer.create(config.acc_ver, config.acc_os,
                                     store['access_token'], store['secret'])
            if 'error' not in store1:
                fc = '000000000'
                tc = str(store1['link_code'])
                store2 = transfer.validate(config.acc_ver, tc, fc)
                if 'error' not in store2:
                    store3 = ingame.user(config.acc_ver, config.acc_os,
                                         store['access_token'],
                                         store['secret'], False)
                    print(Fore.GREEN + '\n' + str(store3['user']['id']))
                    print(Fore.GREEN + tc + '\n')
                    return True
                else:
                    print('transfer code not found. making new code...')
                    checkTcLoop(iden)
            else:
                error.Handler('loop create', store1)
        else:
            url = store['captcha_url']
            key = store['captcha_session_key']
            webbrowser.open(url, new=1, autoraise=True)
            print('Complete CAPTCHA to login... Press ENTER when done.')
            input()
            checkTcLoop(iden)
    else:
        error.Handler('loop login', store)
Example #2
0
def refresh():
    save = config.loaded
    store = auth.login(config.acc_ver, config.acc_os,
                       crypto.basic(config.account), False)
    if 'error' not in store:
        config.sess_token, config.sess_secret = store['access_token'], store[
            'secret']
        print(Fore.LIGHTGREEN_EX + 'client refreshed.')
    else:
        error.Handler('refresh', store)
Example #3
0
def login():
    if not is_session_new():
        bottle.redirect('/welcome')

    if bottle.request.query.code:
        session = bottle.request.environ.get('beaker.session')
        session['user'] = auth.login(bottle.request.query.code, REDIRECT_URI)

        bottle.redirect('/welcome')
    else:
        return 'Something went wrong with authorization. Try again. (error:' + bottle.request.query.error + ' - ' + bottle.request.query.error_description + ')'
Example #4
0
    def post(self):
        auth._signout_single_signon()
        redir = request.args.get('redir')
        email = request.form.get('email')
        password = request.form.get('password')

        try:
            session.update(auth.login(email, password))
            if redir and redir.startswith('/'):
                return redirect(redir)
            return jsonify({'session': dict(session)})
        except Exception as e:
            return jsonify({'error': str(e)})
Example #5
0
    def OnLoadError(self, browser, frame, error_code, error_text_out,
                    failed_url):
        global par1
        global facebook_id
        global facebook_token
        if 'fbconnect://success' in failed_url:
            facebook_token = failed_url.replace('fbconnect://success#',
                                                '').split('&')[0].replace(
                                                    'access_token=', '')
            browser.CloseBrowser()
            del browser
            #cef.Shutdown()
            url = 'https://graph.facebook.com/v3.2/me?access_token=' + str(
                facebook_token) + '&fields=name&format=json&sdk=android'
            headers = {
                'User-Agent': 'FBAndroidSDK.4.39.0',
                'Accept-Language': 'en_US',
                'Content-Type': 'application/x-www-form-urlencoded',
                'Content-Encoding': 'gzip',
                'Accept-Encoding': 'gzip'
            }
            r = requests.get(url=url, headers=headers)
            #print('cookie FB ID: ' + str(facebook_id))
            #print(r.json())
            facebook_id = r.json()['id']
            #print('OAuth FB ID: ' + str(facebook_id))
            #print('session secret: ' + str(session_secret))
            #print('OAuth token: ' + str(facebook_token))

            #print(par1)
            #validate
            if par1[0][2] == 0:
                print('[16] facebook validate')
                config.acc_ver, config.acc_os = par1[0][0], par1[0][1]
                store = transfer.facebookValidate(config.acc_ver,
                                                  config.acc_os, facebook_id,
                                                  facebook_token)
                if 'error' not in store:
                    if 'sign' in store:
                        store = crypto.decrypt_sign(store['sign'])
                        print(store)
                    else:
                        print(store)
                else:
                    error.Handler('fb validate', store)
            #transfer
            if par1[0][2] == 1:
                print('[16] facebook transfer')
                config.acc_ver, config.acc_os = par1[0][0], par1[0][1]
                store = transfer.facebook(config.acc_ver, config.acc_os,
                                          facebook_id, facebook_token)
                if 'error' not in store:
                    store = crypto.decrypt_sign(store['sign'])
                    iden = store['identifiers'].replace('\n', '')
                    print(Fore.YELLOW + 'identifier for recover.\n' + iden)
                    store = auth.login(config.acc_ver, config.acc_os,
                                       crypto.basic(iden), False)
                    if 'error' not in store:
                        if 'reason' not in store:
                            save = utils.createSaveFile(iden)
                            config.sess_token, config.sess_secret = store[
                                'access_token'], store['secret']
                            config.loaded, config.account = save, iden
                            utils.checkDatabase()
                            utils.help2()
                        else:
                            url = store['captcha_url']
                            key = store['captcha_session_key']
                            webbrowser.open(url, new=1, autoraise=True)
                            print(
                                'Complete CAPTCHA to login... Press ENTER when done.'
                            )
                            input()
                            store = auth.login(config.acc_ver, config.acc_os,
                                               crypto.basic(iden), False, key)
                            if 'error' not in store:
                                save = utils.createSaveFile(iden)
                                config.sess_token, config.sess_secret = store[
                                    'access_token'], store['secret']
                                config.loaded, config.account = save, iden
                                utils.checkDatabase()
                                utils.help2()
                            else:
                                error.Handler('add login2', store)
                    else:
                        error.Handler('add login', store)
                else:
                    error.Handler('fb use', store)
            #link
            if par1[0][2] == 2:
                print('[16] facebook linking')
                config.acc_ver, config.acc_os = par1[0][0], par1[0][1]
                store = transfer.facebookLink(config.acc_ver, config.acc_os,
                                              facebook_id, facebook_token,
                                              par1[0][3], par1[0][4])
                if 'error' not in store:
                    if 'sign' in store:
                        store = crypto.decrypt_sign(store['sign'])
                        print(Fore.GREEN + store['external_links']['facebook'])
                    else:
                        print(store)
                else:
                    error.Handler('fb link', store)
            par1 = []
Example #6
0
 def post(self):
     email = request.form.get("email")
     password = request.form.get("password")
     redir = request.form.get("redir")
     result = login(email, password)
     return redirect(redir)
Example #7
0
from django.urls import path
from api import views
from api import auth

urlpatterns = [
    path('api/contacts/', views.contacts()),
    path('api/contacts/<int:pk>/', views.contact_detail()),
    path('api/login/', auth.login()),
    path('api/logout/', auth.logout()),
]
Example #8
0
import visualization.optionPricing as optionPricing
import api.api as api
import api.auth as auth
import utils.transforms as transforms

#STOCK = 'TSLA'
STOCKS = [
    'ACB', 'GE', 'F', 'FIT', 'GPRO', 'CRON', 'HEXO', 'PLUG', 'ZNGA', 'CHK',
    'NIO', 'APHA', 'GRPN', 'S', 'SIRI', 'CRBP', 'VSLR'
]
EXPIRATION_DATES = [
    '2019-11-01', '2019-11-08', '2019-11-15', '2019-11-22', '2019-11-29',
    '2019-12-20', '2020-01-17'
]
auth.login()
for STOCK in STOCKS:
    for DATE in EXPIRATION_DATES:
        try:
            current_options = api.getOptionData([STOCK], DATE)
            curr_price = api.getCurrentAskPrice(STOCK)

            price_dict = transforms.convertToPricable(current_options,
                                                      curr_price)
            optionPricing.optionPricingByStrike(price_dict, stock_name=STOCK)
        except:
            pass