Exemplo n.º 1
0
def main():
    greet()
    args = parseargs()
    f_kav_log = args.log
    if not os.path.exists(f_kav_log):
        print("[i] The\"{}\" is not existed.\n".format(f_kav_log))

    read_log(f_kav_log)
Exemplo n.º 2
0
def main():
    greet()
    args = parseargs()
    f_pe = args.file
    print(f_pe)
    if not is_pe(f_pe):
        print("[!] It is not a PE file.")
    else:
        print("It is a PE file")
    printable = set(string.printable)
    print(printable)
    print(len(printable))
    extract_string(f_pe)
Exemplo n.º 3
0
def main():
    if DEPLOY == 'heroku':
        ip_address = request.headers['X-Forwarded-For']
    else:
        ip_address = get_ip_address()

    return greet(ip_address)
Exemplo n.º 4
0
def main():
    list_folder = []  # List of folders in the malware repo
    _count = []
    p = Pool(N_WORKER)

    greet()
    args = parseargs()

    with open(FILE_LIST_FOLDER, "r") as f:
        list_folder = f.readlines()
    list_folder = [
        os.path.abspath(DIR_SHA256 + x.strip()) + "/" for x in list_folder
    ]

    n = 0
    if args.type == "json":
        _count = p.map(worker_json, list_folder)
    elif args.type == "sha256":
        _count = p.map(worker_sha256, list_folder)

    print("{} md5 files are created.".format(sum(_count)))
Exemplo n.º 5
0
def test_greet():
    assert greet('english') == 'Welcome'
    assert greet('dutch') == 'Welkom'
    assert greet('IP_ADDRESS_INVALID') == 'Welcome'
    assert greet('finnish') == 'Tervetuloa'
    assert greet('') == 'Welcome'
    assert greet(2) == 'Welcome'
Exemplo n.º 6
0
def main(argv=[]):
    arguments = argv[1:] or sys.argv[1:]
    opts, args = getopt(arguments, 'n:', ['name='])
    name = None
    for option, value in opts:
        if option in ('-n', '--name'): 
            name = value 
    if args:
        name = args[0]
    if not name:
        echo(USAGE)
        return 1
    message = greet(name)
    echo(message)
    return 0
Exemplo n.º 7
0
    def test_rand(self):
        from random import randint, choice

        def randgen_sent():
            rand = randint(10, 50)
            base = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?.,'
            sent = ''.join(choice(base) for i in range(rand))
            print(sent)
            return sent

        actual = lambda s: "Hello, {} how are you doing today?".format(s)

        for _ in range(100):
            string = randgen_sent()
            expected = actual(string)
            self.assertEqual(greet(string), expected)
Exemplo n.º 8
0
def main(argv=[]):
    arguments = argv[1:] or sys.argv[1:]
    
    try:
        names = list()
        opts, args = getopt(arguments, 'n:', ['name='])
        for option, value in opts:
            if option in ('-n', '--name'): 
                names.append(value)
        for arg in args:
            names.append(arg)
    except GetoptError:
        pass
    if not names:
        echo(USAGE)
        return 1
    message = greet(",".join(names))
    echo(message)
    return 0
Exemplo n.º 9
0
    def test_rand(self):
        from random import randint
        sol = lambda l: {
            'english': 'Welcome',
            'czech': 'Vitejte',
            'danish': 'Velkomst',
            'dutch': 'Welkom',
            'estonian': 'Tere tulemast',
            'finnish': 'Tervetuloa',
            'flemish': 'Welgekomen',
            'french': 'Bienvenue',
            'german': 'Willkommen',
            'irish': 'Failte',
            'italian': 'Benvenuto',
            'latvian': 'Gaidits',
            'lithuanian': 'Laukiamas',
            'polish': 'Witamy',
            'spanish': 'Bienvenido',
            'swedish': 'Valkommen',
            'welsh': 'Croeso'
        }.get(l, 'Welcome')
        base = [
            'english', 'czech', 'IP_ADDRESS_INVALID', 'danish',
            'IP_ADDRESS_NOT_FOUND', 'dutch', 'estonian',
            'IP_ADDRESS_NOT_FOUND', 'finnish', 'flemish', 'french', 'german',
            'irish', 'italian', 'IP_ADDRESS_REQUIRED', 'latvian',
            'IP_ADDRESS_REQUIRED', 'lithuanian', 'polish',
            'IP_ADDRESS_NOT_FOUND', 'spanish', 'swedish',
            'IP_ADDRESS_NOT_FOUND', 'welsh', 'IP_ADDRESS_NOT_FOUND',
            'IP_ADDRESS_INVALID'
        ]

        for _ in range(40):
            l = base[randint(0, len(base) - 1)]
            self.assertEqual(greet(l), sol(l),
                             "It should work for random inputs too")
Exemplo n.º 10
0
# from calculator import (addition,
#                         subtraction,
#                         multiplication,
#                         division)

from calculator import (addition as add,
                        subtraction as sub,
                        multiplication as mul,
                        division as div)

from calculator import *

from greet import greet


num1 = 10
num2 = 20

print(
    add(num1, num2),
    sub(num1, num2),
    mul(num1, num2),
    div(num1, num2),
    sep='\n'
)

print(
    greet("Makku")
)
Exemplo n.º 11
0
def main():
    greet.greet('Sarang')
Exemplo n.º 12
0
 def test_greet_multiple(self):
     self.assertEqual(greet(['Amy', 'Brian', 'Charlotte']),
                      'Hello, Amy, Brian, and Charlotte.')
Exemplo n.º 13
0
 def test_many(self):
     self.assertEqual(greet(["Spock", "Bones"]), "Hello, Spock and Bones.")
Exemplo n.º 14
0
def niam(args):
    return greet(args)
Exemplo n.º 15
0
def main():
    greet.greet('World')
Exemplo n.º 16
0
def test_greet():
    assert greet(name="Tucker") == "Hello, Tucker!"
Exemplo n.º 17
0
from greet import greet

print greet('GitHub')
Exemplo n.º 18
0
 def test_null_name(self):
     self.assertEqual(greet(None), 'Hello, my friend.')
Exemplo n.º 19
0
 def test_greet(self):
     self.assertEqual(greet('Bob'), 'Hello, Bob.')
Exemplo n.º 20
0
 def test_intentional_comma(self):
     self.assertEqual(greet(['Bob', '"Charlie, Dianne"']),
                      'Hello, Bob and Charlie, Dianne.')
Exemplo n.º 21
0
 def test_split_comma(self):
     self.assertEqual(greet(['Bob', 'Charlie, Dianne']),
                      'Hello, Bob, Charlie, and Dianne.')
Exemplo n.º 22
0
 def test_mix_shouting(self):
     self.assertEqual(greet(['Amy', 'BRIAN', 'Charlotte']),
                      'Hello, Amy and Charlotte. AND HELLO BRIAN!')
Exemplo n.º 23
0
 def test_greet_john(self):
     result = greet("John")
     self.assertEqual("Hi John!", result)
Exemplo n.º 24
0
 def test(self):
     self.assertEqual(greet('english'), 'Welcome')
     self.assertEqual(greet('dutch'), 'Welkom')
     self.assertEqual(greet('IP_ADDRESS_INVALID'), 'Welcome')
     self.assertEqual(greet(''), 'Welcome')
     self.assertEqual(greet(2), 'Welcome')
Exemplo n.º 25
0
 def test_greet_jack(self):
     result = greet("Jack")
     self.assertEqual("Hi Jack!", result)
Exemplo n.º 26
0
import greet

if __name__ == "__main__":
    print("running main function")
    greet.greet("John Doe")
    greet.print_version()
Exemplo n.º 27
0
 def test_basic(self):
     self.assertEqual(greet('Kirk'), "Hello, Kirk.")
Exemplo n.º 28
0
# Day 50
import greet

greet.greet('Abdulrahman')
Exemplo n.º 29
0
 def test_shout(self):
     self.assertEqual(greet("KHAN"), "HELLO KHAN!")
Exemplo n.º 30
0
                        text='/weather - Get weather details')

    except Exception:
        bot.send_message(chat_id=update.effective_chat.id, 
                        text="City not found")
        bot.send_message(chat_id=update.effective_chat.id, 
                        text='/news - Top 10 headlines')
        bot.send_message(chat_id=update.effective_chat.id, 
                        text='/weather - Get weather details')

#user input
def input1(update:Update, context:CallbackContext):
    bot.send_message(chat_id=update.effective_chat.id, 
                        text="Enter city name")
    dp.add_handler(MessageHandler(Filters.text, weatherD))
    





start = CommandHandler('start', greet.greet())
news = CommandHandler('news', news)
weather = CommandHandler('weather', input1)
updater.start_polling()
dispatcher.add_handler(start)
dispatcher.add_handler(news)
dispatcher.add_handler(weather)
updater.idle()

Exemplo n.º 31
0
#!/usr/bin/env python

import greet

greet.greet("Dude")
Exemplo n.º 32
0
 def test_lots(self):
     self.assertEqual(greet(["Spock", "Bones", "Scotty"]), "Hello, Spock, Bones, and Scotty.")
Exemplo n.º 33
0
 def test_greet_two_names(self):
     self.assertEqual(greet(['Jill', 'Jane']), 'Hello, Jill and Jane.')
Exemplo n.º 34
0
 def test_null(self):
     self.assertEqual(greet(None), "Hello, my friend.")
Exemplo n.º 35
0
def main():
    greet.greet('Anshul Saraf')
Exemplo n.º 36
0
 def test_greet_john(self):
     result = greet('John')
     self.assertEqual('Hi John!', result)
Exemplo n.º 37
0
 def test_greet(self):
     self.assertEqual("hello!", greet())
Exemplo n.º 38
0
 def test(self):
     self.assertEqual(greet("James"), "Hello, James!")
     self.assertEqual(greet("Jane"), "Hello, Jane!")
     self.assertEqual(greet("Jim"), "Hello, Jim!")
     self.assertEqual(greet("Johnny"), "Hello, my love!")
Exemplo n.º 39
0
 def test_greet_jack(self):
     result = greet('Jack')
     self.assertEqual('Hi Jack!', result)