def sendMedia(i, to, path, size, link, b64thumb): global s t = str(time.time()) t = t[:10] msgid = t + "-" + i thumblen = len(b64thumb) thumb_length = wa_functions._hex(thumblen) thumb_length = thumb_length.decode("hex") to_length = chr(wa_functions.mb_strlen(to, "UTF-8")) msgid_length = chr(wa_functions.mb_strlen(msgid)) path_length = chr(wa_functions.mb_strlen(path)) size_length = chr(wa_functions.mb_strlen(str(size))) link_length = chr(wa_functions.mb_strlen(link)) content = "\xF8\x08\x5D\xA0\xFA\xFC" + to_length content += to content += "\x8A\xA2\x1B\x43\xFC" + msgid_length content += msgid content += ( "\xF8\x02\xF8\x04\xBA\xBD\x4F\xF8\x01\xF8\x01\x8C\xF8\x0C\x5C\xBD\xB0\xA2\x44\xFC\x04\x66\x69\x6C\x65\xFC" + path_length ) content += path content += "\xFC\x04\x73\x69\x7A\x65\xFC" + size_length content += str(size) content += "\xA5\xFC" + link_length content += link content += "\xFD\x00" + thumb_length content += b64thumb contentlen = len(content) total_length = wa_functions._hex(contentlen) total_length = total_length.decode("hex") msg = "" msg += total_length msg += content s.send(msg) report = s.recv(1024) report = s.recv(1024) print "Last read ===>", repr(report)
def sendMedia(i, to, path, size, link, b64thumb): global s t = str(time.time()) t = t[:10] msgid = t+"-"+i thumblen = len(b64thumb) thumb_length = wa_functions._hex(thumblen) thumb_length = thumb_length.decode("hex") to_length = chr(wa_functions.mb_strlen(to,"UTF-8")) msgid_length = chr(wa_functions.mb_strlen(msgid)) path_length = chr(wa_functions.mb_strlen(path)) size_length = chr(wa_functions.mb_strlen(str(size))) link_length = chr(wa_functions.mb_strlen(link)) content = "\xF8\x08\x5D\xA0\xFA\xFC"+to_length content += to content += "\x8A\xA2\x1B\x43\xFC"+msgid_length content += msgid content += "\xF8\x02\xF8\x04\xBA\xBD\x4F\xF8\x01\xF8\x01\x8C\xF8\x0C\x5C\xBD\xB0\xA2\x44\xFC\x04\x66\x69\x6C\x65\xFC"+path_length content += path content += "\xFC\x04\x73\x69\x7A\x65\xFC"+size_length content += str(size) content += "\xA5\xFC"+link_length content += link content += "\xFD\x00"+thumb_length content += b64thumb contentlen = len(content) total_length = wa_functions._hex(contentlen) total_length = total_length.decode("hex") msg = "" msg += total_length msg += content s.send(msg) report = s.recv(1024) report = s.recv(1024) print 'Last read ===>', repr(report)
def sendMessage(i, to, txt): global s t = str(time.time()) t = t[:10] msgid = t+"-"+i long_txt_bool = wa_functions.isShort(txt) txtle = len(txt) txt_length = wa_functions._hex(txtle) # Returns length in hex txt_length = txt_length.decode("hex") to_length = chr(wa_functions.mb_strlen(to,"UTF-8")) msgid_length = chr(wa_functions.mb_strlen(msgid)) content = "\xF8\x08\x5D\xA0\xFA\xFC"+to_length content += to; content += "\x8A\xA2\x1B\x43\xFC"+msgid_length content += msgid; content += "\xF8\x02\xF8\x04\xBA\xBD\x4F\xF8\x01\xF8\x01\x8C\xF8\x02\x16" if not (long_txt_bool): content += "\xFD\x00"+txt_length else: content += "\xFC"+txt_length content += txt; total_length = wa_functions._hex(len(content)) total_length = total_length.decode("hex") if(len(str(total_length)) == 1): total_length = "\x00"+total_length msg = "" msg += total_length msg += content s.send(msg) report = s.recv(1024) report = s.recv(1024) print 'Last read ===>', repr(report) return msg