Example #1
0
def startbanner():

	print" \033[94m ______         _   _  __    _______ _       __          __  _\033[0m"  
	print" \033[94m|  ____|       | | (_)/ _|  |__   __| |      \ \        / / | |\033[0m"    
	print" \033[94m| |__ ___  _ __| |_ _| |_ _   _| |  | |__   __\ \  /\  / /__| |__\033[0m"  
	print" \033[94m|  __/ _ \| '__| __| |  _| | | | |  | '_ \ / _ \ \/  \/ / _ \ '_ \ \033[0m" 
	print" \033[94m| | | (_) | |  | |_| | | | |_| | |  | | | |  __/\  /\  /  __/ |_) |\033[0m"
	print" \033[94m|_|  \___/|_|   \__|_|_|  \__, |_|  |_| |_|\___| \/  \/ \___|_.__/ \033[0m"
	print" \033[94m                           __/ |                        ShadowLabs  \033[0m"
	print"  \033[94m                         |___/       \033[0m"
	print""
	print(' \033[94m******************************************\033[0m')
	print(' \033[94mFTW (Fortify The Web)\033[0m')
	print(' \033[94mDevs: @semprix, @httphacker, @shipcod3\033[0m')
	print(' \033[94mVersion: v1.0\033[0m')
	print(' \033[94m******************************************\033[0m')
	print ""

	print "Target:", sys.argv[1]
	try:
		reversedns = socket.gethostbyaddr(sys.argv[1])
		print "IP Address:", reversedns
		print "Fortifying the Web now!!!"
	except socket.error as e:
		printout (' >> Hostname lookup failed, application will now shutdown', RED)
		time.sleep(3)
		print "[*] Shutting down"
		timer()
		sys.exit()
Example #2
0
def display(main_window, background_color, user_data, quiz_questions):
    frame_timer = tk.Frame(main_window, background=background_color)
    frame_timer.pack()
    label_timer = tk.Label(frame_timer,
                           text="timer",
                           font=("helvetica", 20),
                           background=background_color,
                           justify="center")
    label_timer.pack()

    timer(label_timer, time,
          lambda: end_page(main_window, quiz_questions, user_data))

    label_roll = label_timer = tk.Label(frame_timer,
                                        text="Roll: " + str(user_data[1]),
                                        font=("helvetica", 20),
                                        background=background_color,
                                        justify="center")
    label_roll.pack(pady=5)

    label_user = label_timer = tk.Label(frame_timer,
                                        text="Name: " + str(user_data[0]),
                                        font=("helvetica", 20),
                                        background=background_color,
                                        justify="center")
    label_user.pack(pady=5)

    label_unattempted = tk.Label(frame_timer,
                                 text="Unattempted Questions: " + str(0),
                                 font=("helvetica", 20),
                                 background=background_color,
                                 justify="center")
    label_unattempted.pack()

    return frame_timer, label_unattempted
Example #3
0
def TimeTest(parallel=0):
    timer()
    if parallel == 1:
        print(PlaySetParallel(1))
    else:
        print(PlaySimpleSet(100))
    #print(PlaySetParallel(100))
    timer()
def TimeTest(parallel=0):
    timer()
    if parallel == 1:
        print(PlaySetParallel(1))
    else:
        print(PlaySimpleSet(100))
    #print(PlaySetParallel(100))
    timer()
def total(reps,func,*pargs,**kargs):
    """"""
    Total time to run func()reps times
    Return(total time,last results)
    """"""
    repslist=list(range(reps))  #Hoist out equalize 2x,3x
    start=timer()               #Or perf__counter/other in 3.3+
    for i in repslist:
        ret=func(pargs.**kargs)
    elapsed=timer()-start
    return(elapsed,ret)
Example #6
0
def main():
    timer()
    # print(simple_success_indicator(player1))
    games = 1000
    thresh = 100
    results = []
    for i in range(games):
        player1 = Player(1, buying_threshold=thresh, building_threshold=5, jail_time=0, smart_jail_strategy=False,
                         complete_monopoly=0, group_preferences=(), development_threshold=0)
        player2 = Player(2, buying_threshold=100, building_threshold=5, jail_time=0, smart_jail_strategy=False,
                         complete_monopoly=0, group_preferences=(), development_threshold=0)
        game0 = Game([player1, player2], cutoff=1000)
        results.append(game0.play()[0])

    print("thresh=", thresh, "ties", results.count(0) / games)
    print("thresh=", thresh, "p1", results.count(1) / games)
    print("thresh=", thresh, "p2", results.count(2) / games)
    timer()
    def __init__(self, master=None):
        
        # parameters that you want to send through the Frame class. 
        Frame.__init__(self, master)   

        #reference to the master widget, which is the tk window                 
        self.master = master
        self.gc = []
        #with that, we want to then run init_window, which doesn't yet exist
        self.init_window()
        self.timer=timer(self,1)
        self.timer.start()
Example #8
0
    def parse(args):
        global writeMac

        i = 0
        while i < len(args):
            # charsets args
            if args[i] == '-b':
                sysBurnMac()
            elif args[i] == '-m':
                sysWriteMac()
            elif args[i] == '-t':
                timer('t')
            elif args[i] == '-br':
                timer('br')

            # help args
            elif args[i] == '-h':
                help()
                sys.exit(0)
            i += 1
        if len(args) == 0:
            help()
            exit(1)
Example #9
0
  def parseTimer(self, data):
    # Compile the regular expression pattern into a regular expression object to
    # parse the timer data.
    pattern = re.compile(r"""
        .*?runtime: (?P<runtime>.*?)s.*
        """, re.VERBOSE|re.MULTILINE|re.DOTALL)

    match = pattern.match(data.decode())
    if not match:
      Log.Fatal("Can't parse the data: wrong format")
      return -1
    else:
      # Create a namedtuple and return the timer data.
      timer = collections.namedtuple("timer", ["runtime"])
      return timer(float(match.group("runtime")))
Example #10
0
def main():
    arguments = sys.argv  #pull in arguments
    counter = 0
    numExpected = False

    for item in arguments:
        if (numExpected):
            data = item.split('/')
            times.append(float(data[1]))
            myDe.debugPrint(times)
            mtrNum = int(data[0])
            motors.append(motor(motorPins[mtrNum - 1], myDe, mtrNum))
            print(times)
            print(mtrNum)
            numExpected = False

    #print(item)
        if (item == "-D" or item == "-d"):
            myDe.activate()
            myDe.debugPrint(item, "input " + str(counter))
            counter = counter + 1
        if (item.startswith("-t")):
            myDe.debugPrint("found timer input in minutes")
            numExpected = True
    count = 0
    for tm in times:
        newTimer = timer(tm, myDe, motors[count])
        timers.append(newTimer)
        count += 1
    #myDe.debugPrint("Debugger Activated")
    for i in range(0, len(timers)):
        t = threading.Thread(target=beginTimer, args=(i, ))
        t.daemon = True
        t.start()
    activeTimers = True
    time.sleep(3)
    while (activeTimers):
        activeTimers = False
        for tmr in timers:
            print(tmr.isRunning())
            if (tmr.isRunning()):
                activeTimers = True

        time.sleep(1)
Example #11
0
from timer import *
timer = timer()
import numpy as np
from licker import *
#from subj import Sessions, Trials, Licks
from stimulus import *
import pygame
import os
from glob import glob

os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (0, 0)

# Set Parameters
w = 480
h = 320
max_trials = 1
RP = 4
ITI = 2

# Set images
GO_images = glob('images/obj1*')
NOGO_images = glob('images/obj2*')

# Initialize image matrices
GO_resp = np.ones(np.size(GO_images))
NOGO_resp = np.zeros(np.size(NOGO_images))
ALL_images = GO_images + NOGO_images
ALL_resp = np.concatenate([GO_resp, NOGO_resp])

# Load images
stim = stimulus(ALL_images, w, h)
Example #12
0
import time


def timer(func, *args):
    start = time.perf_counter()
    for i in range(1000):
        func(*args)
    return time.perf_counter() - start


timer(pow, 2, 1000)
timer(str.upper, 'spam')
timer.total(1000, pow, 2, 1000)[0]
timer.bestof(1000, str.upper, 'spam')
timer.bestoftotal(50, 1000, str.upper, 'spam')

## timing script
import sys, timer
reps = 10000
replist = list(range(reps))


def forLoop():
    res = []
    for x in replist:
        res.append(abs(x))
    return res


def listComp():
    return [abs(x) for x in replist]
    repslist=list(range(reps))  #Hoist out equalize 2x,3x
    start=timer()               #Or perf__counter/other in 3.3+
    for i in repslist:
        ret=func(pargs.**kargs)
    elapsed=timer()-start
    return(elapsed,ret)
def best of(reps,func,*pargs,*pargs,**kargs):
    """"""
    Quickest func()among reps runs.
    Return(best time,last results)
    """"""
    best=2**32                    #136 years seems large enough
    for i in range(reps)          #range usage not times here
    start=timed()
    ret=func(*pargs,**kargs)
    elapsed=timer()-start         #Or call total()with reps=1
    if elapsed < best:best=elapsed
return(best,ret)                  #Or add to list and take min()
def best of total(reps1,reps2,func,*pargs,**kargs):
    """"""
    Best of totals:
    (best of reps1 runs of(total of reps2 run of func))
    """"""
    return best of(reps1,total,reps,func,*pargs,**kargs)
    
 import timer                                    #Pg.632
 timer.total(1000,pow,2,1000)[0]
 #  0.0029542985410557776
 timer.total(1000,str.upper,'spam')
 #  (0.000050484531709686, 'SPAM')
 timer.bestof(1000,str.upper,'spam')
Example #14
0
	def AddTimer(self, tm, repeat, week, mess = ""):
		self._timers.append(timer(tm, repeat, week, mess))
		log.info("Timer", "Timer has beed added")
		return("Timer added.")
Example #15
0
import pickle
from timer import *
from monopoly import *


def main():
    all_totals = []
    total = 17000
    for i in range(total):
        game = pickle.load(
            open('results/stalemates/long/game' + str(i) + '.pickle', "rb"))

        rent_totals = [0, 0]
        players = [game.active_players[0], game.active_players[1]]

        for player_id in [0, 1]:
            for property in players[player_id].inventory:
                rent_totals[player_id] += game.calculate_rent(
                    property=property, owner=players[player_id])

        diff = rent_totals[1] - rent_totals[0]

        rent_totals.append(diff)
        print(rent_totals)
        all_totals.append(rent_totals)


if __name__ == '__main__':
    timer()
    main()
    timer()
Example #16
0
                                 no_rent_in_jail=True,
                                 trip_to_start=True,
                                 snake_eyes_bonus=True)

                results = game0.play()
                length_list.append(results['length'])

                # Write to file.
                output_file002.writerow([results['started'], results['winner'], results['length']])

        all_length_lists.append(length_list)
        print("Done with", rule)

    with open('results/house_rules/all_data.csv', 'w', newline='') as csvfile001:
        output_file001 = csv.writer(csvfile001, quotechar=',')

        output_file001.writerow(house_rules)

        for i in range(games_in_a_set):
            row = []
            for length_list in all_length_lists:
                row.append(length_list[i])
            output_file001.writerow(row)

    print('done')


if __name__ == '__main__':
    timer()
    main()
    timer()
Example #17
0
def main():
    arguments = sys.argv  #pull in arguments
    counter = 0
    numExpected = False
    tempExpected = False

    for item in arguments:
        if (numExpected):
            data = item.split('/')
            times.append(float(data[1]))
            myDe.debugPrint(times)
            mtrNum = int(data[0])
            motors.append(motor(motorPins[mtrNum - 1], myDe, mtrNum))
            print(times)
            print(mtrNum)
            numExpected = False
        if (tempExpected):
            data = item.split('/')
            temperatureHold = float(data[1])
            times.append(0)
            myDe.debugPrint(times)
            mtrNum = int(data[0])
            motors.append(
                motor(motorPins[mtrNum - 1], myDe, mtrNum, True,
                      temperatureHold))
            print(times)
            print(mtrNum)
            tempExpected = False

    #print(item)
        if (item == "-D" or item == "-d"):
            myDe.activate()
            myDe.debugPrint(item, "input " + str(counter))
            counter = counter + 1
        if (item.startswith("-t")):
            myDe.debugPrint("found timer input in minutes")
            numExpected = True
        if (item.startswith("-a")):
            myDe.debugPrint("temp Input")
            tempExpected = True
    count = 0
    for tm in times:
        if (tm == 0):
            count += 1
            continue
        newTimer = timer(tm, myDe, motors[count])
        timers.append(newTimer)
        count += 1
    #myDe.debugPrint("Debugger Activated")
    for i in range(0, len(timers)):
        t = threading.Thread(target=beginTimer, args=(i, ))
        t.daemon = True
        t.start()
    activeTimers = True
    time.sleep(3)
    while (activeTimers):
        activeTimers = False
        message = "Current Temp = " + str(read_temp())
        myDe.debugPrint(message)
        for tmr in timers:
            print(tmr.isRunning())
            if (tmr.isRunning()):
                activeTimers = True
        time.sleep(1)
    afterBrewHopping = True

    while (afterBrewHopping):
        afterBrewHopping = False
        for mtr in motors:
            message = "Current Temp = " + str(read_temp())
            myDe.debugPrint(message)
            if (mtr.testTemp() != False):
                tempToFind = mtr.testTemp()
                curTemp = read_temp()
                if (tempToFind >= curTemp):
                    message = "curtemp: " + str(
                        read_temp()) + " <g activate temp: " + str(
                            mtr.testTemp())
                    myDe.debugPrint(message)
                    mtr.activate()
                    mtr.deactivate()
                else:
                    afterBrewHopping = True
                    message = "curtemp: " + str(
                        read_temp()) + " > activate temp: " + str(
                            mtr.testTemp())
                    myDe.debugPrint(message)
                time.sleep(1)