Showing posts with label Laaptu. Show all posts
Showing posts with label Laaptu. Show all posts

Friday, 15 June 2018

Laaptu Auto Earn

Laaptu SmartPy
from base64 import decodestring
from io import BytesIO
from PIL import Image
from pyperclip import *
from selq import *
from smart import *
from time import * 
import base64
import pytesseract
import re
import sys
import traceback
import requests
burl='http://u.laaptu.com/'
urll=[
'','lost.action?msgnew=',
'login.action',
]
from config import *
if 'about:blank'==url:b.get(burl)
window_changed=bes('return +localStorage.a')
import linecache
import sys

def exception(e):
    exc_type, exc_obj, tb = sys.exc_info()
    f = tb.tb_frame
    lineno = tb.tb_lineno
    filename = f.f_code.co_filename
    linecache.checkcache(filename)
    line = linecache.getline(filename, lineno, f.f_globals)
    print( '{}.{} {}"\n{}'.format(filename.split('\\')[-1], lineno, line.strip(), exc_obj))



def iswc(e='body',uc=0):
 global window_changed
 for i in range(3):
  a=bes('return +localStorage.a')
  if window_changed<a :
   window_changed=a
   if e:
    WebDriverWait(b, 15).until(
     EC.presence_of_element_located((By.CSS_SELECTOR,e)))
   if e!='body': print('waited',e)
   return True
  sleep(3)
 alert('Hey Baby')
 print(e)
 exit()

if bcu().replace(burl,'') in urll:
 print('login')
 bes('window.isClicked=1')
 (bes('return isClicked'))
 (bes(f"document.forms['loginf'].username.value='{un1}'"))
 (bes(f"document.forms['loginf'].password.value='{pwd}'"))
 (bes(f"document.forms['loginf'].submit()"))
 iswc('p.ny_cap')
if 'Validaccount' in bcu():
 bes('document.querySelector("p.ny_cap").setAttribute("style","position: absolute;left:0px;top:-110px;")')
 b.save_screenshot('a.png')
 img = Image.open("a.png")
 area = (10,1, 120,28)
 im = img.crop(area)
 # im.show()
 a=(pytesseract.image_to_string(im))
 a=(a.replace('\n',''))
 bes(f"$('input.bdr3').value='{a}'") 
 # bes("callShift() ") 
 #6digit enough case insenstive 
 exit()

if 'homepage' in bcu():
 a=(bcu()) 
 a=a.replace('homepage','mathquiz')
 b.get(a)
 iswc('#subbtn')
z=3
f=open('a','a')
def bes2(b,a='der'):
 if bes(f"return $('{a}')"):
   bes(b)
   print('closed',a)
def cnm(b):
 bes2(f"closenewmsg('{b}');",'#'+b)
try:
 for i in range(18*3):
  if 'mathquiz.action?id' in bcu():
   try:
    bes2('hideCloud()','cloudnew')
    
    bes2("closeCloudnew('cloudnew2')")
    bes2("closenewmsg('cloudb')",'#cloudb')
    cnm('cloudc')
    pass
   except Exception as e:
    exception(e)
   
   png_arr=bes("return $('#optionansimg').src")
   png_arr = png_arr.split(",")
   png_arr = png_arr[1]

   im = Image.open(BytesIO(base64.b64decode(png_arr)))
   a=(pytesseract.image_to_string(im)[:-1])
   a=re.sub('How ?much is','',a)
   a=re.sub('Find ?out','',a)
   a=re.sub('Solve','',a)
   a=re.sub('X','*',a)
   a=re.sub('\u2014','-',a)
   a=re.sub('What is the solution to\n*','',a)
   a=re.sub('square of (.*)',r'\1** 2',a)
   print(ascii(a))
   a=(eval(a))
   print(a)

   bes(f"$('#quizAnswer').value={a}")
   sleep(1)
   bes('checkAnswer()')
   iswc('#continuebtn')
  if '?pid' in bcu(): 
   print(bcu(),file=f)
   bes('resultpage()')
   iswc('a.sbmt')
  if 'mathquiznext' in bcu(): 
   print(bcu(),file=f)
   sleep(2)
   bes('nextQuestion()')
   iswc('#subbtn')
   # if bes()# bes('hideCloud()') 
except Exception as e:
 exception(e)