mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 09:47:17 +00:00
Added comments
This commit is contained in:
parent
05417f405c
commit
cbb2909156
2 changed files with 8 additions and 8 deletions
|
@ -14,6 +14,7 @@ It also split the username and store it into redis for searching purposes.
|
||||||
Redis organization:
|
Redis organization:
|
||||||
uniqNumForUsername: unique number attached to unique username
|
uniqNumForUsername: unique number attached to unique username
|
||||||
uniqNumForPath: unique number attached to unique path
|
uniqNumForPath: unique number attached to unique path
|
||||||
|
-> uniqNum are used to avoid string duplication
|
||||||
AllCredentials: hashed set where keys are username and value are their uniq number
|
AllCredentials: hashed set where keys are username and value are their uniq number
|
||||||
AllCredentialsRev: the opposite of AllCredentials, uniqNum -> username
|
AllCredentialsRev: the opposite of AllCredentials, uniqNum -> username
|
||||||
AllPath: hashed set where keys are path and value are their uniq number
|
AllPath: hashed set where keys are path and value are their uniq number
|
||||||
|
@ -130,9 +131,9 @@ if __name__ == "__main__":
|
||||||
print('found {} credentials'.format(len(creds)))
|
print('found {} credentials'.format(len(creds)))
|
||||||
|
|
||||||
|
|
||||||
#for searching credential in cred seeker
|
#for searching credential in termFreq
|
||||||
for cred in creds:
|
for cred in creds:
|
||||||
cred = cred.split('@')[0]
|
cred = cred.split('@')[0] #Split to ignore mail address
|
||||||
|
|
||||||
#unique number attached to unique path
|
#unique number attached to unique path
|
||||||
uniq_num_path = server_cred.incr(REDIS_KEY_NUM_PATH)
|
uniq_num_path = server_cred.incr(REDIS_KEY_NUM_PATH)
|
||||||
|
@ -146,12 +147,13 @@ if __name__ == "__main__":
|
||||||
server_cred.hmset(REDIS_KEY_ALL_CRED_SET, {cred: uniq_num_cred})
|
server_cred.hmset(REDIS_KEY_ALL_CRED_SET, {cred: uniq_num_cred})
|
||||||
server_cred.hmset(REDIS_KEY_ALL_CRED_SET_REV, {uniq_num_cred: cred})
|
server_cred.hmset(REDIS_KEY_ALL_CRED_SET_REV, {uniq_num_cred: cred})
|
||||||
|
|
||||||
#server_cred.hmset(REDIS_KEY_MAP_CRED_TO_PATH, {uniq_num_cred: uniq_num_path})
|
#Add the mapping between the credential and the path
|
||||||
server_cred.sadd(REDIS_KEY_MAP_CRED_TO_PATH+'_'+str(uniq_num_cred), uniq_num_path)
|
server_cred.sadd(REDIS_KEY_MAP_CRED_TO_PATH+'_'+str(uniq_num_cred), uniq_num_path)
|
||||||
|
|
||||||
|
#Split credentials on capital letters, numbers, dots and so on
|
||||||
|
#Add the split to redis, each split point towards its initial credential unique number
|
||||||
splitedCred = re.findall(REGEX_CRED, cred)
|
splitedCred = re.findall(REGEX_CRED, cred)
|
||||||
for partCred in splitedCred:
|
for partCred in splitedCred:
|
||||||
if len(partCred) > MINIMUMSIZETHRESHOLD:
|
if len(partCred) > MINIMUMSIZETHRESHOLD:
|
||||||
server_cred.sadd(partCred, uniq_num_cred)
|
server_cred.sadd(partCred, uniq_num_cred)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Flask functions and routes for the trending modules page
|
Flask functions and routes for the trending modules page
|
||||||
|
|
||||||
|
note: The matching of credential against supplied credential is done using Levenshtein distance
|
||||||
'''
|
'''
|
||||||
import redis
|
import redis
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -510,9 +512,5 @@ def cred_management_action():
|
||||||
return jsonify(to_return)
|
return jsonify(to_return)
|
||||||
|
|
||||||
|
|
||||||
@terms.route("/credentials_management_query/")
|
|
||||||
def cred_management_query():
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# ========= REGISTRATION =========
|
# ========= REGISTRATION =========
|
||||||
app.register_blueprint(terms)
|
app.register_blueprint(terms)
|
||||||
|
|
Loading…
Reference in a new issue