Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)))
Esempio 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'
Esempio 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
Esempio 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)
Esempio 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
Esempio 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")
Esempio 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")
)
Esempio n. 11
0
def main():
    greet.greet('Sarang')
Esempio n. 12
0
 def test_greet_multiple(self):
     self.assertEqual(greet(['Amy', 'Brian', 'Charlotte']),
                      'Hello, Amy, Brian, and Charlotte.')
Esempio n. 13
0
 def test_many(self):
     self.assertEqual(greet(["Spock", "Bones"]), "Hello, Spock and Bones.")
Esempio n. 14
0
def niam(args):
    return greet(args)
Esempio n. 15
0
def main():
    greet.greet('World')
Esempio n. 16
0
def test_greet():
    assert greet(name="Tucker") == "Hello, Tucker!"
Esempio n. 17
0
from greet import greet

print greet('GitHub')
Esempio n. 18
0
 def test_null_name(self):
     self.assertEqual(greet(None), 'Hello, my friend.')
Esempio n. 19
0
 def test_greet(self):
     self.assertEqual(greet('Bob'), 'Hello, Bob.')
Esempio n. 20
0
 def test_intentional_comma(self):
     self.assertEqual(greet(['Bob', '"Charlie, Dianne"']),
                      'Hello, Bob and Charlie, Dianne.')
Esempio n. 21
0
 def test_split_comma(self):
     self.assertEqual(greet(['Bob', 'Charlie, Dianne']),
                      'Hello, Bob, Charlie, and Dianne.')
Esempio n. 22
0
 def test_mix_shouting(self):
     self.assertEqual(greet(['Amy', 'BRIAN', 'Charlotte']),
                      'Hello, Amy and Charlotte. AND HELLO BRIAN!')
Esempio n. 23
0
 def test_greet_john(self):
     result = greet("John")
     self.assertEqual("Hi John!", result)
Esempio 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')
Esempio n. 25
0
 def test_greet_jack(self):
     result = greet("Jack")
     self.assertEqual("Hi Jack!", result)
Esempio n. 26
0
import greet

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

greet.greet('Abdulrahman')
Esempio n. 29
0
 def test_shout(self):
     self.assertEqual(greet("KHAN"), "HELLO KHAN!")
Esempio 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()

Esempio n. 31
0
#!/usr/bin/env python

import greet

greet.greet("Dude")
Esempio n. 32
0
 def test_lots(self):
     self.assertEqual(greet(["Spock", "Bones", "Scotty"]), "Hello, Spock, Bones, and Scotty.")
Esempio n. 33
0
 def test_greet_two_names(self):
     self.assertEqual(greet(['Jill', 'Jane']), 'Hello, Jill and Jane.')
Esempio n. 34
0
 def test_null(self):
     self.assertEqual(greet(None), "Hello, my friend.")
Esempio n. 35
0
def main():
    greet.greet('Anshul Saraf')
Esempio n. 36
0
 def test_greet_john(self):
     result = greet('John')
     self.assertEqual('Hi John!', result)
Esempio n. 37
0
 def test_greet(self):
     self.assertEqual("hello!", greet())
Esempio 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!")
Esempio n. 39
0
 def test_greet_jack(self):
     result = greet('Jack')
     self.assertEqual('Hi Jack!', result)