def register(self):
        req_html = request.urlopen("https://www.linkedin.com/reg/join").read()

        soup = BeautifulSoup(req_html)

        register_data = parse.urlencode({
            'isJsEnabled': 'false',
            'firstName': self.first_name,
            'lastName': self.last_name,
            'email': self.username,
            'password': self.password,
            'csrfToken': soup.find(id="csrfToken-coldRegistrationForm")['value'],
            'sourceAlias': soup.find(id="sourceAlias-coldRegistrationForm")['value'],
            'webmailImport': 'false',
            'trcode': '',
            'genie-reg': '',
            'mod': '',
            'key': '',
            'authToken': '',
            'authType': ''
        })

        data = register_data.encode()

        time.sleep(10.3867)

        response = request.urlopen("https://www.linkedin.com/reg/join-create", data)
        res_html = BeautifulSoup(response.read())
        Profile.dump_stuff('{}.html'.format('wtf'), str(res_html))

        pass
Beispiel #2
0
def initialize_database(config):
    with dbapi2.connect(config) as connection:
        cursor = connection.cursor()
        profile.initialize_profiles(config)
        Interaction_c.initialize_interaction(config)
        connection.commit()
        return 'tables are created <a href="http://itucsdb1601.mybluemix.net">Home</a>'
 def from_json(self, json_text):
     self.profiles = []
     for item in json_text["profiles"]:
         # These are each profile jsons
         temp_profile = Profile()
         temp_profile.from_json(item)
         self.profiles.append(temp_profile)
Beispiel #4
0
def scrape(url, user, attribute, input_file, output_file, driver):
    if user:
        url = 'http://www.linkedin.com/in/' + user
    if (url and input_file) or (not url and not input_file):
        raise ClickException(
            'Must pass either a url or file path, but not both.')
    elif url:
        if 'LI_AT' not in os.environ:
            raise ClickException("Must set LI_AT environment variable")
        if driver == 'Firefox':
            with ProfileScraper(driver=Firefox,
                                cookie=os.environ['LI_AT']) as scraper:
                profile = scraper.scrape(url=url)
        else:
            with ProfileScraper(driver=Chrome,
                                cookie=os.environ['LI_AT']) as scraper:
                profile = scraper.scrape(url=url)
    else:
        with open(input_file, 'r') as html:
            profile = Profile(html)

    if attribute:
        output = profile.__getattribute__(attribute)
    else:
        output = profile.to_dict()

    if output_file:
        with open(output_file, 'w') as outfile:
            json.dump(output, outfile)
    else:
        pprint(output)
Beispiel #5
0
	def get_basic_data_by_account_id(self, accountID='', simple='', userID=''):
		theBasics = {}
		if accountID:
			from Profile import Profile
			profileObj = Profile(self.db)
			profile = profileObj.get_profile_by_account_id(accountID)
			if not simple:
				query = self.db.user_data.user_id == userID
				nickName = self.db(query).select().first()
				query1 = self.db.account.id == accountID
				defaults = self.db(query1).select().first()
				if nickName:
					theBasics['name'] = nickName.nick_name
				if defaults:
					theBasics['friend'] = defaults.default_friend
					theBasics['blog'] = defaults.default_blog
				if profile:
					theBasics['backgroundImg'] = profile['backgroundImg']
					theBasics['profileTag'] = profile['tagLine']

			if profile:
				theBasics['profileName'] = profile['name']
				theBasics['profileImg'] = profile['profileImg']
				theBasics['accountKey'] = self.get_account_key_by_account_id(accountID)

			return theBasics

		else:
			return False
Beispiel #6
0
 def __init__(self, id, username, email, password_hash, picture_url,
              personal_message, facebook_url, twitter_url, birth_date,
              friends, creation_date):
     Profile.__init__(self, id, username, email, picture_url,
                      personal_message, facebook_url, twitter_url,
                      birth_date, creation_date)
     self.password_hash = password_hash
     self.friends = friends
Beispiel #7
0
def on_profile_operation():
    op = Profile()
    op.ReadDefaultValues()
    op.sketches = HeeksCNC.heekscnc.cad.get_selected_sketches()
    if op.Edit():
        HeeksCNC.heekscnc.program.operations.Add(op)
        HeeksCNC.heekscnc.tree.Add(op)
        HeeksCNC.heekscnc.tree.Refresh()
Beispiel #8
0
def on_profile_operation():
    op = Profile()
    op.ReadDefaultValues()
    op.sketches = HeeksCNC.heekscnc.cad.get_selected_sketches()
    if op.Edit():
        HeeksCNC.heekscnc.program.operations.Add(op)
        HeeksCNC.heekscnc.tree.Add(op)
        HeeksCNC.heekscnc.tree.Refresh()
Beispiel #9
0
def create_profile():
    profile = Profile(pname.get(), pemail.get(), ppin.get())
    if profile.create_profile():
        messagebox.showinfo(
            "Title", "Profile succesfuly created. Log in with name and pin")
        show_tab(0)
        hide_tab(2)
        clear_text([pname, pemail, ppin])
Beispiel #10
0
    def __init__(self):
        email_0 = ProfileEmail("*****@*****.**")
        phone_0 = ProfilePhone("Mobile", "SSA", "123-456-7890")
        key_0 = ProfileKey("SSN", "SSA", "123-45-6789")
        address_0 = ProfileAddress("Home", "123 Anywhere Lane", "",
                                   "Anytown USA", "NY", "10001")

        email_1 = ProfileEmail("*****@*****.**")
        phone_1 = ProfilePhone("Landline", "SSA", "987-605-4321")
        key_1 = ProfileKey("SSN", "SSA", "987-65-4321")
        address_1 = ProfileAddress("Home", "456 Everywhere Circle", "",
                                   "Anytown USA", "NY", "10001")

        email_2 = ProfileEmail("*****@*****.**")
        phone_2 = ProfilePhone("Jupiter", "SSA", "+31 902377345")
        key_2 = ProfileKey("SSN", "SSA", "826-01-1495")
        address_2 = ProfileAddress("HQ", "789 Nowhere Ave", "", "Anytown USA",
                                   "NY", "10001")

        # Profile Index 0
        self.profile_0 = Profile()
        self.profile_0.index = 0
        self.profile_0.source_system_key = "12345"
        self.profile_0.first_name = "Rick"
        self.profile_0.last_name = "Sanchez"
        self.profile_0.date_of_birth = "1980-10-10T01:00:00.000Z"
        self.profile_0.gender = "M"
        self.profile_0.emails = [email_0]
        self.profile_0.phones = [phone_0]
        self.profile_0.keys = [key_0]
        self.profile_0.addresses = [address_0]

        # Profile Index 1
        self.profile_1 = Profile()
        self.profile_1.index = 1
        self.profile_1.source_system_key = "67890"
        self.profile_1.first_name = "Morty"
        self.profile_1.last_name = "Smith"
        self.profile_1.date_of_birth = "1999-07-30T01:00:00.000Z"
        self.profile_1.gender = "M"
        self.profile_1.emails = [email_1]
        self.profile_1.phones = [phone_1]
        self.profile_1.keys = [key_1]
        self.profile_1.addresses = [address_1]

        # Profile Index 2
        self.profile_2 = Profile()
        self.profile_2.index = 2
        self.profile_2.source_system_key = "84292"
        self.profile_2.first_name = "Lars"
        self.profile_2.last_name = "Peters"
        self.profile_2.date_of_birth = "1985-11-15T01:00:00.000Z"
        self.profile_2.gender = "M"
        self.profile_2.emails = [email_2]
        self.profile_2.phones = [phone_2]
        self.profile_2.keys = [key_2]
        self.profile_2.addresses = [address_2]
Beispiel #11
0
def activate_monitor():
    profile = Profile()
    if (profile.activate_monitor(lblhide.cget("text"))):
        messagebox.showinfo("Success", "Monitor activated")
        show_tab(0)
        clear_text([name, pin])
    else:
        messagebox.showerror(
            "Oops", "Something went wrong. Contact the support center")
Beispiel #12
0
def basic_data():
	response.view = 'generic.'+request.extension
	from AccountUser import Account
	accountObj = Account(db)
	from Profile import Profile
	profileObj = Profile(db)
	basicData = {}
	basicData = accountObj.get_basic_data_by_auth_id(session.auth.user.id)
	basicData['friends'] = profileObj.get_friends_by_user_id(session.auth.user.id)
	return api_response(basicData=basicData)
Beispiel #13
0
def edit_profile():
	response.view = 'generic.'+request.extension
	jsonData = simplejson.loads(request.body.read()) if request.body else {}

	from Profile import Profile
	profileObj = Profile(db)
	profile = profileObj.update_profile(jsonData['profileId'], jsonData['name'], jsonData['tagLine'], jsonData['viewLevel'])
	account = profileObj.get_account_data_for_profile_update(session.auth.user.id)
	albums = profileObj.get_albums_for_profile_update(jsonData['accountId'])
	return api_response(profile=profile, account=account, albums=albums)
Beispiel #14
0
 def __init__(self, userType, proxie, newOrRecurrent, Log=None):
     super(UsuarioWeb, self).__init__()
     self.USER_TYPE = userType
     self.proxies = ValueProxies()
     self.profile = Profile(newOrRecurrent)
     self.proxie = proxie
     self.LogObject = Log
     self.userType = Usuario(userType, self.LogObject)
     self.newOrRecurrent = newOrRecurrent
     self.local_logger = logging.getLogger('super_logger')
     self.local_logger.setLevel(logging.DEBUG)
Beispiel #15
0
def add_friend():
	response.view = 'generic.'+request.extension
	jsonData = simplejson.loads(request.body.read()) if request.body else {}

	from Profile import Profile
	profileObj = Profile(db)
	if profileObj.add_a_friend(session.auth.user.id, jsonData['accountKey'], jsonData['viewLevel']):
		if jsonData['viewLevel'] == '9':
			message = "no longer friends"
		else:
			message="now friends"
		return api_response(message=message)
Beispiel #16
0
    def create_profile(self):
        name, last_played, progress, score = self.name_entry.get(), now(), "1", 0
        if name not in list(self.profiles.keys()):
            self.profile = Profile(name, last_played, progress, score)
            self.profiles[name] = {"last_played": last_played, "progress": progress, "score": score}
            self.save_profiles()
            self.profile = Profile(name, last_played, progress, score)
            self.name_variable.set(f"Name: {self.profile.name}")

            self.pre_game_screen()
        else:
            print("Name already exists, try a different one.")
Beispiel #17
0
def instBot():
    work_done = False
    while not work_done:
        user = UserDetails()
        selenium = SeleniumDetails()
        selenium.getDriver().get("https://www.instagram.com")
        login = Login(user, selenium)
        if login.main():
            profile = Profile(user, selenium)
            if profile.main():
                work_done = True
        selenium.getDriver().quit()
Beispiel #18
0
    def put_profile(self, prof: Profile):

        self.conn = sqlite3.connect(self.DB_filepath)
        self.c = self.conn.cursor()

        self.c.execute(
            "INSERT INTO Users (USERNAME, PASSWORD, FIRSTNAME, LASTNAME, BALANCE) VALUES (?, ?, ?, ?, ?)",
            (prof.get_user_name(), prof.get_password(), prof.get_first_name(),
             prof.get_last_name(), prof.get_balance()))

        self.conn.commit()

        return True
Beispiel #19
0
def analyse():
    try:
        if request.method == "POST":
            profile = Profile()
            profile.setusername(request.form['username'])
            print(profile.username)
            try:
                profile.setuser_profile('TwitterProfileData/timeline' +
                                        profile.username + '.jsonl')
                stweet, count, name = get_tweets(profile.username)
            except FileNotFoundError:
                print("File Not Found")
                return redirect(url_for('analyse', file_error=True))
            try:
                ex.APILengthError.test_api_error(count)
            except ex.APILengthError as e:
                return redirect(url_for('analyse', count_error=True))
                print("Test Error")
            profile.setcount(count)
            print('count ', profile.count)
            ml_facade = ML_Facade()
            extrovScore, neuroScore, agreeScore, conscScore, openScore, facetList = ml_facade.ml_process(
                stweet, profile.count)
            dashboard = Dashboard()
            dashboard.plot_graph_view(extrovScore, neuroScore, agreeScore,
                                      conscScore, openScore, facetList,
                                      profile.username, profile.count)
            dashboard.compare_results()
            print('Done ML ')
            return redirect(
                url_for('index', profile_name=profile.username,
                        full_name=name))
        return render_template('analyse.html')
    except requests.exceptions.RequestException as e:
        return render_template('except.html'), 500
Beispiel #20
0
 def createProfileSets(self):
     for key in self.readProfileSets:
         setName = self.readProfileSets[key][0]
         if(setName not in self.profileSets):
             if(setName not in self.profileDictionary.getProfiles()):
                 setProfile = Profile(setName)
                 self.profileDictionary.getProfiles()[setName] = setProfile
             profileList = []
             for value in self.readProfileSets[key][1:]:
                 if(value in self.profileDictionary.getProfiles()):
                     profileList.append(self.profileDictionary.getProfiles()[value])
                 else:
                     profile = Profile(value)
                     self.profileDictionary.getProfiles()[value] = profile
                     profileList.append(self.profileDictionary.getProfiles()[value])
             self.profileSets[setName] = (ProfileSet(self.profileDictionary.getProfiles()[setName], profileList))
Beispiel #21
0
    def test_extract_full_name_from_html(self):
        res = request.urlopen(
            'https://www.linkedin.com/profile/view?id=1535870&authType=name&authToken=tDG2&offset=5&trk=prof-sb-pdm-similar-photo')
        self.html = res.read()

        soup = BeautifulSoup(self.html)
        self.assertEqual(Profile._get_full_name(soup), 'Patrick Armitage')
Beispiel #22
0
    def heartbeat(api_endpoint, access_token, response):
        m4 = pokemon_pb2.RequestEnvelop.Requests()
        m = pokemon_pb2.RequestEnvelop.MessageSingleInt()
        m.f1 = int(time.time() * 1000)
        m4.message = m.SerializeToString()
        m5 = pokemon_pb2.RequestEnvelop.Requests()
        m = pokemon_pb2.RequestEnvelop.MessageSingleString()
        m.bytes = "05daf51635c82611d1aac95c0b051d3ec088a930"
        m5.message = m.SerializeToString()

        walk = sorted(Heartbeat.getNeighbors())

        m1 = pokemon_pb2.RequestEnvelop.Requests()
        m1.type = 106
        m = pokemon_pb2.RequestEnvelop.MessageQuad()
        m.f1 = ''.join(map(Heartbeat.encode, walk))
        m.f2 = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
        m.lat =  LocationSetter.COORDS_LATITUDE
        m.long = LocationSetter.COORDS_LONGITUDE
        m1.message = m.SerializeToString()
        response = Profile.get_profile(
            access_token,
            api_endpoint,
            response.unknown7,
            m1,
            pokemon_pb2.RequestEnvelop.Requests(),
            m4,
            pokemon_pb2.RequestEnvelop.Requests(),
            m5)
        payload = response.payload[0]
        heartbeat = pokemon_pb2.ResponseEnvelop.HeartbeatPayload()
        heartbeat.ParseFromString(payload)
        return heartbeat
def auth(email, key):
    user = Profile.getUserWithEmail(email)
    if user == None:
        return None
    if user.password != key:
        return None
    return user
Beispiel #24
0
 def getProfile(self) -> Profile:
     try:
         res = Profile(
             self.api.company_profile2(symbol=self.ticker).to_dict())
     except ApiException as e:
         print(f"Exception when calling DefaultAPI {e}")
     finally:
         return res
Beispiel #25
0
    def handle(self, *args, **options):
        p = Profile()
        lot = Lot.objects.get(name="B123")
        goal = p.get_goal(lot.surface)
        heat = p.get_bullshit_heat_spendings(lot.surface, .3, .3)

        doys = range(365)
        goal_daily = p.get_daily_goals(lot.surface)
        diff = map((lambda x,y: goal + x-y), heat, goal_daily)

        plt.plot(doys[:150], diff[:150])
        plt.plot(doys[150:], diff[150:], '--')
        plt.axhline(goal, label="goal", c="b")
        plt.xlabel("day")
        plt.ylabel("cost")
        plt.legend()
        plt.show()
Beispiel #26
0
def CreateLiveBlob(file_name):
    with ProfileDb(file_name) as profileDb:
        profileDb.Clear()

        stringMap   =   StringMap()
        progress    =   Progress()
        for section in Progress.SECTIONS:
            profileDb.FillSection(section,progress.getIds(section))
        profileDb.FillStrings("Fetishes",stringMap.getSection("Fetish"))
        pids        =   set(progress.getIds("CompletedProfiles"))
        sys.stderr.write("Profiles to load: [%s]\n" % len(pids))
        ploaded      =   0
        pfailed      =   0
        ptotal       =   len(pids)
        for pid in pids:
            profile =   Profile(pid)
            if(profile.load()):
                profileDb.AddProfile(profile)
                ploaded   += 1
                sys.stderr.write("Progress - Loaded Profile [%12s], [%12s] of [%12s], [%3s%% Done]\n" % (pid,ploaded,ptotal,100*(ploaded+pfailed)/ptotal))
            else:
                progress.errorProfile(pid)
                pfailed  += 1
                sys.stderr.write("Progress - Failed Profile [%12s], [%12s] of [%12s], [%s%% Done]\n" % (pid,pfailed,ptotal,100*(ploaded+pfailed)/ptotal))
            del profile
        gids        =   set(progress.getIds("CompletedGroups"))
        sys.stderr.write("Groups to load: [%s]\n" % len(gids))
        gloaded      =   0
        gfailed      =   0
        gtotal       =   len(gids)
        for gid in gids:
            group =   Group(gid)
            if(group.load()):
                profileDb.AddGroup(group)
                gloaded   += 1
                sys.stderr.write("Progress - Loaded Group [%12s], [%12s] of [%12s], [%3s%% Done]\n" % (gid,gloaded,gtotal,100*(gloaded+gfailed)/gtotal))
            else:
                progress.errorGroup(gid)
                failed  += 1
                sys.stderr.write("Progress - Failed Group [%12s], [%12s] of [%12s], [%s%% Done]\n" % (gid,gfailed,gtotal,100*(gloaded+gfailed)/gtotal))
            del group
 

        sys.stderr.write("Loaded [%d] Profiles [%d] Groups [%d] Errors.\n" % (ploaded,gloaded,pfailed+gfailed))
        return profileDb
Beispiel #27
0
def login():
    profile = Profile(name=name.get(), pin=pin.get())
    record = profile.log_in()
    if (record):
        tabControl.select(1)
        user = record[1]
        logged_in = user
        lblhide.configure(text=user)
        lblName.configure(text="Hello " + user,
                          padx=20,
                          pady=20,
                          font=("Gudea", 15),
                          anchor="w",
                          justify="left")
    else:
        messagebox.showerror("Authentication Failed!",
                             "Login Failed. Try again")
        clear_text([name, pin])
Beispiel #28
0
def LogIn():
    global pokemons 
    pokemons = json.load(open('SpawnCollector/pokemon.json'))
   
    #location = raw_input("Location: ")
    
    username = parser.get('login', 'username')
    password = parser.get('login', 'password')

    access_token = Profile.login_ptc(username, password)
    if access_token is None:
        print('[-] Wrong username/password')
        return
    print('[+] RPC Session Token: {} ...'.format(access_token[:25]))

    api_endpoint = Profile.get_api_endpoint(access_token)
    if api_endpoint is None:
        print('[-] RPC server offline')
        return
    print('[+] Received API endpoint: {}'.format(api_endpoint))

    response = Profile.get_profile(access_token, api_endpoint, None)
    if response is not None:
        print('[+] Login successful')

        payload = None
        try:
            payload = response.payload[0]
        except:
            print response.payload
        profile = pokemon_pb2.ResponseEnvelop.ProfilePayload()
        profile.ParseFromString(payload)
        print('[+] Username: {}'.format(profile.profile.username))

        creation_time = datetime.fromtimestamp(int(profile.profile.creation_time)/1000)
        print('[+] You are playing Pokemon Go since: {}'.format(
            creation_time.strftime('%Y-%m-%d %H:%M:%S'),
        ))

        for curr in profile.profile.currency:
            print('[+] {}: {}'.format(curr.type, curr.amount))
    else:
        print('[-] Ooops...')
    return(access_token, api_endpoint, response)
Beispiel #29
0
 def get_profile(self):
     try:
         profile = self.driver.find_element_by_css_selector(
             self.MAIN_SELECTOR).get_attribute("outerHTML")
     except:
         raise Exception(
             "Could not find profile wrapper html. This sometimes happens for exceptionally long profiles.  Try decreasing scroll-increment."
         )
     #contact_info = self.get_contact_info()
     return Profile(profile)
 def createprofile(self,fields,info):
     try:
         profile = Profile(fields,info)
         with open('data.csv','a',newline='') as datafile:
             writer = csv.writer(datafile)
             writer.writerow(info)
         datafile.close()
         System.addtohistory(self,profile)
         return profile
     except:
         return "file not created"
Beispiel #31
0
    def load_profile(self):
        if self.potential_profile is not None:
            name = self.potential_profile
            last_played, progress, score = self.profiles[name]['last_played'], self.profiles[name]['progress'], \
                                           self.profiles[name]['score']
            self.profile = Profile(name, last_played, progress, score)
            self.name_variable.set(f"Name: {self.profile.name}")
            self.active_profile_name = name
            self.profiles[name]['last_played'] = now()

            self.pre_game_screen()
Beispiel #32
0
def main(argv):
    
    if len(argv) != 2:
        usage()

    profileName = argv[0]
    knockPort   = argv[1]
        
    checkProfile(profileName)
    checkPortConflict(knockPort)
    createDirectory(profileName)

    random    = open('/dev/urandom', 'rb')
    cipherKey = random.read(16)
    macKey    = random.read(16)
    counter   = 0

    profile = Profile(PROFILES_DIR + profileName, cipherKey, macKey, counter, knockPort)
    profile.serialize()
    random.close()

    print "Keys successfully generated in " + PROFILES_DIR + profileName
Beispiel #33
0
	def get_available_accounts(self, userID):
		accounts = []
		if userID:
			accountID = self.get_account_id_by_user_id(userID)
			if accountID:
				query = self.db.account.id != accountID
				results = self.db(query).select(self.db.account.id, self.db.account.account_id)
				if results:
					for result in results:
						dataset = {}
						dataset['key'] = result.account_id
						from Profile import Profile
						profileObj = Profile(self.db)
						profile = profileObj.get_profile_by_account_id(result.id)
						if profile:
							dataset['profileName'] = profile['name']
							dataset['profileTag'] = profile['tagLine']
							dataset['profileImg'] = profile['profileImg']
							dataset['backgroundImg'] = profile['backgroundImg']

						accounts.append(dataset)

		return accounts
 def loadhistory(self,fields=[]):
     if fields == []:
         fields = self.heads
     history = []
     try:
         with open('history.csv', newline='') as historyfile:
             data = csv.reader(historyfile)
             for row in data:
                 history.append(Profile(fields,row))
             historyfile.close()
             return history
         historyfile.close()
     except:
         return "No history file found"
    def getdailyrecord(self,date,fields=[]):
        if fields == []:
            fields = self.heads
        filename = str(date) + ".csv"
        records = []
        try:
            with open(filename, newline='') as recordfile:
                data = csv.reader(recordfile)

                for row in data:
                    records.append(Profile(fields,row))
                return records
            recordfile.close()
        except:
            return "Cannot get Daily Records"
Beispiel #36
0
def update_profile():
	response.view = 'generic.'+request.extension
	dataKey = request.vars.key or None
	dataValue = request.vars.value or None

	from Profile import Profile
	profileObj = Profile(db)
	if dataKey:
		if dataKey == 'newProfileImage':
			profileObj.edit_profile_images(session.auth.user.id, dataValue, 'profile')
		if dataKey == 'newBackGroundImage':
			profileObj.edit_profile_images(session.auth.user.id, dataValue, 'background')

	account = profileObj.get_account_data_for_profile_update(session.auth.user.id)
	profile = profileObj.get_profile_by_user_id_with_details(session.auth.user.id)
	albums = profileObj.get_albums_for_profile_update(profile['accountId'])
	return api_response(profile=profile, account=account, albums=albums)
Beispiel #37
0
    def test_extract_related_profile_ids_and_links(self):
        # res = request.urlopen(
        # 'https://www.linkedin.com/profile/view?id=1535870&authType=name&authToken=tDG2&offset=5&trk=prof-sb-pdm-similar-photo')
        # html = res.read()
        #
        # soup = BeautifulSoup(html)
        # ids = Profile._get_related_profile_ids(soup)

        profile = Profile(
            url='https://www.linkedin.com/profile/view?id=1535870&authType=name&authToken=tDG2&offset=5&trk=prof-sb-pdm-similar-photo')
        Profile.dump_stuff('here.html', str(profile._soup))

        assert len(profile.related_profile_links) > 0
        keys = profile.related_profile_links.keys()

        assert list(keys)[0] in profile.related_profile_links.keys()

        assert profile.related_profile_links[list(keys)[0]].startswith(
            'https://www.linkedin.com/profile/view?id=' + list(keys)[0])

        # make sure ya got an auth token in the url
        for link in profile.related_profile_links.values():
            query = parse_qs(urlparse(link).query)
            assert 'authToken' in query
Beispiel #38
0
    def setUp(self):
        # profile_file = "tests/test_profile.pwg"
        # pattern_file = "tests/test_patterns.ppwg"
        # result_file = "tests/test_result.dic"
        #
        # with open(profile_file, 'r') as f:
        #     profile_as_json = json.load(f)
        #
        # with open(pattern_file, 'r') as f:
        #     data = f.read().splitlines()
        #     patterns = []
        #     for line in data:
        #         if not line.startswith('#') and not line.startswith('//'):
        #             patterns.append(line)
        # with open(result_file, 'r') as f:
        #     self.default_result_list = f.read().splitlines()

        profile_as_json = {
            u'dates': {
                u'birth_day': u'16/01/1993',
                u'mom_birth': u'17/03/1974',
                u'dad_birth': u'03/06/1973'
            },
            u'phones': {
                u'target_phone': u'0525432156',
                u'mom_phone': u'0546656565'
            },
            u'hobbies': {
                u'hobby_B': u'football',
                u'hobby_A': u'basketball'
            },
            u'names': {
                u'target_name': u'tal cohen',
                u'target_son': u'dvora tal',
                u'target_mother': u'dana giladi',
                u'target_husband': u'david man'
            },
            u'address': {
                u'home': u'5th avenu new york',
                u'work': u'brooklyn street new york'
            },
            u'work_phones': {
                u'work_phone': u'065412345',
                u'home_phone': u'0773658844'
            }
        }

        self.profile = Profile(profile_as_json)
 def register(self, email, password, context={}):
     if self.profile_exists(email=email):
         return False
     new_profile = Profile()  # Initializes everything to default
     new_profile.set_email(email)
     new_profile.set_password(password)
     # TODO send the email for registration and such
     # TODO the email that verifies this account will be the "main" IP address
     random_id = self.isogram_server.get_verification_service().add_pending(
         email, context)
     self.profiles.append(new_profile)  # Add it in
     self.save()
     return random_id
Beispiel #40
0
    def Signup_Event(self):
        dbconnection = dbConnection()
        self.name_input = self.name_entry.get()
        self.username_input = self.user_entry.get()
        self.password_input = self.pass_entry.get()
        self.country_input = self.country_entry.get()
        self.mobile_input = self.mobile_entry.get()

        dbconnection.insert(self.name_input, self.username_input,
                            self.password_input, self.country_input,
                            self.mobile_input)
        profile_image, user, friends, pictures = dbconnection.retrieve(
            self.username_input, self.password_input)

        self.root.destroy()
        root = Tk()
        profile = Profile(root, dbconnection, user, friends, pictures,
                          profile_image)
        root.mainloop()
    def loadprofiles(self):
        flag = False
        profiles = []
        try:
            with open('data.csv',newline='') as datafile:
                data = csv.reader(datafile)
                for row in data:
                    if flag == True :
                        if row[0] != '' and row[1] != '':
                            profile = Profile(self.heads,row)
                            profiles.append(profile)
                    else:
                        flag = True
                        self.heads = row

                self.profiles = profiles
                return profiles
            datafile.close()
        except:
            return "Data file not found"
Beispiel #42
0
def Run(isDebugging=False):

    if isDebugging == False:

        device = Device("127.0.0.1:62001")
        device.Connect()
        profile = Profile("GaChien")
        profile.Load()
        gameManager = GameManager(device, profile)
        screenManager = ScreenManager()

        while True:
            screenshot = device.CaptureScreen()
            if screenshot.image is None:
                print("Can not capture screenshot. Retry...")
                time.sleep(5)
                continue

            screen = screenManager.GetScreen(screenshot)
            screen.ShowName()

            gameManager.SetScreen(screen)
            gameManager.Play()

            print("")
            time.sleep(5)

    else:

        device = Device(None)
        device.Connect()
        profile = Profile("GaChien")
        profile.Load()
        gameManager = GameManager(device, profile)
        screenManager = ScreenManager()

        print("Debugging...")
        filePath = os.path.abspath("PendingScreens/Screenshot.png")
        screenshot = ScreenShot(filePath)

        screen = screenManager.GetScreen(screenshot)
        screen.ShowName()

        gameManager.SetScreen(screen)
        gameManager.Play()
Beispiel #43
0
    def get_profile(self, username, password) -> (Profile, int):
        # check if user name exists, check the password
        # if the password is correct, parse data into a profile object and return it
        # a tuple of a profile and a token is returned
        # if user does'nt exists, set token = -1
        # if password is incorrect, set token = -2
        # if username and password are correct, return token = 0
        # In case the login is invalid, set the expected profile object to be returned to "None"

        self.conn = sqlite3.connect(self.DB_filepath)
        self.c = self.conn.cursor()

        self.c.execute("SELECT * FROM Users WHERE USERNAME = ?", (username, ))

        Username = self.c.fetchall()
        if len(Username) == 0:
            self.conn.commit()
            return (None, -1)
        if username == Username[0][0]:
            self.c.execute("SELECT PASSWORD From Users WHERE USERNAME = ?",
                           (username, ))
            Password = self.c.fetchall()
            if password == Password[0][0]:
                self.c.execute("SELECT * From Users WHERE USERNAME = ?",
                               (username, ))
                for attributes in self.c.fetchall():
                    USERNAME = attributes[0]
                    PASSWORD = attributes[1]
                    FIRSTNAME = attributes[2]
                    LASTNAME = attributes[3]
                    BALANCE = attributes[4]
                self.conn.commit()
                return (Profile(FIRSTNAME, LASTNAME, USERNAME, PASSWORD,
                                BALANCE), 0)
            else:
                self.conn.commit()
                return (None, -2)
Beispiel #44
0
    def initUI(self):
        """
            Init the UI (ie: set the stylesheet and create the tabs).
        """
        tabs = QTabWidget()
        tabs.setFocusPolicy(
            Qt.NoFocus)  # prevent the "horrible orange box effect" on Ubuntu
        tabs.setStyleSheet(tabs.styleSheet() + """
        QTabBar::tab:!selected {
            color: rgb(242, 241, 240);
            background-color: rgb(0, 126, 148);
        }

        QTabBar::tab:selected {
            color: rgb(0, 126, 148);
        }
        """)
        tabs.addTab(Profile(), "Profile")
        tabs.addTab(Totaux(), "Totaux")
        tabs.setCurrentIndex(0)

        layout = QVBoxLayout()  # contient les tabs
        layout.addWidget(tabs)
        self.setLayout(layout)
Beispiel #45
0
    def test_people_also_viewed(self):
        link = self.crawler.root_profile.people_also_viewed[0].url

        p = Profile(link)
        p._load_html()
        assert len(p.people_also_viewed) >= 1
Beispiel #46
0
 def test_parse_premium_user(self):
     p = Profile(url='/profile/view?id=1040844&authType=name&authToken=_P15')
     p._load_html()
Beispiel #47
0
#encrypted_hex = "9d9c19b21b2a8d3c7229b295aec4729d23e97f8030d106f49358bad64cb20648e5560578e84de2c212a2338e3ce14baaf019a9fcb0d650837498fdb494232ef4ae221996b9afcee55ba27343dc80df8dd45aa6263dbdd7e62c0179d24d30c249f3841276651f2eee6666d2c29c6c92741f0f0792e18fedd24ebc555bdb2f56b8"
#encrypted = binascii.unhexlify(encrypted_hex)

#decrypted = rsa.private_decrypt(encrypted, RSA.pkcs1_padding)
#print("Decoded: {}\n".format(decrypted))


#jwt_data = jwt.encode({'some': 'payload'}, secret_auth_key, algorithm='HS256')
#jwt_decoded = jwt.decode(jwt_data, secret_auth_key, algorithm='HS256')
#print("JWT Encoded: {}\n{}\n".format(jwt_data,jwt_decoded))

from BaseModel import BaseModel
from User import User #openspy user
from Profile import Profile #openspy user
user = User.get(User.id == 10001)
print("User: {}\n".format(user))

profile = Profile.get(Profile.id == 10001)
print("Profile: {}\n".format(profile.user.email))

#nick, email, partnercode):

the_nick = "sctest01"
namespaceid = 0
if namespaceid == 0:
	the_uniquenick = Profile.get(Profile.uniquenick == the_nick)
else:
	the_uniquenick = Profile.get((Profile.uniquenick == the_nick) & (Profile.namespaceid == namespaceid))

print("Got profile: {}\n".format(the_uniquenick))
Beispiel #48
0
 def test_dump_stuff(self):
     p = list(self.crawler.root_profile.related_profiles)[0]
     Profile.dump_stuff('{}.json'.format(p.profile_id), p._html)
Beispiel #49
0
				Field('types', 'string', writable=False))

db.define_table('profile_data',
				Field('profile_key', 'reference account_profile'),
				Field('data_type', 'string', writable=False),
				Field('data_value', 'text'),
				Field('view_level', 'reference friend_types'))

db.define_table('comment_table',
				Field('album_key', 'reference account_albums', label='album comment'),
				Field('media_key', 'reference upload_media', label='media comment'),
				Field('status_key', 'integer', label='status update comment'),
				Field('poster_id', 'reference account', label='account making the comment'),
                Field('comment_text', 'text', writable=True),
				Field('media_link', 'reference upload_media'),
				Field('created', 'datetime', default=request.now, writable=False, label='Creation Date/Time'))

if auth.is_logged_in():
	from AccountUser import Account
	accountObj = Account(db)
	from Profile import Profile
	profileObj = Profile(db)

	basicData = accountObj.get_basic_data_by_auth_id(session.auth.user.id)
	if basicData:
		basicData['friends'] = profileObj.get_friends_by_user_id(session.auth.user.id)
		currentKey = accountObj.get_account_key_by_user_id(session.auth.user.id)
	else:
		basicData = {}
		basicData['friends'] = False