<s> """<STR_LIT>""" <EOL> import ast <EOL> import datetime <EOL> import getpass <EOL> import hashlib <EOL> import os <EOL> import re <EOL> import requests <EOL> import sys <EOL> import phonenumbers <EOL> from ping_me . data import countrylist <EOL> home = os . path . expanduser ( "<STR_LIT>" ) <EOL> def extract_email ( ) : <EOL> """<STR_LIT>""" <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> email = "<STR_LIT>" <EOL> next_one = False <EOL> for line in f . readlines ( ) : <EOL> if next_one is True : <EOL> email = line . lstrip ( ) . rstrip ( ) <EOL> break <EOL> elif line == "<STR_LIT>" : <EOL> next_one = True <EOL> f . close ( ) <EOL> if email == "<STR_LIT>" : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> else : <EOL> return email <EOL> def extract_password ( ) : <EOL> """<STR_LIT>""" <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> password = "<STR_LIT>" <EOL> next_one = False <EOL> for line in f . readlines ( ) : <EOL> if next_one is True : <EOL> password = line . lstrip ( ) . rstrip ( ) <EOL> break <EOL> elif line == "<STR_LIT>" : <EOL> next_one = True <EOL> f . close ( ) <EOL> if password == "<STR_LIT>" : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> else : <EOL> return password <EOL> def extract_phone ( ) : <EOL> """<STR_LIT>""" <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> phone = "<STR_LIT>" <EOL> next_one = False <EOL> for line in f . readlines ( ) : <EOL> if next_one is True : <EOL> phone = line . split ( ) <EOL> break <EOL> elif line == "<STR_LIT>" : <EOL> next_one = True <EOL> f . close ( ) <EOL> if phone == "<STR_LIT>" : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> else : <EOL> return tuple ( phone ) <EOL> def check_saved_password ( ) : <EOL> """<STR_LIT>""" <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> next_one = False <EOL> for line in f . readlines ( ) : <EOL> if next_one is True : <EOL> return True if "<STR_LIT>" in line . split ( ) else False <EOL> if line == "<STR_LIT>" : <EOL> next_one = True <EOL> def newuser ( ) : <EOL> """<STR_LIT>""" <EOL> EMAIL_REGEX = re . compile ( r"<STR_LIT>" ) <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> email = sys . stdin . readline ( ) <EOL> while ( not EMAIL_REGEX . match ( email ) ) : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> email = sys . stdin . readline ( ) <EOL> email = email . rstrip ( ) <EOL> password = hashlib . md5 ( getpass . getpass ( ) . rstrip ( ) ) . hexdigest ( ) <EOL> while ( password == "<STR_LIT>" ) : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> password = hashlib . md5 ( getpass . getpass ( ) . rstrip ( ) ) . hexdigest ( ) <EOL> repass = hashlib . md5 ( getpass . getpass ( "<STR_LIT>" ) . rstrip ( ) ) . hexdigest ( ) <EOL> while ( password != repass ) : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> password = hashlib . md5 ( getpass . getpass ( ) . rstrip ( ) ) . hexdigest ( ) <EOL> repass = hashlib . md5 ( getpass . getpass ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) . rstrip ( ) ) . hexdigest ( ) <EOL> while ( True ) : <EOL> try : <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> read_number = sys . stdin . readline ( ) <EOL> read_number = phonenumbers . parse ( read_number , "<STR_LIT>" ) <EOL> while ( not phonenumbers . is_valid_number ( read_number ) ) : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> read_number = sys . stdin . readline ( ) <EOL> read_number = phonenumbers . parse ( read_number , "<STR_LIT>" ) <EOL> break <EOL> except Exception as e : <EOL> print ( e ) <EOL> number = str ( read_number . national_number ) . rstrip ( ) <EOL> country_code = str ( read_number . country_code ) <EOL> country_name = countrylist . code_to_country [ '<STR_LIT:+>' + country_code ] <EOL> save_password = '<STR_LIT>' <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> opt = sys . stdin . readline ( ) <EOL> if opt . strip ( ) == '<STR_LIT:y>' : <EOL> save_password = '<STR_LIT>' <EOL> target = "<STR_LIT>" <EOL> credentials = { '<STR_LIT:email>' : email , <EOL> '<STR_LIT:password>' : password , <EOL> '<STR_LIT>' : number , <EOL> '<STR_LIT>' : datetime . date . today ( ) , <EOL> '<STR_LIT>' : sys . platform , <EOL> '<STR_LIT>' : country_code , <EOL> '<STR_LIT>' : country_name , <EOL> '<STR_LIT>' : "<STR_LIT>" <EOL> } <EOL> r = requests . post ( target , data = credentials ) <EOL> if r . reason == "<STR_LIT:OK>" : <EOL> if ast . literal_eval ( r . text ) [ "<STR_LIT:success>" ] == "<STR_LIT:True>" : <EOL> config_file = open ( home + '<STR_LIT>' , '<STR_LIT>' ) <EOL> config_file . write ( '<STR_LIT>' + email + '<STR_LIT:\n>' ) <EOL> config_file . write ( '<STR_LIT>' + password + '<STR_LIT:\n>' ) <EOL> config_file . write ( '<STR_LIT>' + country_code + '<STR_LIT:U+0020>' + number + <EOL> '<STR_LIT:U+0020>' + country_name + '<STR_LIT:\n>' ) <EOL> config_file . write ( "<STR_LIT>" + "<STR_LIT>" + save_password + "<STR_LIT:\n>" ) <EOL> config_file . close ( ) <EOL> else : <EOL> sys . stderr . write ( "<STR_LIT>" + ast . literal_eval ( r . text ) [ "<STR_LIT>" ] + "<STR_LIT:\n>" ) <EOL> else : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> def olduser ( ) : <EOL> """<STR_LIT>""" <EOL> password = hashlib . md5 ( getpass . getpass ( ) . rstrip ( ) ) . hexdigest ( ) <EOL> if password == extract_password ( ) : <EOL> sys . stdout . write ( "<STR_LIT>" ) <EOL> opt = sys . stdin . read ( <NUM_LIT:1> ) <EOL> if opt == '<STR_LIT:y>' : <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> oldlines = f . readlines ( ) <EOL> f . close ( ) <EOL> f = open ( home + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> for line in oldlines : <EOL> if line == "<STR_LIT>" : <EOL> f . write ( "<STR_LIT>" ) <EOL> else : <EOL> f . write ( line ) <EOL> f . close ( ) <EOL> else : <EOL> sys . stderr . write ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:2> ) </s>
