archive

- Random tools & helpful resources for IRC
git clone git://git.acid.vegas/archive.git
Log | Files | Refs | Archive

debug.py (1663B)

      1 #!/usr/bin/env python
      2 # IRC Services (IRCS) - Developed by acidvegas in Python (https://acid.vegas/ircs)
      3 # debug.py
      4 
      5 import ctypes
      6 import os
      7 import sys
      8 import time
      9 import string
     10 
     11 def check_data(data):
     12     if all(c in string.printable for c in data):
     13         return True
     14     else:
     15         return False
     16 
     17 def check_privileges():
     18     if check_windows():
     19         if ctypes.windll.shell32.IsUserAnAdmin() != 0:
     20             return True
     21         else:
     22             return False
     23     else:
     24         if os.getuid() == 0 or os.geteuid() == 0:
     25             return True
     26         else:
     27             return False
     28 
     29 def check_version(major):
     30     if sys.version_info.major == major:
     31         return True
     32     else:
     33         return False
     34 
     35 def check_windows():
     36     if os.name == 'nt':
     37         return True
     38     else:
     39         return False
     40 
     41 def clear():
     42     if check_windows():
     43         os.system('cls')
     44     else:
     45         os.system('clear')
     46 
     47 def error(msg, reason=None):
     48     if reason:
     49         print('{0} | [!] - {1} ({2})'.format(get_time(), msg, str(reason)))
     50     else:
     51         print('{0} | [!] - {1}'.format(get_time(), msg))
     52 
     53 def error_exit(msg):
     54     raise SystemExit('{0} | [!] - {1}'.format(get_time(), msg))
     55 
     56 def get_time():
     57     return time.strftime('%I:%M:%S')
     58 
     59 def info():
     60     clear()
     61     print(''.rjust(56, '#'))
     62     print('#{0}#'.format(''.center(54)))
     63     print('#{0}#'.format('IRC Services (IRCS)'.center(54)))
     64     print('#{0}#'.format('Developed by acidvegas in Python'.center(54)))
     65     print('#{0}#'.format('https://acid.vegas/ircs'.center(54)))
     66     print('#{0}#'.format(''.center(54)))
     67     print(''.rjust(56, '#'))
     68 
     69 def irc(msg):
     70     print('{0} | [~] - {1}'.format(get_time(), msg))