diff --git a/apk_mixer/apk/1.apk b/apk_mixer/apk/1.apk new file mode 100644 index 0000000..d3790c5 Binary files /dev/null and b/apk_mixer/apk/1.apk differ diff --git a/apk_mixer/apk/2.apk b/apk_mixer/apk/2.apk new file mode 100644 index 0000000..035ddb1 Binary files /dev/null and b/apk_mixer/apk/2.apk differ diff --git a/apk_mixer/apk_mixer.py b/apk_mixer/apk_mixer.py new file mode 100644 index 0000000..67155b6 --- /dev/null +++ b/apk_mixer/apk_mixer.py @@ -0,0 +1,87 @@ +# encoding: utf-8 +# https://habr.com/ru/post/422885/ +import re +import codecs +import os +from os import listdir +import shutil +import subprocess +import datetime + +pwd = os.getenv("PWD", os.getcwd()) +apkFolder1=pwd+"/tmp/1" +apkFolder2=pwd+"/tmp/2" +logfile = open(pwd + "apk_mixer.log", 'wb') + +try: + print("Decompiling " + pwd + "/apk/1.apk ...") + result = subprocess.run("java -jar " + pwd + "/tools/apktool.jar d " + pwd + "/apk/1.apk -f -o " + pwd + "/tmp/1", \ + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + if (result.returncode == 0): + print("OK\n") + else: + print("Error") + logfile.write(result.stdout) + print("View log for details\n") + raise Exception("Error happenned while mixing apks") + + print("Decompiling " + pwd + "/apk/2.apk ...") + result = subprocess.run("java -jar " + pwd + "/tools/apktool.jar d " + pwd + "/apk/2.apk -f -o " + pwd + "/tmp/2", \ + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + if (result.returncode == 0): + print("OK\n") + else: + print("Error") + logfile.write(result.stdout) + print("View log for details\n") + raise Exception("Error happenned while mixing apks") + + print("Creating new manifest ...") + mainfest1 = open(apkFolder1 + "/AndroidManifest.xml", "r").read() + service1 = mainfest1[(mainfest1.find("") + len("")):mainfest1.find("")] + permission1 = mainfest1[mainfest1.find(""):mainfest2.find("") + len("")] + new_mainfest = open(apkFolder2+"/AndroidManifest.xml", "w") + new_mainfest.write(new_mainfest2) + new_mainfest.close() + print("OK\n") + + print("Copying Smali and Unknown files ...") + subprocess.call("cp -r " + apkFolder1 + "/smali " + apkFolder2, shell=True) + subprocess.call("cp -r " + apkFolder1 + "/unknown " + apkFolder2, shell=True) + ##if (result.returncode == 0): + ## print("OK\n") + ##else: + ## print("Error") + ## logfile.write(result.stdout) + ## print("View log for details\n") + ## raise Exception("Error happenned while mixing apks") + + print("Compiling APK to " + pwd + "/tmp/3.apk ...") + result = subprocess.run("java -jar " + pwd + "/tools/apktool.jar b " + pwd + "/tmp/2 -o " + pwd + "/tmp/3.apk", \ + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + if (result.returncode == 0): + print("OK\n") + else: + print("Error") + logfile.write(result.stdout) + print("View log for details\n") + raise Exception("Error happenned while mixing apks") + + print("Signing file " + pwd + "/tmp/3.apk ...") + subprocess.call("java -jar " + pwd + "/tools/testsign.jar " + pwd + "/tmp/3.apk --override", \ + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + if (result.returncode == 0): + print("OK\n") + else: + print("Error") + logfile.write(result.stdout) + print("View log for details\n") + raise Exception("Error happenned while mixing apks") +finally: + logfile.close() + input("") + quit() diff --git a/apk_mixer/tools/apktool.jar b/apk_mixer/tools/apktool.jar new file mode 100644 index 0000000..2eca808 Binary files /dev/null and b/apk_mixer/tools/apktool.jar differ diff --git a/apk_mixer/tools/testsign.jar b/apk_mixer/tools/testsign.jar new file mode 100644 index 0000000..3cbd302 Binary files /dev/null and b/apk_mixer/tools/testsign.jar differ diff --git a/base64passwds.py b/base64passwds.py new file mode 100644 index 0000000..29ae867 --- /dev/null +++ b/base64passwds.py @@ -0,0 +1,11 @@ +import base64 + +passwdfile = open('passwords.txt', mode='wt', encoding='utf-8') + +for i in range(23): + login = input("Enter email: ") + password = input("Enter password: ") + passwd_base64 = base64.b64encode(password.encode('UTF-8')).decode('UTF-8') + passwdfile.write(login + ':' + passwd_base64 + '\n') + +passwdfile.close() diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..3b55a71 --- /dev/null +++ b/calculator.py @@ -0,0 +1,30 @@ +import time + +print('***КАЛЬКУЛЯТОР***') +print() + +firstn = float(input("Введите первое число: ")) +secondn = float(input("Введите второе число: ")) +mathact = input('Выберите математическое действие(+,-,*,/): ') +equals = float(0) + +if (mathact == "+"): + equals = firstn + secondn + print(firstn, '+', secondn, '=', equals) +elif (mathact == "-"): + equals = firstn - secondn + print(firstn, '-', secondn, '=', equals) +elif (mathact == "*"): + equals = firstn * secondn + print(firstn, '*', secondn, '=', equals) +elif (mathact == "/"): + if (secondn != float(0)): + equals = firstn / secondn + print(firstn, '/', secondn, '=', equals) + else: + print("Делить на 0 нельзя!") +else: + print("Неверный математический знак!") + +print('Завершено.') +input("Нажмите любую клавишу для закрытия программы...") diff --git a/fasticoconverter.py b/fasticoconverter.py new file mode 100644 index 0000000..33f6179 --- /dev/null +++ b/fasticoconverter.py @@ -0,0 +1,31 @@ +import os +import time +import string +import random +import requests +from sys import argv + +file = argv[1] +print(file) +print(os.path.exists(file)) + +try: + convreq1 = requests.post("https://api2.online-convert.com/jobs", headers=\ + {'X-Oc-Api-Key': 'f3e92e642b8c41cc0ee73937d7459f81', 'Content-Type': 'application/json'}, \ + data='{"conversion": [{"category": "image", "target": "ico"}]}') + print(convreq1.content) + convreq2 = requests.post("https://www13.online-convert.com/dl/web2/upload-file/"+convreq1.json()["id"], headers=\ + {'X-Oc-Api-Key': 'f3e92e642b8c41cc0ee73937d7459f81', 'X-Oc-Upload-Uuid': \ + ''.join(random.SystemRandom().choices(string.ascii_lowercase + string.digits, k=8))}, \ + files={"file" : (file[file.rfind("\\")+1:], open(file, 'rb'), "image/png")}) + print(convreq2.content) + time.sleep(2) + convreq3 = requests.get("https://api2.online-convert.com/jobs/"+convreq1.json()["id"], headers=\ + {'X-Oc-Api-Key': 'f3e92e642b8c41cc0ee73937d7459f81'}) + resultfile = open(argv[1][:argv[1].rfind("\\")]+argv[1][argv[1].rfind("\\"):argv[1].rfind(".")]+".ico", 'wb') + resultfile.write(convreq3.content) + resultfile.close() +except Exception as ex: + print(ex) + +input("") diff --git a/habr_parser.py b/habr_parser.py new file mode 100644 index 0000000..5e12317 --- /dev/null +++ b/habr_parser.py @@ -0,0 +1,29 @@ +import requests +from lxml import html +from lxml import etree + +useragent_headers={ + "User-agent":'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' + } + +site_tree = html.fromstring(requests.get("https://habr.com/", headers=useragent_headers).text) + +habr_news = site_tree.xpath('//div[@class="new-block"]//ul[@class="content-list"]/li[@class="content-list__item content-list__item_news-topic"]' + + '//a[@class="news-topic__title"]') + +for habr_new in habr_news: + + try: + article_text = etree.tostring( + html.fromstring(requests.get(habr_new.xpath('./@href')[0], headers=useragent_headers).text).xpath( + '//div[@class="post__text post__text-html post__text_v1" and @id="post-content-body"]')[0]).decode("utf-8") + except Exception: + continue + + print() + print("----- beginning of article") + print(habr_new.text_content()) + print("----- beginning of text") + print(article_text) + print("----- end of text") + print("----- end of article") diff --git a/lpucoznet_parser.py b/lpucoznet_parser.py new file mode 100644 index 0000000..b57de32 --- /dev/null +++ b/lpucoznet_parser.py @@ -0,0 +1,15 @@ +# Parsing linkin-park.ucoz.net and downloading music +# This site is not mine + +import requests +from lxml import html +from lxml import etree + +site_tree = html.fromstring(requests.get("https://linkin-park.ucoz.net/load/lp_underground/underground_8_0_2008/19").text) +links_for_dl = site_tree.xpath('//a[@style="color:#333; text-decoration:none;" and @class="entryLink"]') +for dllink in links_for_dl: + correct_dllink = "https://linkin-park.ucoz.net" + (dllink.xpath(".//@href")[0]) + dlpage_tree = html.fromstring(requests.get(correct_dllink).text) + music_file = open("C:\\Users\\Acer\\Music\\Linkin Park\\Downloaded\\" + correct_dllink.split("/")[6] + ".mp3", 'wb') + music_file.write(requests.get("https://linkin-park.ucoz.net" + (dlpage_tree.xpath('//td[@class="commSbmFl"]/a/@href')[0])).content) + music_file.close() diff --git a/minecraft_buildingwaterfall.py b/minecraft_buildingwaterfall.py new file mode 100644 index 0000000..8238ff0 --- /dev/null +++ b/minecraft_buildingwaterfall.py @@ -0,0 +1,28 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() +import time + +i = 0 +j = 0 +k = 0 +pos = mc.player.getTilePos() + +waterfallHeightStr = input("Введите высоту водопада: ") +if (waterfallHeightStr != ""): + waterfallHeight = int(waterfallHeightStr) +else: + waterfallHeight = 15 + +print("Постройка водопада...") + +#Waterfall (ice) +while i < waterfallHeight: + for j in range(11): + mc.setBlock(pos.x + 1, pos.y + i, pos.z + j, 79) + i = i+1 + +#Water on waterfall +for k in range(11): + mc.setBlock(pos.x + 1, pos.y + waterfallHeight, pos.z + k, 8) + +print("Завершено!") diff --git a/minecraft_diamondtower.py b/minecraft_diamondtower.py new file mode 100644 index 0000000..edfebac --- /dev/null +++ b/minecraft_diamondtower.py @@ -0,0 +1,22 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() +import time + +pos = mc.player.getTilePos() +xplayer = pos.x +yplayer = pos.y +zplayer = pos.z + +blocksQuanStr = input("Сколько блоков поставить? ") + +if (blocksQuanStr != ""): + blocksQuan = int(blocksQuanStr) +else: + blocksQuan = 50 + +i = 0 +while i < blocksQuan: + mc.setBlock(xplayer+1, yplayer+i, zplayer+1, 57) + i = i+1 + +print("Sucessful!", blocksQuan) diff --git a/minecraft_findblock.py b/minecraft_findblock.py new file mode 100644 index 0000000..199c0e4 --- /dev/null +++ b/minecraft_findblock.py @@ -0,0 +1,76 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create(); +import time +import math +import random + +t = 0 + +curPlayerPos = mc.player.getTilePos() +randX = random.randint(curPlayerPos.x-100, curPlayerPos.x+100) +randZ = random.randint(curPlayerPos.z-100, curPlayerPos.z+100) +randY = mc.getHeight(randX, randZ) + +mc.postToChat("") + +print(randX, randY, randZ) +mc.setBlock(randX, randY, randZ, 57) +mc.postToChat("Алмазный блок спрятан.") + +curPlayerPos = mc.player.getTilePos() +mc.setBlock(curPlayerPos.x + 1, curPlayerPos.y, curPlayerPos.z + 1, 42) +mc.postToChat("Чтобы остановить игру, сломай железный блок,") +mc.postToChat("установленный рядом с тобой.") +mc.postToChat("Приятной игры!") + +mc.postToChat("") + +win = False + +while (not win): + + pauseBlock = mc.getBlock(curPlayerPos.x + 1, curPlayerPos.y, curPlayerPos.z + 1) + if (int(pauseBlock) == 0): + print("Игра была остановлена пользователем.") + mc.postToChat("Игра была остановлена.") + + #Удаление блока + time.sleep(2) + mc.setBlock(randX, randY, randZ, 0) + mc.setBlock(curPlayerPos.x + 1, curPlayerPos.y, curPlayerPos.z + 1, 0) + + break + + pos = mc.player.getPos() + dist = math.sqrt((pos.x - randX) ** 2 + (pos.z - randZ) ** 2) + if dist < 3: + + if (pos.y > randY): + mc.postToChat("Спустись вниз!") + time.sleep(2) + + if (pos.y < randY): + mc.postToChat("Поднимись наверх!") + time.sleep(2) + + mc.postToChat("Молодец, ты выиграл! Блок найден за " + str(t) + " секунд.") + mc.postToChat("Через 7 секунд блок исчезнет.") + + #Удаление блока + time.sleep(7) + mc.setBlock(randX, randY, randZ, 0) + mc.setBlock(curPlayerPos.x + 1, curPlayerPos.y, curPlayerPos.z + 1, 0) + + win = True + + if dist > 100: mc.postToChat("Очень холодно - заморозишься!") + elif dist > 50: mc.postToChat("Холодно...") + elif dist > 25: mc.postToChat("Тепло") + elif dist > 12: mc.postToChat("Горячо...") + elif dist > 6: mc.postToChat("Кипяток - обожжёшься!") + #else: print("Чё-то пошоло не так...") + t = t+1 + time.sleep(1) + +print("Завершено.") +input("Нажмите любую клавишу для закрытия программы...") diff --git a/minecraft_workingwithblocks.py b/minecraft_workingwithblocks.py new file mode 100644 index 0000000..cf57c92 --- /dev/null +++ b/minecraft_workingwithblocks.py @@ -0,0 +1,14 @@ +from mcpi.minecraft import Minecraft +mc = Minecraft.create() +import time + +plpos = mc.player.getTilePos() + +#Таким образом (последний аргумент в след.команде) можно указать т.н. значение данных. +#Например, можно уточнить цвет окрашенного стекла. + +#setBlock (x, y, z, stained_glass ID, Data Value) +mc.setBlock(plpos.x - 1, plpos.y, plpos.z, 95, 11) +mc.postToChat("Перед Вами блок.") + +print("Готово.") diff --git a/music_rnd_pauser.py b/music_rnd_pauser.py new file mode 100644 index 0000000..ff08931 --- /dev/null +++ b/music_rnd_pauser.py @@ -0,0 +1,49 @@ +## Imports +import sys +import time +import random +import vlc +import speech_recognition as sr + +## Options +resume_type = 0 # 0=keyboard, 1=voice +my_lang = 'ru-RU' # recognizer language +word_for_resume = 'старт' # word for recognizer to resume music + +## Functions +def wait_for_word(word): + phrase = '' + recog = sr.Recognizer() + mic = sr.Microphone() + while True: + with mic as audio_file: + recog.adjust_for_ambient_noise(audio_file) + audio = recog.listen(audio_file) + try: + phrase = recog.recognize_google(audio, language=my_lang) + print("Recognizer:", phrase) + if (phrase.lower().find(word.lower()) > -1): + break + except Exception: + print("Error") + +## Main code +try: + print() + player = vlc.MediaPlayer(sys.argv[1]) + while True: + player.play() + time.sleep(random.randint(3, 8)+2) + player.pause() + if resume_type == 1: + wait_for_word(word_for_resume) + else: + input("Press ENTER to resume... ") + print("OK") + +except KeyboardInterrupt: + player.stop() + print("\n") + print("Stopped by keyboard.") + print("") + quit() diff --git a/speechrecog.py b/speechrecog.py new file mode 100644 index 0000000..a299541 --- /dev/null +++ b/speechrecog.py @@ -0,0 +1,10 @@ +import speech_recognition as sr +recog = sr.Recognizer() +with sr.Microphone() as source: + print("Говорите...") + audio = recog.listen(source) + print("Распознавание...") + try: + print("Вы сказали:", recog.recognize_google(audio, language='ru-RU')) + except Exception as ex: + print("Произошла ошибка:", str(ex)) diff --git a/virustotal_scanning.py b/virustotal_scanning.py new file mode 100644 index 0000000..f9a6b00 --- /dev/null +++ b/virustotal_scanning.py @@ -0,0 +1,23 @@ +# encoding: utf-8 +import os +from sys import argv +import time +import json +import requests + +file = argv[1] +print(file) + +fileready = False +scanreq = requests.post("https://www.virustotal.com/vtapi/v2/file/scan", \ + params={"apikey": "147eac96e8a588d37164c584cdbc9f28d2138558ce7965ffc357dcf29215d963"}, \ + files={"file": (file[file.rfind("\\"):], open(file, 'rb'))}) +json_scanreq = json.loads(scanreq.content) +reportreq = None +while not fileready: + time.sleep(1) + reportreq = requests.get("https://www.virustotal.com/vtapi/v2/file/report", \ + params={"apikey": "147eac96e8a588d37164c584cdbc9f28d2138558ce7965ffc357dcf29215d963",\ + "resource": json_scanreq["md5"]}) + fileready = (json.loads(reportreq.content)["response_code"] == 1) +print(json.loads(reportreq.content))