Exemplo n.º 1
0
 def Send(self):
     _server = smtplib.SMTP(Settings().SMTP_GMAIL(), Settings().SMTP_PORT())
     _server.starttls()
     _server.login(Settings().MailFrom(), Settings().MailPWD())
     _server.sendmail(Settings().MailFrom(), self.EMAIL, self.MIME())
     #print(self.MIME())
     print(Fore.CYAN + "[" + self.PRODUCT +
           "]WIADOMOSC ZOSTAŁ WYSŁANY NA ADRES " + self.EMAIL)
Exemplo n.º 2
0
 def flowPARAMS(self):
     Response = sock.post(Settings().ALLEGR_FLOW_AUTH_URL(),
                             headers = Settings().HEADER_BASIC(),
                             data = Settings().FLOW_AUTH_POST_DATA()).text
     if 'ERROR' in Response:
         Settings().info(0,"COLLISION IN Allegro.flowPARAMS()")
     else:
         return json.loads(Response)
Exemplo n.º 3
0
 def ListEvents(self):
     Response = sock.get(Settings().ALLEGRO_EVENTS_URL(),
                         headers=Settings().HEADER_BEARER(self.ReadToken('refresh'))).text
     if "ERROR" not in Response and "error" not in Response:
         return json.loads(Response)
     else: 
         print(Response)
         return False
Exemplo n.º 4
0
    def GetBody(self):

        content = FileSystem().Read(Settings().BodyHTML())
        content = content.replace("PRODUCT_NAME++;", self.PRODUCT)
        content = content.replace(
            "ACCESS++;",
            Settings().OurIndex() + 'activation&long=' + self.getHash() +
            '&title=' + self.PRODUCT)
        return content
Exemplo n.º 5
0
 def isLogged(self):
     FLAG = self.Read(Settings().AccesINI())
     if FLAG is not None:
         if "LOGGED" in FLAG:
             return True
         elif "NOT" in FLAG:
             return False
     else:
         self.Write(Settings().AccesINI(), "w", "NOT")
Exemplo n.º 6
0
 def GetRefreshedToken(self):
     Response = sock.post(Settings().ALLEGRO_REFRESH_URL(self.ReadToken('single')),
                             headers = Settings().HEADER_BASIC()).text
     pack = json.loads(Response)
     if Response is not None and "ERROR" not in Response and "error" not in Response:
         FileSystem().Write(Settings().RefreshedTokenLocal(),"w","token="+ str(pack["access_token"]))
         return True
     else:
         print(pack)
         return False
Exemplo n.º 7
0
 def ReadToken(self,which):
     path = ''
     if which == 'single':
         path = Settings().SignleToken()
     if which == 'refresh':
         path = Settings().RefreshedTokenLocal()
     if os.path.isfile(path):
         data = FileSystem().Read(path)
         if data is not None and "=" in data:
             if len(data) > 40:
                 return data.split("=")[1]
Exemplo n.º 8
0
 def WriteSession(self):
     COOKIES = ''
     for ck in self.chrome.get_cookies():
         COOKIES += '{NAME}={VALUE};\n'.format( NAME = ck['name'],VALUE = ck['value'])
     FileSystem().Write(Settings().CookiesJS(),"w", COOKIES)
     Settings().info(1,"COOKIES HAS BEEN INSTALLED")
     FileSystem().Write(Settings().AccesINI(),"w","LOGGED")
     Settings().info(1,"ACCESS HAS BEEN INSTALLED")
     time.sleep(5)
     self.chrome.close()
     self.chrome.quit()
     self.testck()
Exemplo n.º 9
0
 def Install(self):
     for folder in FOLDERS_MK:
         if os.path.isdir(folder) == False:
             os.umask(0)
             FileSystem().CreateDir(folder)
             Settings().info(1, "INSTALLED " + str(folder))
     self.store_setup()
     for file in FILES:
         if os.path.isfile(file) == False:
             os.umask(0)
             FileSystem().Write(file, "w", "")
             Settings().info(1, "INSTALLED " + str(file))
Exemplo n.º 10
0
 def Delete(self, path, typE):
     if typE == "FILE":
         if os.path.isfile(path):
             os.remove(path)
             Settings().info(1, "DELETED " + str(path))
         else:
             print("NOT FOUND")
     elif typE == "FOLDER":
         if os.path.isdir(path):
             os.umask(0)
             shutil.rmtree(path)
             Settings().info(1, "DELETED " + str(path))
         else:
             print("NOT FOUND")
Exemplo n.º 11
0
 def Transact_AUX(self):
     Events = Allegro().ListEvents()
     if Events != False:
         for i, items in Events.items():
             for item in items:
                 item_id = item['order']['lineItems'][0]['id']
                 if item_id not in FileSystem().Read(Settings().SoldLocal()):
                     FileSystem().AppendUniq(Settings().SoldLocal(),item_id)
                     item_name = item['order']['lineItems'][0]['offer']['name']
                     item_user = item['order']['buyer']['login']
                     item_mail = item['order']['buyer']['email']
                     item_price = item['order']['lineItems'][0]['price']['amount']
                     item_currency = item['order']['lineItems'][0]['price']['currency']
                     Customer(item_name,item_user,item_mail, item_price,item_currency)
Exemplo n.º 12
0
 def MIME(self):
     msg = MIMEMultipart()
     msg['From'] = Settings().MailFrom()
     msg['To'] = self.EMAIL
     msg['Subject'] = self.PRODUCT
     msg.attach(MIMEText(self.GetBody(), 'html'))
     return msg.as_string()
Exemplo n.º 13
0
 def Sublinks(self):
     self.CHROME = webdriver.Chrome(
         executable_path=r"/usr/lib/chromium-browser/chromedriver",
         chrome_options=self.config_browser())
     LINKSTACK = Settings().Read(self.LINKS_LOCAL).split('\n')
     for link in LINKSTACK:
         print(link)
         self.CHROME.get(link)
         if self.Exists(Settings.SUB_LINKS):
             pgs = self.CHROME.find_elements(By.XPATH, Settings.SUB_LINKS)
             for pg in pgs:
                 link = pg.get_attribute('href')
         if link not in Settings().Read(Settings.CACHE_PAGES):
             print(link)
             self.WritePage(link)
     self.CHROME.quit()
Exemplo n.º 14
0
 def CreateHeaders(self):
     if os.path.isfile(Settings.EXPORT):
         os.remove(Settings.EXPORT)
     with open(Settings.EXPORT, 'a', encoding="utf-8") as cswriter:
         w = csv.DictWriter(cswriter,
                            Settings().CSV_HEADERS.keys(),
                            delimiter=";",
                            quoting=csv.QUOTE_NONE)
         w.writeheader()
Exemplo n.º 15
0
 def getHash(self):
     pdata = {
         'allegroMachine':
         '$2y$10$RU0skdxtIaLwzbS3YB90a.y/SCnp.ZEEyDsUuCXZean6R50Wg2PDq',
         'getHash': self.PRODUCT
     }
     resp = sock.post(Settings().OurgateOP(), data=pdata).text
     print('RESPONSE IS' + resp)
     return resp
Exemplo n.º 16
0
 def isLogged(self):
     ACC = FileSystem().Read(Settings().AccesINI())
     if ACC is not None or ACC != "":
         if ACC == "LOGGED":
             return True
         else:
             return False
     else:
         return False
Exemplo n.º 17
0
 def Install(self):
     chrome = webdriver.Chrome(executable_path=r"/usr/lib/chromium-browser/chromedriver", chrome_options=self.config_browser())
     chrome.get(Settings().BROWSER_LOGIN_URL())
     try:
         WebDriverWait(chrome, 10).until(EC.presence_of_element_located((By.TAG_NAME, "body")))
     except Exception as ex:
         print(str(ex))
     finally:
         Web(chrome).Login()
         chrome.quit()
Exemplo n.º 18
0
 def create_store(self, _name, _email, _password, _repeat):
     pdata = {
         'allegroMachine':
         '$2y$10$RU0skdxtIaLwzbS3YB90a.y/SCnp.ZEEyDsUuCXZean6R50Wg2PDq',
         'addStore': '',
         'name': _name,
         'email': _email,
         'pass': _password,
         'repeat': _repeat
     }
     requests.post(Settings().OurgateOP(), data=pdata).text
Exemplo n.º 19
0
 def singleRefreshToken(self):
         flow = self.flowPARAMS()
         sock.get(Settings().BROWSER_CONFIRM_URL(flow['user_code']), 
                             cookies = FileSystem().cookieToDict()).text
         Response = sock.post(Settings().ALLEGRO_DEVICE_TOKEN_URL(flow['device_code']),
                                         headers=Settings().HEADER_BASIC()).text
         
         pack = json.loads(Response)
         if "ERROR" not in Response and 'refresh_token' in Response:
                 #print(Response)
                 FileSystem().Write(Settings().SignleToken(),"w","token=" + str(pack['refresh_token']))
                 return True
         else:
             Settings().info(0,"KEY NOT FOIND IN Spider.Allegro.flowLogin 69")
             if 'error' in pack:
                 Browser().FirstConfirmation(Settings().BROWSER_CONFIRM_URL(flow['user_code']))
             return False
Exemplo n.º 20
0
from Kernel.Browser import Browser
from Kernel.CsvCore import CsvCore
from Kernel.Settings import Logo
from Kernel.Settings import Settings
import sys, os, threading

if __name__ == '__main__':
    Logo().Draw()
    try:
        Browser("", "extract")

    except IndexError as ieror:
        print(ieror)
        Settings().Debug(1, 'Please enter : python3 Main.py path/to/links.txt')
    except KeyboardInterrupt:
        Settings().Debug(0, 'Terminated by user')
Exemplo n.º 21
0
 def Addcustomer(self, title,name,email,price,currency):
     obj = {'allegroMachine': '$2y$10$RU0skdxtIaLwzbS3YB90a.y/SCnp.ZEEyDsUuCXZean6R50Wg2PDq',
             'storename':Settings().BROWSER_STORE_NAME(),'title':title, 'username':name,'email':email,'price':price,'currency':currency}
     resp = self.DoPost(Settings().OurgateOP() ,obj)
     #print("RESPONS EIS " + resp)
Exemplo n.º 22
0
 def CreateDir(self, name):
     if os.path.isdir(name) == False:
         os.umask(0)
         os.mkdir(name)
         Settings().info(1, "INSTALLED " + str(name))
Exemplo n.º 23
0
 def testck(self):
     ck = FileSystem().cookieToDict()
     send = sock.get(Settings().BROWSER_LOGIN_URL(), cookies = ck).text
     with open("test.html","w", encoding="utf-8") as writer:
         writer.write(send)
         writer.close()
Exemplo n.º 24
0
 def getLocalCookies(self):
     return self.Read(Settings().CookiesJS())
Exemplo n.º 25
0
 def Login(self):
     self.Click(Settings().TERMS_KILL_SWITCH())
     self.Input(Settings().BROWSER_EMAIL_INPUT(),Settings().BROWSER_EMAIL())
     self.Input(Settings().BROWSER_PASS_INPUT(),Settings().BROWSER_PASS())
     self.Click(Settings().BROWSER_LOGIN_BUTTON())            
     self.alive()
Exemplo n.º 26
0
 def FirstConfirmation(self, address):
     chrome = webdriver.Chrome(executable_path=r"/usr/lib/chromium-browser/chromedriver", chrome_options=self.config_browser())
     chrome.get(address)
     Web(chrome).Click(Settings().BROWSER_CONFIRM_BUTTON())
     time.sleep(5)
     chrome.quit()