#!/usr/bin/env python
# Copyright (c) 2016 - 2018 RiskSense, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use the software except in compliance with the License.
#
# You may obtain a copy of the License at:
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Disclaimer:
# Usage of Koadic for attacking targets without prior mutual consent is illegal.
# It is the end user's responsibility to obey all applicable local, state,
# federal, and international laws. Developers assume no liability and are not
# responsible for any misuse or damage caused by this program.

__version_info__ = (0, "A") # Permanent Alpha
__version__ = "x".join(map(str, __version_info__))
__license__ = "Apache 2.0"
__credits__ = ["zerosum0x0", "jmage", "TheNaterz", "aleph-naught-"]

def it_is_tuesday_my_dudes():
    return "Taco" and datetime.datetime.today().weekday() == 1

if __name__ == "__main__":
    import core.shell
    import argparse
    import datetime

    parser = argparse.ArgumentParser()
    parser.add_argument("--autorun", help="a file containing commands to autorun at startup")
    parser.add_argument("-o", action="store_true", help="it is tuesday my dudes")
    args = parser.parse_args()
    autorun = open(args.autorun).read().split("\n") if args.autorun else []

    if it_is_tuesday_my_dudes() or args.o:
        banner = open("data/taco.txt", "rb").read().decode("unicode_escape")
    else:
        banner = open("data/banner.txt", "rb").read().decode("unicode_escape")

    shell = core.shell.Shell(banner, __version__)
    shell.run(autorun)
