def update(self, delta): self.time -= delta if self.time > 0: return riged = self.gameObject.riged if riged: center = self.gameObject.shape.Center() world = self.gameObject.world radius = self.gameObject.shape.Radius() bdir = riged.velocity.normalize() if bdir.magnitude() == 0: bdir = self.catche self.catche = bdir (left, mid, right) = pygame.mouse.get_pressed() if left: self.gs.play() spos = center.add(bdir.scale(radius)) bdir = bdir.scale(500) Attacks.createBullet(self.gameObject,world, spos.x, spos.y-24, bdir.x, bdir.y, 5,damage=10, time = 2, ignores={'GameObject':[self.gameObject]},file_name='Resources/sprites/bullet.txt') self.time = .25 if right: self.ss.play() spos = center Attacks.createExplosion(self.gameObject, world, spos.x, spos.y, 40, damage = 10, time = .25, ignores={'GameObject':[self.gameObject]}, file_name='Resources/sprites/explosion1.txt') self.time = .5 pass if mid: pass
def doAttackRange(self,arg): world = self.gameObject.world pos = self.gameObject.shape.Center() if arg.has_key('target'): target = arg['target'] bdir = target.sub( pos).scale(.25) pos = pos.add(bdir) Attacks.createExplosion(self.gameObject, world, pos.x, pos.y, 40, damage = self.rangeDamage, time= .25, ignores={'type':[self.gameObject.type]}, nockback = 0, file_name='Resources/sprites/explosion1.txt')
def doAttackShot(self,arg): bdir = Vector2.Vector2(0,0) cpos = self.gameObject.shape.Center() cpos.y -=24 if arg.has_key('target'): target = arg['target'] bdir = target.sub( cpos ).normalize() elif self.gameObject.riged: bdir = self.gameObject.riged.velocity spos = cpos.add(bdir.scale(self.gameObject.shape.Radius()*4)) bdir = bdir.scale(500) Attacks.createBullet(self.gameObject,self.gameObject.world, spos.x, spos.y, bdir.x, bdir.y, 5, damage = self.shotDamage, time = 2, ignores = {'type':[self.gameObject.type]},nockback=0, file_name='Resources/sprites/bullet.txt' )
def update(self, delta): self.time -= delta if self.time > 0: return riged = self.gameObject.riged if riged: bdir = riged.velocity.normalize() if bdir.magnitude() == 0: bdir = self.catche self.catche = bdir keys = pygame.key.get_pressed() if keys[pygame.K_j]: spos = self.gameObject.shape.Center().add(bdir.scale(self.gameObject.shape.Radius())) bdir = bdir.scale(500) Attacks.createBullet(self.gameObject, self.gameObject.world, spos.x, spos.y, bdir.x, bdir.y, 5, damage = 10, time=2, ignores={'GameObject':[self.gameObject]}, file_name='Resources/sprites/bullet.txt', nockback=10) #createBullet(self.gameObject,self.gameObject.world, spos.x, spos.y, bdir.x, bdir.y, 5) self.time = .1
def Hellhound(Monster): u = Monster uHP = WSD[Monster].HP uENE = WSD[Monster].ENE uSTR = WSD[Monster].STR uSPR = WSD[Monster].SPR uSKL = WSD[Monster].SKL uABL = WSD[Monster].ABL uAGI = WSD[Monster].AGI uEVA = WSD[Monster].EVA uTGH = WSD[Monster].TGH uRES = WSD[Monster].RES uLCK = WSD[Monster].LCK uPAR = WSD[Monster].PAR uMAR = WSD[Monster].MAR uWT = WSD[Monster].ArmorWT choice = input( "Select an action type!\n [St]atcheck!\n [At]tacks!\n [Sk]ills!") if choice == "ST" or choice == "St" or choice == "st": print("-----------------") print("HP:", uHP) print("ENE:", uENE) print("STR:", uSTR) print("SPR:", uSPR) print("SKL:", uSKL) print("ABL:", uABL) print("AGI:", uAGI) print("EVA:", uEVA) print("TGH:", uTGH) print("RES:", uRES) print("LCK:", uLCK) print("PAR:", uPAR) print("MAR:", uMAR) print("WT:", uWT) print("-----------------") if choice == "AT" or choice == "At" or choice == "at": choice = input("Select an attack!\n [CL] Claws!\n [Te]eth!\n ") if choice == "CL" or choice == "cl" or choice == "Claws" or choice == "claws": Attacks.Claw("Hellhound", "NormalBronzeClaw3", "Flame") elif choice == "Te" or choice == "TE" or choice == "te": AttacksOO.Weaponless("Hellhound", Flame, 1, 0, 0).SavageBite elif choice == "SK" or choice == "Sk" or choice == "sk": choice = input( "Select a Skill! \n [FB] Fire Breath!\n [SB] Savage Bite!\n [BS] Bodyslam!\n " ) if choice == "FB" or choice == "fb": Skills.BreathAttack("Hellhound", "Flame") elif choice == "SB" or choice == "sb": Skills.SavageBite("Hellhound") elif choice == "BS" or choice == "bs": Skills.Bodyslam("Hellhound")
def Snowgunner(Snowman): choice = input( "Select an Action!\n [ST] Statcheck!\n [PB] Pistol Blaster!\n [CL] Claw Attacks!\n [BA] Breath Attack!\n " ) u = Snowman uSTR = u + "STR" uSPR = u + "SPR" uSKL = u + "SKL" uABL = u + "ABL" uAGI = u + "AGI" uEVA = u + "EVA" uTGH = u + "TGH" uRES = u + "RES" uLCK = u + "LCK" uPAR = u + "PAR" uMAR = u + "MAR" if choice == "ST" or choice == "st": print("These are the stats for", u, "as they currently stand!") print("\n-----------------") print("Strength:", (WSD[uSTR])) print("Spirit:", (WSD[uSPR])) print("Skill:", (WSD[uSKL])) print("Ability:", (WSD[uABL])) print("Agility:", (WSD[uAGI])) print("Evasion:", (WSD[uEVA])) print("Toughness:", (WSD[uTGH])) print("Resistance:", (WSD[uRES])) print("Luck:", (WSD[uLCK])) print("Physical Resist: ", (WSD[uPAR])) print("Magical Resist: ", (WSD[uMAR])) print("-----------------\n") elif choice == "PB" or choice == "pb": Attacks.PistolPacker("Snowgunner", "CottonWoodPistol3", "Aqua") elif choice == "CL" or choice == "cl": Attacks.Claw("Snowgunner", "CottonWoodClaw3", "Aqua") elif choice == "BA" or choice == "ba": Skills.BreathAttack("Snowgunner", "Aqua")
def __init__(self,attBonusRange=range(5),defTargetRange=range(4,13),vantage=None): self.repetitions=10000 self.attBonusRange=attBonusRange self.defTargetRange=defTargetRange self.vantage = vantage self.tests = {} for attBonus in attBonusRange: self.tests[attBonus]={} for defTarget in defTargetRange: attempts = [Attacks.Attempt(target=defTarget,maxBonus=attBonus,vantage=vantage) for x in range(self.repetitions)] successes = [attempt.outcome for attempt in attempts].count('success') failures = [attempt.outcome for attempt in attempts].count('failure') percent = successes/self.repetitions self.tests[attBonus][defTarget] = {'attempts':attempts,'successes':successes,'failures':failures,'percent':percent}
def __init__(self, attBonusRange=range(5), defTargetRange=range(4,13), vantage=None): rl(Attacks) self.repetitions = 100 self.attBonusRange = attBonusRange self.defTargetRange = defTargetRange self.vantage = vantage self.tests = {} count = 0 for attBonus in attBonusRange: self.tests[attBonus] = {} for defTarget in defTargetRange: attempts = [Attacks.Attack(targetDefence=defTarget,attackBonus=attBonus,vantage=vantage) for x in range(self.repetitions)] successes = [attempt.hitResult for attempt in attempts].count(True) failures = [attempt.hitResult for attempt in attempts].count(False) percent = successes/self.repetitions self.tests[attBonus][defTarget] = {'attempts':attempts,'successes':successes,'failures':failures,'percent':percent} count = count + 1 sys.stdout.write("Test progress: %d \r" % (count)) sys.stdout.flush()
def Norwolf(Norwolf): choice = input( "Select an Action!\n [ST] Statcheck!\n [FC] Frost Claws!\n [BA] Breath Attack!\n [SB] Savage Bite!\n " ) u = Norwolf uSTR = u + "STR" uSPR = u + "SPR" uSKL = u + "SKL" uABL = u + "ABL" uAGI = u + "AGI" uEVA = u + "EVA" uTGH = u + "TGH" uRES = u + "RES" uLCK = u + "LCK" uPAR = u + "PAR" uMAR = u + "MAR" if choice == "ST" or choice == "st": print("These are the stats for", u, "as they currently stand!") print("\n-----------------") print("Strength:", (WSD[uSTR])) print("Spirit:", (WSD[uSPR])) print("Skill:", (WSD[uSKL])) print("Ability:", (WSD[uABL])) print("Agility:", (WSD[uAGI])) print("Evasion:", (WSD[uEVA])) print("Toughness:", (WSD[uTGH])) print("Resistance:", (WSD[uRES])) print("Luck:", (WSD[uLCK])) print("Physical Resist: ", (WSD[uPAR])) print("Magical Resist: ", (WSD[uMAR])) print("-----------------\n") elif choice == "FC" or choice == "fc": Attacks.Claw("Norwolf", "BoneLeatherClaw2", "Aqua") elif choice == "BA" or choice == "ba": Skills.BreathAttack("Norwolf", "Aqua") elif choice == "SB" or choice == "sb": Skills.SavageBite("Norwolf")
def Jinglejel(Jel): choice = input( "Select an Action!\n [ST] Statcheck!\n [BS] Bodyslam!\n [WG] Water Grenade!\n [SC] Snowball Cannon!\n " ) u = Jel uSTR = u + "STR" uSPR = u + "SPR" uSKL = u + "SKL" uABL = u + "ABL" uAGI = u + "AGI" uEVA = u + "EVA" uTGH = u + "TGH" uRES = u + "RES" uLCK = u + "LCK" uPAR = u + "PAR" uMAR = u + "MAR" if choice == "ST" or choice == "st": print("These are the stats for", u, "as they currently stand!") print("\n-----------------") print("Strength:", (WSD[uSTR])) print("Spirit:", (WSD[uSPR])) print("Skill:", (WSD[uSKL])) print("Ability:", (WSD[uABL])) print("Agility:", (WSD[uAGI])) print("Evasion:", (WSD[uEVA])) print("Toughness:", (WSD[uTGH])) print("Resistance:", (WSD[uRES])) print("Luck:", (WSD[uLCK])) print("Physical Resist: ", (WSD[uPAR])) print("Magical Resist: ", (WSD[uMAR])) print("-----------------\n") if choice == "BS" or choice == "bs" or choice == "Bodyslam" or choice == "bodyslam": Attacks.Bodyslam("Jinglejel") elif choice == "WG" or choice == "wg": Skills.WaterGrenade("Jinglejel", "NormalIvoryWand3") elif choice == "SC" or choice == "sc": Skills.WaterGrenade("Jinglejel", "NormalIvoryRod10")
def Faerider(Fae): choice = input( "Select an Action!\n [ST] Statcheck!\n [FB] Faewood Bow!\n [FW] Faewood Wand!\n [FC] Faewood Cane!\n " ) u = Fae uSTR = u + "STR" uSPR = u + "SPR" uSKL = u + "SKL" uABL = u + "ABL" uAGI = u + "AGI" uEVA = u + "EVA" uTGH = u + "TGH" uRES = u + "RES" uLCK = u + "LCK" uPAR = u + "PAR" uMAR = u + "MAR" if choice == "ST" or choice == "st": print("These are the stats for", u, "as they currently stand!") print("\n-----------------") print("Strength:", (WSD[uSTR])) print("Spirit:", (WSD[uSPR])) print("Skill:", (WSD[uSKL])) print("Ability:", (WSD[uABL])) print("Agility:", (WSD[uAGI])) print("Evasion:", (WSD[uEVA])) print("Toughness:", (WSD[uTGH])) print("Resistance:", (WSD[uRES])) print("Luck:", (WSD[uLCK])) print("Physical Resist: ", (WSD[uPAR])) print("Magical Resist: ", (WSD[uMAR])) print("PAR:", (WSD[uPAR])) print("MAR:", (WSD[uMAR])) print("-----------------\n") elif choice == "FB" or choice == "fb" or choice == "Bow" or choice == "bow": choice = input( "Select a Bow Action!\n ==ATTACKS==\n [W]eak!\n [N]ormal!\n [S]trong!\n ==SKILLS==\n [L]ongshot!\n [C]lipshot!\n " ) if choice == "W" or choice == "w": Attacks.BowShotQ("Faerider", "CobaltBow2") elif choice == "N" or choice == "n": Attacks.BowShotN("Faerider", "CobaltBow2") elif choice == "S" or choice == "s": Attacks.BowShotH("Faerider", "CobaltBow2") elif choice == "C" or choice == "c": Skills.Clipshot("Faerider", "CobaltBow2") elif choice == "L" or choice == "l": Skills.Longshot("Faerider", "CobaltBow2") elif choice == "FW" or choice == "fw" or choice == "Wand" or choice == "wand": choice = input( "Select a Wand Action!\n ==ATTACKS==\n [W]eak Ray!\n [N]ormal Ray!\n [S]trong Ray!\n ==SKILLS==\n [W]ater Grenade!\n [F]lame Blast!\n " ) if choice == "W" or choice == "w": Attacks.WandRayQ("Faerider", "NormalIvoryWand7") elif choice == "N" or choice == "n": Attacks.WandRayN("Faerider", "NormalIvoryWand7") elif choice == "S" or choice == "s": Attacks.WandRayH("Faerider", "NormalIvoryWand7") elif choice == "Flame" or choice == "flame" or choice == "fire" or choice == "Fire": Skills.FlameBlast("Faerider", "NormalIvoryWand7") elif choice == "Water" or choice == "water": Skills.WaterGrenade("Faerider", "NormalIvoryWand7") elif choice == "FC" or choice == "fc": choice = input( "Select a Cane action!\n [Q]uick Attack!\n [N]ormal Attack!\n [H]ard Attack!\n " ) if choice == "Q" or choice == "q": Attacks.CaneWhackQ("Faerider", "TungstenCane2") elif choice == "N" or choice == "n": Attacks.CaneWhackN("Faerider", "TungstenCane2") elif choice == "H" or choice == "h": Attacks.CaneWhackH("Faerider", "TungstenCane2")
# adv = Attacks.new_mi_fgsm(model, img, labels[i], eps=20, T=25) # #adv = Attacks.fgsm(model, img, labels[i], eps=20) # pred = model.predict(adv) # print(letters[pred.argmax()], pred.max() * 100) # plt.imsave("./images/m_{}.png".format(i), # adv.reshape(128, 128), # cmap="gray") with tf.compat.v1.Session() as sess: #data = images / 255.0 #data = img.reshape((-1, 128, 128, 1)) data = images #data, model = MNIST(), MNISTModel("models/mnist", sess) attack = Attacks.CarliniL0(sess, model, max_iterations=100, initial_const=10, largest_const=15) inputs, targets = generate_data(data, samples=1, targeted=True, start=0, inception=False) timestart = time.time() adv = attack.attack(inputs, targets) timeend = time.time() print("Took", timeend - timestart, "seconds to run", len(inputs), "samples.")
cur_map.render(win, grid_color=None) ball.power(dt, paddle.position, paddle.stamina, mClick) if attk_exists == False: attk_timer -= 1 * dt attk_type = 0 if attk_timer <= 0: a = random.randint(1, 5) b = random.randint(1, 5) if health <= (health / 2): attk_type = random.randint(1, 10) else: attk_type = a + b left_attk = Attacks.Attacks(attk_type, paddle.position[1], paddle.actual_stamina.get_width(), 600, 800, paddle.position[0], collide_list, paddle.position[1]) collide_list.append(left_attk) attk_exists = True if attk_exists == True: if attk_type == 5 or attk_type == 6 or attk_type == 7 or attk_type == 4 or attk_type: attk_timer = 1 elif attk_type == 3 or attk_type == 8: attk_timer = 1.5 elif attk_type == 2 or attk_type == 9: attk_timer = 2 left_attk.update(dt, win)
import numpy as np import h5py from random import randint import Attacks import matplotlib.pyplot as plt from string import ascii_uppercase images = [] labels = [] model = tf.keras.models.load_model("Chars74K_model.h5") letters = list(ascii_uppercase) with h5py.File("Chars74K_data.hdf5", "r") as f: ds_length = len(f["x_test"]) indicies = [randint(0, ds_length) for i in range(5)] for index in indicies: images.append(f["x_test"][index]) labels.append(f["y_test"][index]) labels = tf.keras.utils.to_categorical(labels, 26) for i, image in enumerate(images): img = image / 255.0 img = img.reshape((-1, 128, 128, 1)) adv = Attacks.new_mi_fgsm(model, img, labels[i], eps=20, T=25) pred = model.predict(adv) print(letters[pred.argmax()], pred.max() * 100) plt.imsave("./images/n_{}.png".format(i), adv.reshape(128, 128), cmap="gray")
#!/usr/bin/python import Attacks att = Attacks.getAttack(Attacks.Attacks.QuickAttack) print att
Analisis.SockUDPScan(sys.argv[sys.argv.index("-sUS") + 1]) sys.exit(1) if "-fS" in sys.argv: if len(sys.argv) == 3: Analisis.finScan(sys.argv[sys.argv.index("-fS") + 1], 10) sys.exit(1) else: Analisis.finScan(sys.argv[sys.argv.index("-fS") + 1], int(sys.argv[sys.argv.index("-fS") + 2])) if "-hsS" in sys.argv: Analisis.halfSynScan(sys.argv[sys.argv.index("-hsS") + 1]) if "-aMM" in sys.argv: Attacks.ARPSpoof(sys.argv[sys.argv.index("-aMM") + 1], sys.argv[sys.argv.index("-aMM") + 2]) if "-aD" in sys.argv: Attacks.ARPDos(sys.argv[sys.argv.index("-aD") + 1], sys.argv[sys.argv.index("-aD") + 2]) sys.exit(1) if "-h" in sys.argv: print """ ==COMPUTER SEARCHING== -pS: Make a ping scan. It need an example ip like "192.168.1.0" -pA: Make an ARP scan. It need an example ip like "192.168.1.0" ==PORT SCAN== -sTS Make a socket port scan. It need an IP like "192.168.1.126" -sUS Make a socket port scan for UDP. It need an IP like "192.168.1.126"