예제 #1
0
class AimlCompanionConfig:
    from platform import system as OS
    import os

    PORT = 8080
    HOST = "127.0.0.1"
    TCP_BUFFER_LEN = 16384
    SCRIPT_FILE = "NosferatuZodd-tcp.bat" if OS(
    ) == "Windows" else "NosferatuZodd-tcp.sh &"
    SCRIPT_PATH = os.path.join(".", "NosferatuZodd", "scripts",
                               "windows" if OS() == "Windows" else "xnix",
                               SCRIPT_FILE)
    SCRIPT_SHELL = "start" if OS() == "Windows" else "sh"
예제 #2
0
파일: termcolor.py 프로젝트: lnxg33k/Narith
def colored(text, color=None, on_color=None, attrs=None):
    """Colorize text.
    
    Available text colors:
        red, green, yellow, blue, magenta, cyan, white.
    
    Available text highlights:
        on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.
    
    Available attributes:
        bold, dark, underline, blink, reverse, concealed.
    
    Example:
        colored('Hello, World!', 'red', 'on_grey', ['blue', 'blink'])
        colored('Hello, World!', 'green')
    """
    if os.getenv('ANSI_COLORS_DISABLED') is None and 'windows' not in OS(
    ).lower():
        fmt_str = '\x1b[%dm%s'
        if color is not None:
            text = fmt_str % (COLORS[color], text)
        if on_color is not None:
            text = fmt_str % (HIGHLIGHTS[on_color], text)
        if attrs is not None:
            for attr in attrs:
                text = fmt_str % (ATTRIBUTES[attr], text)

        text += RESET
    return text
예제 #3
0
def copy_to_clipboard(string):
    """Copy string to system clipboard."""
    system({
        'Darwin': f'echo "{string}" | pbcopy',
        'Linux': f'echo "{string}" | xsel --clipboard',
        'Windows': f'echo {string}| clip',
    }[OS()])
    if not args.raw:
        print(f'copied "{string}" to clipboard')
예제 #4
0
def update():
    baseFolder = path.join(os.path.dirname(__file__), os.pardir,
                           os.pardir)  # ./core/libs/update.py
    if not path.exists(path.join(getcwd(), "webhandler.py")):
        errmsg = '[!] Unable to update WebHandler without being in the base folder.'
        errmsg += '\n[i] E.g. "cd {0}", and then try again.'.format(baseFolder)
        cprint(errmsg, 'red')
        sys.exit(1)

    if Popen("git --version", shell=True, stdout=PIPE,
             stderr=PIPE).wait() != 0:
        errmsg = '\n[!] Didn\'t detect git. Therefore unable to update.'
        errmsg += '\n[!] e.g. sudo apt-get install git OR sudo yum install git. Else visit http://git-scm.com/'
        errmsg += '[!] Update: Aborted'
        cprint(errmsg, 'red')
        return

    if not path.exists(path.join(baseFolder, ".git")):
        errmsg = '\n[!] ".git" directory doesn\'t exist here.'
        cprint(errmsg, 'red')

        msg = '\n[i] Detected git, cloning WebHandler'
        if 'windows' in OS().lower():
            command = "xcopy \"%CD%\" \"%CD%_old\" /E /C /I /G /H /R /Y && set rmdir=\"%CD%\" && cd %HOME% && rmdir %rmdir% /s /q & git clone https://github.com/lnxg33k/webhandler.git \"%CD%\""
        else:
            command = "mv -f {0}/{,_old} && git clone https://github.com/lnxg33k/webhandler.git \"{0}/\"".format(
                baseFolder)
        msg = '\n[i] Executing: %s' % (command)
        cprint(msg, 'green')

        f = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)

        msg = '[+] Successfully upgrade to the latest git version'
        msg += '\n[i] Make sure to re-run WebHandler to use the updated version'
        cprint(msg, 'green')
    else:
        f = Popen('git rev-parse --short HEAD',
                  shell=True,
                  stdout=PIPE,
                  stderr=PIPE)  #cwd=baseFolder
        current_commit = f.communicate()[0]
        msg = '\n[+] WebHandler current commit: {0}'.format(current_commit)
        msg += '[+] Update in progress, please wait...'
        cprint(msg, 'green')
        f = Popen('git pull; git rev-parse --short HEAD',
                  shell=True,
                  stdout=PIPE,
                  stderr=PIPE)
        out, err = f.communicate()
        if out and not err:
            msg = '[+] Updated successfully to: {0}\n'.format(out.split()[-1])
            msg += '\n[i] Make sure to re-run WebHandler to use the updated version'
            cprint(msg, 'green')
        else:
            errmsg = '\n[!] Unable to update'
            errmsg += '\n[!] Make sure you have an internet connection'
            cprint(errmsg, 'red')
예제 #5
0
    def __init__(self, key):
        self.key = key
        self.in_channel = False
        self.running = True
        self.voice = None

        if OS() == 'Darwin':
            self.CHANNELS = 1
            self.CHUNK = 1920
            self.RATE = 96000
        else:
            self.CHANNELS = 2
            self.CHUNK = 960
            self.RATE = 48000
        self.FORMAT = pyaudio.paInt16
        self.pAudio = pyaudio.PyAudio()

        #Run the input in a new thread
        thread = threading.Thread(target=self.run, args=())
        thread.daemon = True
        thread.start()
예제 #6
0
        s = '\rk' + str(s)
    per = '0' * (len(jml) - len(i))
    per = per + i
    tamp('\rb==> \rk[\rh%s\rk/\rh%s\rk]%s__%s__%s__%s__%s' %
         (per, jml, h, m, p, r, s))


def tamp(x):
    w = {'m': 31, 'h': 32, 'k': 33, 'b': 34, 'p': 35, 'c': 36, 'P': 37}
    for i in w:
        x = x.replace('\r%s' % i, '\033[%s;1m' % w[i])
        x += '\033[0m'
    x = x.replace('\r0', '\033[0m')
    print x


if __name__ == '__main__':
    if v().split('.')[0] != '2':
        print(
            '[!] kamu menggunakan python versi %s silahkan menggunakan versi 2.x.x'
            % v().split(' ')[0])
        exit(1)
    if OS().upper() != 'LINUX':
        print('[!] kamu menggunakan %s silahkan menggunakan linux' %
              OS().upper())
        exit(1)
    main()
else:
    print('[!] ini bukan module toyol')
    exit(1)
예제 #7
0
else:
    # Check for arguments dependencies
    if getargs.url:
        if getargs.method == 'post' and not getargs.parameter:
            errmsg = '\n[!] Using post method requires --parameter flag, check help'
            exit(cprint(errmsg, 'red'))
        elif getargs.method == 'get' and getargs.parameter:
            errmsg = '\n[!] Using get method doesn\'t require --parameter flag, check help'
            exit(cprint(errmsg, 'red'))
        else:
            if not getargs.banner:
                print banner  # Print the banner
            commander.BackConnect()  # Call BackConnect method to handle input

    elif getargs.listen or getargs.connect:
        if 'windows' in OS().lower():
            errmsg = '[!] WebHandler doesn\'t support Windows yet, still working on it.'
            exit(cprint(errmsg, 'red'))
        if getargs.listen:
            listen.wait_connection(
            )  # Call wait_connection to wait for a connection
            commander.BackConnect()  # Call BackConnect method to handle input
        else:
            connect.create_connection(
            )  # Call create_connection to try and connect to the target
            commander.BackConnect()  # Call BackConnect method to handle input

    elif getargs.update:
        update()  # Update the script
예제 #8
0
PULLWORDS = set()

try:
    with open('exceptions.txt', 'r') as wordlist:
        for line in wordlist.readlines():
            EXCEPTIONS.add(line.strip())
    with open('pullwords.txt', 'r') as wordlist:
        for line in wordlist.readlines():
            PULLWORDS.add(line.strip())
except FileNotFoundError:
    print(f'\nERROR: File "{file}" not found\n\nCreate it with the command:')
    print({
        'Darwin': f'  touch {file}',
        'Linux': f'  touch {file}',
        'Windows': f'  type nul > {file}',
    }[OS()])
    exit(1)


def expand_years(title):
    years = findall(r"\'[0-9]{2}", title)
    if len(years) == 0:
        return title
    while len(years) > 0:
        y = years[0]
        if int(y[1:3]) > int(date('%y')):
            title = sub(y, sub(r"'", '19', y), title)
        else:
            replacement = input(f'ERROR: Fix year {y}: ')
            title = sub(y, replacement, title)
        years.pop(0)
예제 #9
0
파일: HC.py 프로젝트: certix7/hostchecker
		s = '\rh'+str(s)
	else:
		s = '\rk'+str(s)
	per = '0'*(len(jml)-len(i))
	per = per+i
	tamp('\rb==> \rk[\rh%s\rk/\rh%s\rk]%s__%s__%s__%s__%s'%(per,jml,h,m,p,r,s))
def tamp(x):
	w = {
		'm':31,
		'h':32,
		'k':33,
		'b':34,
		'p':35,
		'c':36,
		'P':37}
	for i in w:
		x=x.replace('\r%s'%i,'\033[%s;1m'%w[i])
		x+='\033[0m'
	x=x.replace('\r0','\033[0m')
	print x
if __name__ == '__main__':
	if v().split('.')[0] != '2':
		print('[!] kamu menggunakan python versi %s silahkan menggunakan versi 2.x.x'%v().split(' ')[0])
		exit(1)
	if OS().upper() != 'LINUX':
		print('[!] kamu menggunakan %s silahkan menggunakan linux'%OS().upper())
		exit(1)
	main()
else:
	print('[!] ini bukan module toyol')
	exit(1)