Skip to content

Instantly share code, notes, and snippets.

View 0awawa0's full-sized avatar
👾
Focusing

Alexander 0awawa0

👾
Focusing
View GitHub Profile
import pwn
import json
import curses
address = ("socket.cryptohack.org", 13421)
connection = pwn.connect(address[0], address[1])
connection.recvline()
def createEncryptCommand() -> str:
return "{\"option\":\"encrypt\"}"
var intent = XiaomiUtilities.getPermissionManagerIntent(applicationContext)
if (intent != null) {
try {
startActivity(intent)
} catch (e: Exception) {
try {
intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + applicationContext.packageName)
startActivity(intent)
} catch (e: Exception) {
val isMIUI = XiaomiUtilities.isMIUI()
val isShowWhenLocked= XiaomiUtilities.isCustomPermissionGranted(context, XiaomiUtilities.OP_SHOW_WHEN_LOCKED)
val isExactAlarm = XiaomiUtilities.isCustomPermissionGranted(context, XiaomiUtilities.OP_EXACT_ALARM)
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import java.lang.reflect.Method;
// MIUI. Redefining Android.
import json
from ptCrypt.Math.base import xor
message = b"\x00" * 16
payload1 = json.dumps({"action": "tag", "message": message.hex()})
print(payload1)
tag = input("tag >> ")
iv = bytes.fromhex(json.loads(tag)["iv"])
ct = bytes.fromhex(json.loads(tag)["ct"])
import json
# Step 1: Generate tag t
payload1 = json.dumps({"action": "tag", "message": (b"\x00" * 16).hex()})
print(payload1)
# Step 2: Use tag t to generate new message
tag = input("tag >> ")
payload2 = json.dumps({"action": "verify", "message": (b"\x00" * 16).hex() + tag, "tag": tag})
print(payload2)
#!/usr/bin/python3
import socket
import json
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
# Read the flag from a file
FLAG = ""
with open('flag.txt') as f:
#!/usr/bin/python3
import socket
import json
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
# Read the flag from a file
FLAG = ""
with open('flag.txt') as f:
@0awawa0
0awawa0 / bash.py
Created April 28, 2021 06:08
ImagineCTF Round 9 Salty Task
#!/usr/bin/env python3
import os
import hashlib
def main():
while True:
command = input("bash-4.2$ ")
checkInput(command)
os.system(command)
def xorBytes(b1, b2):
 res = b""
 for i in range(max(len(b1), len(b2))):
 res += bytes([b1[i % len(b1)] ^ b2[i % len(b2)]])
 return res
crib = b"actf{"
ctext = bytes.fromhex("ae27eb3a148c3cf031079921ea3315cd27eb7d02882bf724169921eb3a469920e07d0b883bf63c018869a5090e8868e331078a68ec2e468c2bf13b1d9a20ea0208882de12e398c2df60211852deb021f823dda35079b2dda25099f35ab7d218227e17d0a982bee7d098368f13503cd27f135039f68e62f1f9d3cea7c")
for i in range(len(ctext) - 5):
 offset = ctext[i: i + 5]
 key = xorBytes(offset, crib)