Skip to content

Instantly share code, notes, and snippets.

View krekel's full-sized avatar
👾
Reverse engineering

Luis Diaz krekel

👾
Reverse engineering
  • Puerto Rico
View GitHub Profile
sequence = ['\u0003', ' ', '&', '$', '-', '\u001e', '\u0002', ' ', '/', '/', '.', '/']
for c in sequence:
print(chr(ord(c) ^ 0x41), end='')
@krekel
krekel / lab4.py
Created January 16, 2019 19:25
Solution script for lab 4-02 (RPISEC Malware Course)
def decrypt(u_input):
false_flag = '{ga1F_1auTca_eht_t0n_s!_s1hT}galf'
flag = []
for i, x in enumerate(u_input):
flag.append(x ^ ord(false_flag[i]))
for x in flag:
print( chr(((x & 0x0F) << 4) ^ ((x & 0xF0) >> 4)), end='' )
encrypted_key = [0x88, 0x9A, 0x93, 0x9C, 0x90, 0x92, 0x9A, 0x0A0, 0x8B, 0x90, 0x0A0,0x9C, 0x8C, 0x9E, 0x88, 0x0DE]
for c in encrypted_key:
print(chr(c ^ 0x0FF), end='')
register_values = {}
arithmetics = {'dec': '-', 'inc': '+'}
highest_value = 0
with open('input', 'r') as f:
for line in f:
words = line.split(' ')
register = words[0]
amount = words[2]
condition = words[5:]
eval_register = words[4]
@krekel
krekel / aoc_day6.py
Created December 6, 2017 20:37
Advent of Code day 6 solution
input_ = [0, 5, 10, 0, 11, 14, 13, 4, 11, 8, 8, 7, 1, 4, 12, 11]
def redistributions(banks):
seen = []
cycles = 0
while banks not in seen:
seen.append(list(banks))
max_block = max(banks) # The bank to spread out.
@krekel
krekel / aoc_day5.py
Created December 5, 2017 23:03
Advent of Code Day 5 solution
input_ = []
with open('input', 'r') as f:
for x in f:
input_.append(int(x))
# PART 1
idx = 0
steps = 0
while 0 <= idx < len(input_):
curr = input_[idx]
@krekel
krekel / aoc_day4.py
Created December 4, 2017 18:02
Advent of code day 4 solution
import itertools
def is_anagram(words):
count = 0
w1, w2 = words
for char in w1:
if char in w2:
count += 1
@krekel
krekel / aoc_day2.py
Created December 3, 2017 02:06
Advent of code - day 2
import itertools
input_ = []
with open('input', 'r') as f:
for row in f:
input_.append(row.replace('\t', ' ').replace('\n', '').split(' '))
values = [[int(val) for val in row] for row in input_]
# Part 1
@krekel
krekel / aoc_day1.py
Last active December 4, 2017 18:00
Advent of Code challenge Day one
part1 = 0
part2 = 0
steps = len(input_)/2
for i, num in enumerate(input_):
if num == input_[int((i + 1) % len(input_))]:
part1 += int(num)
if num == input_[int((i+steps) % len(input_))]:
part2 += int(num)