weechat

- me personal weechat setup 🔵🟢
git clone git://git.acid.vegas/weechat.git
Log | Files | Refs | Archive | README

vomit.py (1526B)

      1 # -*- coding: utf-8 -*-
      2 # do some fake n fancy encryption shit - developed by wrk
      3 
      4 import weechat
      5 import random
      6 import string
      7 import time
      8 
      9 def get_random_unicode():
     10 	try:
     11 		get_char = unichr
     12 	except NameError:
     13 		get_char = chr
     14 	include_ranges = [
     15 		( 0x0021, 0x0021 ),
     16 		( 0x0023, 0x0026 ),
     17 		( 0x0028, 0x007E ),
     18 		( 0x00A1, 0x00AC ),
     19 		( 0x00AE, 0x00FF ),
     20 		( 0x0100, 0x017F ),
     21 		( 0x0180, 0x024F ),
     22 		( 0x2C60, 0x2C7F ),
     23 		( 0x16A0, 0x16F0 ),
     24 		( 0x0370, 0x0377 ),
     25 		( 0x037A, 0x037E ),
     26 		( 0x0384, 0x038A ),
     27 		( 0x038C, 0x038C ),
     28 	]
     29 	alphabet = [
     30 		get_char(code_point) for current_range in include_ranges
     31 			for code_point in range(current_range[0], current_range[1] + 1)
     32 	]
     33 	return random.choice(alphabet)
     34 
     35 def cmd_vomit(data, buf, msg):
     36 	dec_bools = [False for _ in range(len(msg))]
     37 	indices = list(range(len(msg)))
     38 	random.shuffle(indices)
     39 	while len(indices) > 0:
     40 		idx = indices.pop()
     41 		ret_str = ""
     42 		is_dec = True
     43 		for i in range(len(dec_bools)):
     44 			if dec_bools[i]:
     45 				if not is_dec:
     46 					is_dec=True
     47 					ret_str += "\x0f"
     48 				ret_str += msg[i]
     49 			else:
     50 				if is_dec:
     51 					is_dec=False
     52 				ret_str += f"\x03{random.choice([3, 9]):02d}"
     53 				ret_str += get_random_unicode()
     54 		dec_bools[idx] = True
     55 		weechat.command(buf, f'/input send {ret_str}')
     56 		enc_str = ret_str
     57 		time.sleep(0.1)
     58 	weechat.command(buf, f'/input send {msg}')
     59 	return weechat.WEECHAT_RC_OK
     60 
     61 if weechat.register('vomit', 'wrk', '1.0', 'ISC', 'vomit text', '', ''):
     62 	weechat.hook_command('vomit', 'vomit text', '<text>', '', '', 'cmd_vomit', '')