Add files via upload
This commit is contained in:
parent
b88b19b479
commit
4e70127ecf
17 changed files with 425 additions and 0 deletions
BIN
apk_mixer/apk/1.apk
Normal file
BIN
apk_mixer/apk/1.apk
Normal file
Binary file not shown.
BIN
apk_mixer/apk/2.apk
Normal file
BIN
apk_mixer/apk/2.apk
Normal file
Binary file not shown.
87
apk_mixer/apk_mixer.py
Normal file
87
apk_mixer/apk_mixer.py
Normal file
|
@ -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("</activity>") + len("</activity>")):mainfest1.find("</application>")]
|
||||
permission1 = mainfest1[mainfest1.find("<uses-permission"):mainfest1.find("<application ")]
|
||||
mainfest2 = open(apkFolder2 + "/AndroidManifest.xml", "r").read()
|
||||
|
||||
new_mainfest2 = mainfest2[0:mainfest2.find("<application")] + permission1 + mainfest2[mainfest2.find("<application"):mainfest2.find("</application")] + \
|
||||
service1 + mainfest2[mainfest2.find("</application>"):mainfest2.find("</manifest>") + len("</manifest>")]
|
||||
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()
|
BIN
apk_mixer/tools/apktool.jar
Normal file
BIN
apk_mixer/tools/apktool.jar
Normal file
Binary file not shown.
BIN
apk_mixer/tools/testsign.jar
Normal file
BIN
apk_mixer/tools/testsign.jar
Normal file
Binary file not shown.
11
base64passwds.py
Normal file
11
base64passwds.py
Normal file
|
@ -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()
|
30
calculator.py
Normal file
30
calculator.py
Normal file
|
@ -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("Нажмите любую клавишу для закрытия программы...")
|
31
fasticoconverter.py
Normal file
31
fasticoconverter.py
Normal file
|
@ -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("")
|
29
habr_parser.py
Normal file
29
habr_parser.py
Normal file
|
@ -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")
|
15
lpucoznet_parser.py
Normal file
15
lpucoznet_parser.py
Normal file
|
@ -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()
|
28
minecraft_buildingwaterfall.py
Normal file
28
minecraft_buildingwaterfall.py
Normal file
|
@ -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("Завершено!")
|
22
minecraft_diamondtower.py
Normal file
22
minecraft_diamondtower.py
Normal file
|
@ -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)
|
76
minecraft_findblock.py
Normal file
76
minecraft_findblock.py
Normal file
|
@ -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("Нажмите любую клавишу для закрытия программы...")
|
14
minecraft_workingwithblocks.py
Normal file
14
minecraft_workingwithblocks.py
Normal file
|
@ -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("Готово.")
|
49
music_rnd_pauser.py
Normal file
49
music_rnd_pauser.py
Normal file
|
@ -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()
|
10
speechrecog.py
Normal file
10
speechrecog.py
Normal file
|
@ -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))
|
23
virustotal_scanning.py
Normal file
23
virustotal_scanning.py
Normal file
|
@ -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))
|
Loading…
Reference in a new issue