Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import re
- SERVER_IP = "44.224.228.136"
- SERVER_PORT = 1336
- BUFFER = 1024
- MY_ID = "713" # Yonka / yonka2019 / yonka2003@gmail.com
- def main():
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((SERVER_IP, SERVER_PORT))
- login(sock, "yonka2019", "12345")
- # . . .
- def custom_glit_upload(sock, feed_owner_id, publisher_avatar, background_color, date, content, font_color):
- """
- Custom glit uploading with editable parameters (the application allows u to edit only the content label,
- here you can edit additional parameters) @param sock: current opened socket @param publisher_avatar: set any avatar (
- im1->im8) @param background_color: set any background color @param date: set any date
- YYYY-MM-DD'T'HH:MM:SS.MSMSMS'Z' @param content: the content of the uploaded glit @param font_color: the font
- color of the text
- """
- sock.sendall(('550#{gli&&er}{"feed_owner_id":' + feed_owner_id + ',"publisher_id":' + MY_ID + ','
- '"publisher_screen_name":"Yonka", '
- '"publisher_avatar":"' + publisher_avatar + '","background_color":"' + background_color
- + '","date":"' + date + '",' # UTC
- '"content":"' + content + '","font_color":"' + font_color + '","id":-1}##').encode())
- print(sock.recv(BUFFER).decode())
- def custom_comment_upload(sock, content, date):
- """
- Custom comment uploading with editable parameters (the application allows u to edit only the content label,
- here you can edit additional parameters)
- @param sock: current opened socket
- @param content: the content of the uploaded comment
- @param date: set any date YYYY-MM-DD'T'HH:MM:SS.MSMSMS'Z'
- """
- sock.sendall(('650#{gli&&er}{"glit_id":5214,"user_id":' + MY_ID + ',"user_screen_name":"Yonka","id":-1,"content":"' + content
- + '","date":"' + date + '"}##').encode())
- print(sock.recv(BUFFER))
- def get_description(sock, profile_id):
- """
- Returns the description (Life Motto) of the given profile (id)
- @param sock: current opened socket
- @param profile_id: id of the profile which we want to get his description
- @return: (str) the description (Life Motto) of the profile (that we set in the settings)
- """
- description_pattern = r'description":"(.+?)"'
- sock.sendall(('310#{gli&&er}' + profile_id + '##').encode())
- reply = sock.recv(BUFFER).decode()
- print(reply)
- matches = re.search(description_pattern, reply)
- return matches.group(1)
- def login(sock, user_name, password):
- """
- login to system
- @param sock: current opened socket
- @param user_name: user name to log with
- @param password: password to log with
- """
- sock.sendall(('100#{gli&&er}{"user_name":"' + user_name + '","password":"' + password + '",'
- '"enable_push_notifications":true}##').encode()) # Login
- print(sock.recv(BUFFER).decode())
- sock.sendall('110#{gli&&er}1005##'.encode()) # CHECKSUM send
- print(sock.recv(BUFFER).decode())
- def add_likes(sock, id_add_to, likes_number):
- """
- Add any number of likes to the given glit
- @param sock: current opened glit
- @param id_add_to: id of the glit to add likes
- @param likes_number: number of likes to add to the given glit
- """
- for i in range(likes_number):
- sock.sendall(
- ('710#{gli&&er}{"glit_id":' + id_add_to + ',"user_id":' + MY_ID + ',"user_screen_name":"Yonka","id":-1}##').encode())
- print(sock.recv(BUFFER).decode())
- def get_email(sock, username):
- """
- Returns the email of the given username in the Glit system
- @param sock: current opened socket
- @param username: username to get his email
- @return: (str) email of the given username
- """
- email_pattern = r'{"screen_name":"' + username + '".+?"mail":"(.+?)"'
- sock.sendall(('300#{gli&&er}{"search_type":"SIMPLE","search_entry":"' + username + '"}##').encode())
- reply = sock.recv(BUFFER).decode()
- print(reply)
- matches = re.search(email_pattern, reply)
- return matches.group(1)
- def accept_glance_request(sock, future_friend_id):
- """
- Accept some glance request that we sent from another user
- @param sock: current opened socket
- @param future_friend_id: friend which we send and want to accept the glance
- """
- sock.sendall(('420#{gli&&er}[' + MY_ID + ',' + future_friend_id + ']##').encode())
- print(sock.recv(BUFFER).decode())
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment