def UseableItemsOutput(inventory): try: useableitems = ["Tea Leaves", "Warming Pack", "Energy Bar", "Bandage"] useableowned = [] for i in inventory: if i in useableitems: useableowned.append(i) if len(useableowned) != 0: DisplayInventory(useableowned) print(colors.gray + ">>> Which one do you want to use? <<<" + colors.stopcolor) print(colors.gray + ">>> Please type in the " + colors.blue + "full item name" + colors.gray + " <<<" + colors.stopcolor) use = input(colors.gray + ">>>" + colors.stopcolor) use = use.title().strip() for i in useableowned: if use == i: inventory.remove(i) return [inventory, i] else: print("You do not own any useable items") return inventory except (TypeError, AttributeError): bash("clear") print(colors.orange + "⚠ This is not a valid input ⚠") return inventory
def _nmap_(): bash("clear") bash( "pkg install unstable-repo && pkg install nmap && apt-get install nmap" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def _fatrat_(): bash("clear") bash( "git clone https://github.com/Screetsec/TheFatRat.git && cd TheFatRat && chmod +x setup.sh && ./setup.sh" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def _macfinder_(): bash("clear") bash( "git clone https://github.com/RED-5-CRACKERS/Mac_finder.git && cd Mac_finder && chmod +x setup && ./setup" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def _aircrack_(): bash("clear") bash( "pkg install root-repo && pkg install aircrack-ng && apt-get install aircrack-ng" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def compile_pdf(cls, clean = ['tex']): if cls.filename: cleaning = 'rm {}.log {}.aux'.format(cls.filename, cls.filename) for cleaned_suffix in clean: cleaning += ' {}.{}'.format(cls.filename, cleaned_suffix) bash("cd {}; pdflatex --interaction=batchmode {}; {}".format(cls.path, cls.filename, cleaning) ) else: raise(FileNotFoundError('tex file not saved yet'))
def _recon_ng_(): bash("clear") bash( "git clone https://github.com/RED-5-CRACKERS/Recon-ng4Termux.git && cd Recon-ng4Termux && chmod +x setup.sh && ./setup.sh" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def _smsb_(): bash("clear") bash( "git clone https://github.com/AvinashReddy3108/YetAnotherSMSBomber.git" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def _metasploit_(): bash("clear") bash( "pkg install unstable-repo && pkg install metasploit && apt-install metasploit-framework" ) print( "\u001b[42;1m\u001b[37;1m Processend \u001b[0m" )
def rest(self, night, shelter, inventory, saturation, hydration, heat): bash("clear") print(colors.orange + "You have used 5 hours to rest" + colors.stopcolor) hydration -= 5 saturation -= 5 if (shelter) or ("Sleeping Bag" in inventory and night): pass elif night and not "Sleeping Bag" in inventory: heat -= 30 return saturation, hydration, heat
def MakeFire(inventory): #returns body heat value to be added as well as edited inventory and whether or not the fire lighted fire_lighted2 = FireLightingMethod(inventory) if fire_lighted2: bash("clear") print(colors.orange + "Fire Lighted!") print("Body Heat + 30!" + colors.stopcolor) return [30, inventory, True] else: bash("clear") print(colors.orange + "Fire Failed To Light") return [0, inventory, False]
def giti(): findopts('s4', '-git', '4') if s2 == '-t': eroot() check('git') if system('git clone https://github.com/tvsclass/' + s3) == 0: check('unzip') system('cd ' + s3 + ' && unzip -d ./.' + s3 + ' ./' + s3 + '.tvs') ans=input('Install ' + purple(s3) + ' with tvs_PKGengine? ' + green('[y]es ') + red('[n]o ')) if not ans == 'y': print('Aborted.') exit(3) if system('cd ' + s3 + '/.' + s3 + ' && find iscript.sh') == 0: print('reading iscript...') print('=========================================================') system('cat ./' + s3 + '/.' + s3 + '/iscript.sh') print() print('=========================================================') print() ans=input('Run ' + purple(s3) + ' iscript.sh? ' + green('[y]es ') + red('[n]o ')) if not ans == 'y': print('Aborted.') system('rm -r ' + s3 + ' -f') exit(3) if system('bash ./' + s3 + '/.' + s3 + '/iscript.sh') != 0: error('iscript failed') system('rm -r ' + s3 + ' -f') exit(2) bash('rm -r ./' + s3 + ' -f') else: error('git error') exit(2) elif s2 == '-m': print('running ' + 'git clone https://github.com/' + s4 + '/' + s3 + '...') if system('git clone https://github.com/' + s4 + '/' + s3) == 0: check('make') print('running \'make(s3)...\'') make(s3) else: error('wrong parameter')
def DrinkWater(inventory): #returns updated hydration value and edited inventory amtcount = [] amtcountunique = [] water = [] for i in range(len(inventory)): if inventory[i] not in amtcountunique: amtcount.append([inventory[i], 1]) amtcountunique.append(inventory[i]) else: for x in amtcount: if inventory[i] == x[0]: x[1] += 1 for i in amtcount: if i[0] in [ "Full Bottle of Clean Water", "Full Bottle of Dirty Water" ]: water.append(i) if water[0][0] == "Full Bottle of Dirty Water": water[0], water[1] = water[1], water[0] bash("clear") print(colors.gray + "You have: ") if len(water) != 0: for i in range(len(water)): print(colors.orange + str(i + 1) + ". " + str(water[i][1]) + " x " + str(water[i][0]) + colors.stopcolor) print(colors.gray + "Which water would you want to drink?" + colors.stopcolor) waters = Custom_Input() if waters == "1": if water[0][1] - 1 >= 0: inventory.remove("Full Bottle of Clean Water") inventory.append("Empty Bottle") return [50, inventory] elif waters[0] == "2": if water[1][1] - 1 >= 0: inventory.remove("Full Bottle of Dirty Water") inventory.append("Empty Bottle") if random.randint(1, 10) < random.randint(1, 10): return [30, inventory] else: bash("clear") print(colors.orange + "The water is contaminated. Hydration - 30!" + colors.stopcolor) return [-30, inventory] else: print("No Clean Water or You Typed It In Wrong") else: print("You have no water supplies")
def Fishing(inventory): #returns the fish that appeared bash("clear") fishes = [ "guppy", "guppy", "guppy", "swordfish", "guppy", "goldfish", "goldfish" ] if "Fishing Bait" in inventory: print( "Do you want to use your fishing bait? \nIt will give you better odds of getting a bigger fish" ) print(colors.gray + "Y / N" + colors.stopcolor) confirmation = Custom_Input() if confirmation == "y": bash("clear") fishes.append("platinum arowana") fishes.append("platinum arowana") fishes.append("bass") fishes.append("bass") inventory.remove("Fishing Bait") if confirmation == "n": bash("clear") else: bash("clear") print(colors.orange + "'Y' or 'N' plz" + colors.stopcolor) hygiene = SearchItem("Hygiene Kit", inventory) if hygiene != 0: for i in range(2): fishes.append("bass") fishes.append("swordfish") appear = random.choice(fishes) return appear
def UsedItem(hydration, heat, saturation, health, useitem): useableitems = ["Tea Leaves", "Warming Pack", "Energy Bar", "Bandage"] if useitem not in useableitems: raise ValueError print("item to use is not in the Useable Items List!") else: if useitem == useableitems[0]: hydration += 100 bash("clear") print(colors.orange + "Hydration + 100" + colors.stopcolor) elif useitem == useableitems[1]: heat += 100 bash("clear") print(colors.orange + "Heat + 100" + colors.stopcolor) elif useitem == useableitems[2]: saturation += 100 bash("clear") print(colors.orange + "Saturation + 100" + colors.stopcolor) elif useitem == useableitems[3]: health += 25 bash("clear") print(colors.orange + "Health + 25" + colors.stopcolor) return [hydration, heat, saturation, health]
def DisplayInventory(inventory): #returns inventory in a listed format amtcount = [] amtcountunique = [] for i in range(len(inventory)): if inventory[i] not in amtcountunique: amtcount.append([inventory[i], 1]) amtcountunique.append(inventory[i]) else: for x in amtcount: if inventory[i] == x[0]: x[1] += 1 bash("clear") print(colors.gray + "You have:") for i in amtcount: print(colors.orange + str(i[1]) + " x " + str(i[0]) + colors.stopcolor)
def InternetTest(server): try: commandOut_JSON = dict( loads( bash('speedtest-cli --server {0} --json --no-upload'.format( str(server))).read())) downloadSpeed_FLOAT = float(commandOut_JSON['download'] / 1000**2) except Exception: downloadSpeed_FLOAT = 0.0 return downloadSpeed_FLOAT
def walk(self, night, saturation, hydration, heat, found_village): bash("clear") #cost hydration -= 10 saturation -= 10 if not self.has("Clothing") and night: heat -= 20 maxwalking = 12 if self.has("Walking Stick"): maxwalking = 20 else: maxwalking = 10 if night and not self.has("Torch"): maxwalking = 5 walked = random.randint(1, maxwalking) shelter = False found_village = random.choice([True, False, False, False, False]) print(colors.orange + "You have used 2 hours to walk " + str(walked) + " km\n" + colors.stopcolor) return walked, saturation, hydration, heat, found_village, shelter
def CraftingList(): #list of craftable items bash("clear") print(colors.orange + ">>> Crafting List <<<" + colors.stopcolor) print(colors.orange + "1. Tinder: " + colors.gray + "1 x Wood > " + colors.orange + "3 x Tinder" + colors.stopcolor) print(colors.orange + "2. String: " + colors.gray + "1 x Plant Fibre > " + colors.orange + " x String" + colors.stopcolor) print(colors.orange + "3. String: " + colors.gray + "1 x Dead Grass > " + colors.orange + "1 x String" + colors.stopcolor) print(colors.orange + "4. String: " + colors.gray + "1 x Cloth > " + colors.orange + "2 x String" + colors.stopcolor) print( colors.orange + "5. Cloth: " + colors.gray + "1 x Clothing > " + colors.orange + "3 x Cloth ***Tearing Clothes will increase the rate of heat loss during night!" + colors.stopcolor) print(colors.orange + "6. Bow Drill: " + colors.gray + "1 x String, 2 x Wood > " + colors.orange + "1 x Bow Drill" + colors.stopcolor) print(colors.orange + "7. Bone Knife: " + colors.gray + "1 x Bone, 1 x String > " + colors.orange + "1 x Bone Knife" + colors.stopcolor) print(colors.orange + "8. Bandage: " + colors.gray + "1 x Cloth > " + colors.orange + "3 x Bandage" + colors.stopcolor) print(colors.orange + "9. Torch: " + colors.gray + "1 x Wood, 1 x String, 1 x Vaseline, 1 x Tree Bark > " + colors.orange + "1 x Torch" + colors.stopcolor) print(colors.orange + "10. Fishing Rod: " + colors.gray + "1 x Wood, 1 x String, 1 x Bone Knife > " + colors.orange + "1 x Fishing Rod" + colors.stopcolor) print(colors.orange + "11. Water Bottle: " + colors.gray + "1 x Rabbit Skin > " + colors.orange + "1 x Water Bottle" + colors.stopcolor + "\n") print( colors.blue + "Orange is what you are crafting, Gray is what you need to craft it. If you wish to exit press 0." + colors.stopcolor) print("\n" + colors.blue + "Please type a number." + colors.stopcolor + "\n") return Custom_Input()
def _spam_(): _option_ = 1 _spam_banner_(_option_) while True: key = getkey() bash("clear") if key == keys.UP: _option_ -= 1 if key == keys.DOWN: _option_ += 1 if _option_ < 1: _option_ = 3 if _option_ > 3: _option_ = 1 if key == keys.ENTER: if _option_ == 3: bash("clear") break else: _spam_option_(_option_) _spam_banner_(_option_)
def _social_(): _option_ = 1 _social_banner_(_option_) while True: key = getkey() bash("clear") if key == keys.UP: _option_ -= 1 if key == keys.DOWN: _option_ += 1 if _option_ < 1: _option_ = 4 if _option_ > 4: _option_ = 1 if key == keys.ENTER: if _option_ == 4: bash("clear") break else: _social_option_(_option_) _social_banner_(_option_)
def _database_(): _option_ = 1 _database_banner_(_option_) while True: key = getkey() bash("clear") if key == keys.UP: _option_ -= 1 if key == keys.DOWN: _option_ += 1 if _option_ < 1: _option_ = 2 if _option_ > 2: _option_ = 1 if key == keys.ENTER: if _option_ == 2: bash("clear") break else: _question_(_option_) _database_banner_(_option_)
def _menu_(): _option_ = 1 sleep(0.2) _menu_banner_(_option_) while True: key = getkey() bash("clear") if key == keys.UP: _option_ -= 1 if key == keys.DOWN: _option_ += 1 if _option_ < 1: _option_ = 8 if _option_ > 8: _option_ = 1 if key == keys.ENTER: if _option_ != 8: __option__(_option_) else: break _menu_banner_(_option_)
def FireLightingMethod(inventory): lightingitems = [ "Bow Drill", "Match", "Magnesium Fire Starter", "Batteries" ] ownedlighting = [] for i in inventory: if i in lightingitems: ownedlighting.append(i) bash("clear") print(colors.gray + "You have these lighting items:") DisplayInventory(ownedlighting) print(colors.gray + "Which one do you want to use to light? " + colors.orange + "Please use full name." + colors.stopcolor) tolight = Custom_Input() tolight = tolight.title() for i in ownedlighting: if tolight == i: removeitem = i inventory.remove(removeitem) fire_lighted = True break elif tolight != i: fire_lighted = False if not ownedlighting: fire_lighted = False print("No Available Items To Light Fire") """ for i in inventory: if i == "Tinder": if tolight == "match": inventory.remove(removeitem) inventory.remove("Tinder") else: inventory.remove("Tinder") """ return fire_lighted
def _question_(_code_): _option_ = 1 bash("clear") _question_banner_(_option_) while True: key = getkey() if key == keys.UP: _option_ -= 1 if key == keys.DOWN: _option_ += 1 if _option_ < 1: _option_ = 2 if _option_ > 2: _option_ = 1 if key == keys.ENTER: if _option_ == 2: bash("clear") break else: if _code_ == 1: _sqlmap_() if _code_ == 2: _metasploit_() if _code_ == 3: _fatrat_() if _code_ == 4: _nmap_() if _code_ == 5: _recon_ng_() if _code_ == 6: _macfinder_() if _code_ == 7: _john_() if _code_ == 8: _zipet_() if _code_ == 9: _cracknow_() if _code_ == 10: _aircrack_() if _code_ == 11: _wifite_() if _code_ == 12: _sfish_() if _code_ == 13: _spish_() if _code_ == 14: _heye_() if _code_ == 15: _scall_() if _code_ == 16: _smsb_() break bash("clear") _question_banner_(_option_)
def SearchFood(inventory): #returns updated inventory and energy value to be added to saturation food = [ "berries", "mushrooms", "bear flesh", "lion flesh", "cheetah flesh", "deer flesh", "cow flesh", "pig flesh", "fox flesh", "wolf flesh", "rabbit flesh", "toad flesh", "camel flesh", "scorpion flesh", "poisonous scorpion flesh", "hare flesh", "bass", "goldfish", "guppy", "swordfish", "platinum arowana" ] energy = [ 15, 15, 40, 70, 70, 40, 50, 40, 20, 20, 40, 20, 40, 20, 20, 30, 40, 20, 10, 50, 100 ] ownedfood = [] for i in inventory: if i in food: ownedfood.append(i) if len(ownedfood) == 0: print(colors.orange + "You do not have any food" + colors.stopcolor) else: DisplayInventory(ownedfood) print(colors.gray + "What do you want to eat? Please use " + colors.orange + "full name." + colors.stopcolor) consume = Custom_Input() if consume in ownedfood: bash("clear") owned = True else: bash("clear") owned = False if not owned: bash("clear") print("You do not have this food") else: inventory.remove(consume) if consume == "Rabbit Flesh": inventory.append("Rabbit Skin") for i in range(len(food)): if food[i] == consume: energy = energy[i] print(colors.orange + "Food + " + str(energy) + colors.stopcolor) return [inventory, energy]
def CraftItem(inventory, required_materials, crafted): #returns inventory with new or not new items. amtcount = [] amtcountunique = [] consumestr = "" for i in range(len(required_materials)): if required_materials[i] not in amtcountunique: amtcount.append([required_materials[i], 1]) amtcountunique.append(required_materials[i]) else: for x in amtcount: if required_materials[i] == x[0]: x[1] += 1 for i in amtcount: consumestr = consumestr + str(i[1]) + " x " + str(i[0]) + " " craftedstr = str(crafted[1]) + " x " + str(crafted[0]) print(colors.blue + "Crafting " + str(craftedstr) + " will consume " + str(consumestr) + colors.stopcolor) print(colors.gray + "Are you sure?" + colors.stopcolor) print(colors.gray + "Y / N" + colors.stopcolor) confirmation = Custom_Input() bash("clear") if confirmation == "y": try: for i in required_materials: inventory.remove(i) for i in range(int(crafted[1])): inventory.append(crafted[0]) return inventory except: bash("clear") print(colors.gray + "You are missing some indgredients" + colors.stopcolor) return inventory elif confirmation == "n": bash("clear") return inventory else: print(colors.orange + "'Y' or 'N' plz" + colors.stopcolor) return inventory
def check(what): if bash(what + ' --help >> /dev/null') == 0: return True else: error('can\'t find ' + what) exit(2)
For this wrapper to work: Occurrences group = taxon Output model = path/to/taxon Output file = path/to/taxon Output model = path/to/taxon.xml Output file = path/to/taxon.asc ''' from sys import argv from os import system as bash infile = argv[1] omrequest = argv[2] mytaxa = [] #linenum=0 with open(infile, 'r') as myfile: header = myfile.readline() for line in myfile: #linenum+=1 #if linenum > 1: mylist = line.split() if mylist[1] not in set(mytaxa): mytaxa.append(mylist[1]) for taxon in mytaxa: bash('sed \'s/taxon/' + taxon + '/g\' ' + omrequest + ' > omnew.txt') bash('om_console omnew.txt') bash('rm omnew.txt')
Install=input("\nPlease choose your installation mode: ") Scripts=[path.join(getcwd(),x) for x in listdir(getcwd()) if "getMetric" in x or "nicheBack" in x or "nicheIdent" in x] if int(Install)==1 or int(Install)==2: ### Where should the scripts be linked to? ExecPath=input("\nPlease type the path to which executables will be linked. If no entry default will be used (DEFAULT = /usr/bin): ") if len(ExecPath) == 0: ExecPath='/usr/bin' print('\nExecutable scripts will be linked to', ExecPath, 'to make them globally avalilable on your system') ### Install option no 1 if int(Install)==1: print("\nMaking scripts executable.") for file in Scripts: chmod(file, stat.S_IRWXU) NewFile=file.split('.')[0] bash('mv ' + file + ' ' + NewFile) bash('ln -s ' + file.split('.')[0] + ' ' + ExecPath) print("\nInstalling module nichefunc, which contains functions for executable NichePy scripts.") setupFunc() bash('rm ' + 'nichefunc.py') bash('rm ' + 'argparse.py') print("\nInstallation complete. Scripts can be called by issuing the following commands:") for i in listdir(getcwd()): if "getMetric" in i or "nicheBack" in i or "nicheIdent" in i: print("\n",i,"-h for brief guide of the script's usage") ### Install option no 2 else: print("\nMaking scripts executable.") for file in Scripts: chmod(file, stat.S_IRWXU) NewFile=file.split('.')[0]
For this wrapper to work: Occurrences group = taxon Output model = path/to/taxon Output file = path/to/taxon Output model = path/to/taxon.xml Output file = path/to/taxon.asc ''' from sys import argv from os import system as bash infile=argv[1] omrequest=argv[2] mytaxa=[] #linenum=0 with open(infile, 'r') as myfile: header=myfile.readline() for line in myfile: #linenum+=1 #if linenum > 1: mylist=line.split() if mylist[1] not in set(mytaxa): mytaxa.append(mylist[1]) for taxon in mytaxa: bash('sed \'s/taxon/' + taxon + '/g\' ' + omrequest + ' > omnew.txt') bash('om_console omnew.txt') bash('rm omnew.txt')
slab_used_percent_name = slabs_one[4].split()[1].split(':')[1] slab_used_percent_value = 100 * (float(slabs_one[4].split()[-1]) / float(slabs_one[3].split()[-1])) slab_used_percent_dict = { 'metric': '{0}.slabs.slab_{1}.{2}_percent'.format(metric, slab_name, slab_used_percent_name), 'endpoint': endpoint, 'timestamp': timestamp, 'step': step, 'value':'{:2f}'.format(slab_used_percent_value), 'counterType': 'GAUGE', 'tags': 'port=11211,metric=memcache' } data.append(slab_pages_dict) data.append(slab_used_percent_dict) return data def main(): mem_data = mget_stats() + mget_slabs() json.dump(mem_data, sys.stdout) if __name__ == "__main__": host = bash("ps aux | grep memcache|grep -v grep |awk -F'-l' '{print $2}' |awk '{print $1}'").read() port = bash("ps aux | grep memcache|grep -v grep |awk -F'-p' '{print $2}' |awk '{print $1}'").read() timestamp = int(time.time()) step = 60 endpoint = 'memcache-monitor' metric = 'memcache' main()
def make(way_to_directory_with_source): eroot() si3=way_to_directory_with_source if system('cd ' + si3 + ' >>/dev/null') != 0: error(si3 + ': directory not found') exit(10) check('make') ans=input('Configure ' + purple(si3) + ' with configure.sh? ' + green('[y]yes ') + red('[n]no ')) if ans != 'y': print(red('Aborted.')) exit(5) if system('cd ' + si3 + ' && find ./configure') != 0: if system('cd ' + si3 + ' && find ./autogen.sh >> /dev/null') != 0 or system('cd ' + si3 + ' && find ./bootstrap >> /dev/null') != 0: if system('cd ' + si3 + ' && chmod +x ./autogen.sh && ./autogen.sh') != 0: if not system('cd ' + si3 + ' && chmod +x ./bootstrap && ./bootstrap'): print('Configuring files not found.') print('creating...') if system('cd ' + si3 + ''' aclocal >> /dev/null autoheader >> /dev/null automake --gnu --add-missing --copy --foreign >> /dev/null autoconf -f -Wall >> /dev/null ''') != 0: error('configuring error') bash('rm -r ' + si3 + ' -f') exit(2) if bash('cd ' + si3 + ' && chmod +x ./configure && ./configure') != 0: error('configuring error') bash('rm -r ' + si3 + ' -f') exit(2) ans=input('Make and install ' + purple(si3) + ' ? ' + green('[y]yes ') + red('[n]no ')) if ans != 'y': print(red('Aborted.')) exit(5) if bash('cd' + si3 + ' && make -B && make install DESTDIR=/usr') != 0: error('making error') bash('rm -r ' + si3 + ' -f') exit(2) else: ok(purple(si3) + ' installed') bash('rm -r ' + si3 + ' -f') else: system('cd ' + si3 + ' && chmod +x ./configure && ./configure') ans=input('Make and install ' + purple(si3) + ' ? ' + green('[y]es ') + red('[n]o ')) if ans != 'y': print(red('Aborted.')) exit(5) if bash('cd ' + si3 + ' && make -B && make install DESTDIR=/usr') != 0: error('making error') bash('rm -r ' + si3 + ' -f') exit(2) else: ok(purple(si3) + ' installed') bash('rm -r ' + si3 + ' -f')
fA.seek(0) fA.write(newline + '\n') fA.close() FileCount = -1 for newline in OutfilesB: FileCount += 1 fB = open(OutfilesB[FileCount], 'r+') for line in fB: newline = line.rstrip('\t') fB.seek(0) fB.write(newline + '\n') fB.close() ### COMBINE outfiles FileCount = -1 Outfiles = OutfilesA for file in OutfilesB: Outfiles.append(file) CombinedGenotypes = open(CombinedOutfile, 'w') for infile in sorted(Outfiles): with open(infile) as Combine: for line in Combine: if line.count('.') < MissingColumnData * float(len(line.split('\t')[1:])): line = line.replace('.', '-9') CombinedGenotypes.write(line) else: continue bash('rm ' + infile) CombinedGenotypes.close()