Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View theKidOfArcrania's full-sized avatar

Henry Wang theKidOfArcrania

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
typedef struct file {
char buff[0x1000];
int bitind;
BITS 64
%define REL_LOC 0x1CB0
%define REL_HUFF 0x18a0
%define REL_NSG 0x14a0
%macro xcall 1
db 0xe8
dd %1 - (REL_LOC + $ - $$ + 4)
%endmacro
_start:
; greet user
mov edx, msg1end - msg1 ; arg2: message length
mov ecx, msg1 ; arg1: message
mov ebx, 1 ; arg0: stdout
mov eax, SYS_WRITE
int 0x80
; read in the input, expect "XXXXXXXX-XXXXXXXX"
mov edi, inbuf
TERMINAL_INPUT = 0
TERMINAL_OUTPUT = 1
DOOR_CONTROL = 2
main:
.correct_pin = 0
.main_loop:
call ask_and_verify_code
test al, al
TERMINAL_INPUT = 0
TERMINAL_OUTPUT = 1
DOOR_CONTROL = 2
main:
.correct_pin = 0
.main_loop:
call ask_and_verify_code
test al, al
; Welcome to CSAW! And, presumably, welcome to reverse engineering.
; This challenge is for N3WbS ONLY, so if you know what you're doing, then put one of your freshmen on this challenge..if you don't have any freshmen, then you need to recruit harder - for now just go steal one. Come back when you're ready with some fresh blood, or go work on some harder challenges!
; Rule # ONE :
; Since this problem is designed to introduce newbies to reverse engineering, I've designed this source document such that you can hopefully read it straight down and come to a reasonable understanding of this nonsense...
; Reverse engineering is the dissection and understanding of SYSTEMS, not of CODE.. As such, you won't need to read and understand every single line so long as you can understand what is general occurring and build a working intuition of what the system is doing.
; For example, if you see a call to `print("input: ")` then a call to `password = inputPassword()`, I would sincerely hope that you could deduce
%include "nasmx.inc"
ENTRY main
IMPORT fgets
IMPORT printf
IMPORT puts
IMPORT atoi
EXTERN stdin
%include "nasmx.inc"
ENTRY main
IMPORT fgets
IMPORT printf
IMPORT puts
IMPORT atoi
EXTERN stdin
@theKidOfArcrania
theKidOfArcrania / Makefile
Last active September 10, 2018 20:05
Makefile for any CS3345.HON (Data structures) project
JFLAGS=
JCFLAGS=
include config.mk
# Some private variables
MAINCLASS=$(join $(NAMEPREF), $(PROJ))
DATAFILE=$(join $(PROJ), data)
.PHONY: all test clean
; https://tinyurl.com/hello-in-asm
;
; Requires nasmx
; Linux:
; nasm -f elf64 hello.asm && gcc -o hello.o -o hello && ./hello
; Windows: (requires mingw)
; nasm -f win32 hello.asm && gcc -o hello.obj -o hello.exe && ./hello.exe
%include "nasmx.inc"