Skip to content

Instantly share code, notes, and snippets.

View adrian17's full-sized avatar

Adrian Wielgosik adrian17

View GitHub Profile
@adrian17
adrian17 / brainfuck.cpp
Last active October 24, 2022 17:37
Brainfuck compiler with LLVM
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/TargetSelect.h"
@adrian17
adrian17 / writeup.md
Last active July 2, 2021 14:51
Różdżka Chaosu ctfd.rozdzka.securing.pl writeup

https://ctfd.rozdzka.securing.pl/ https://vallheru.rozdzka.securing.pl/

Jak na CTFa, to wydawał się dość prosty - szczególnie dla mnie, laika bez doświadczenia. Wszystkie zadania były "jednowarstwowo" trudne, do wielu trudniejszych można znaleźć write-upy podobnych zadań w internecie. Strona jest forkiem open-sourcowego silnika a autorzy CTFa udostępnili większość źródeł .php, więc można było wręcz po prostu diffować oryginalne pliki z plikami CTFa żeby zobaczyć gdzie dodali luki.

Web

Witamy w Dębinie (10): Login w HTMLu strony głównej, hasło automatycznie wypełnione.

printf 'à____]\0k“ôç¹ñ6$s8,gã®]•TÍNäsÐÐs«Ò܍@:ñ=/¸Â-¶ ‡ß9¿Í~ë¬PJdÆv³—Q›¹­E¶çøäkƒ5bÉoŠ€ÁÚN®È@ëPuÞ¨Ä3׶*<§†N]¥:µV»jUÑÁYÑ.qGÄ
uá–vPå.úU!Ð\äŒÞ, ìÓè¬_'|xz -dqqFraw
#include <iostream>
#include <string>
#include <regex>
int main() {
std::regex pattern(R"((\d+) #(.+)# (\d+) ([\d.]+))");
std::string line = "83 #Electric Sander# 7 57.00";
// imagine that's inside the while() loop
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <chrono>
#include <unordered_set>
using namespace std::chrono;
@adrian17
adrian17 / ub14.txt
Last active November 10, 2016 08:54
import timeit
import time
import subprocess
lines = [
"a = ''",
"a = ' '",
"a = ' '",
"a = 'a'",
"a = 'a b a b '*100",
@adrian17
adrian17 / main.py
Created August 24, 2016 22:28
Python implementation of anagram solver
from collections import defaultdict
import string
words = open("enable1.txt").read().splitlines()
print(max(len(x) for x in words))
def add(a, b):
return tuple(x+y for x, y in zip(a, b))
def over(a, b):
@adrian17
adrian17 / main.cpp
Last active August 24, 2016 22:20
slightly simpler and slower anagram generator implementation
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <array>
#include <fstream>
#include <xmmintrin.h>
#include <experimental/string_view>
using namespace std;
using namespace std::experimental;
@adrian17
adrian17 / main.cpp
Created July 25, 2016 21:26
concepts diagn
template<typename T> using id=T;
template<typename T>
concept bool A = requires(T a) { a==a; };
template<typename T, typename U>
concept bool B =
A<T> && // (1) basic usage
A<T> && // (2) duplicate concept check
A<U> && // (3) different concept check that happens to work on the same type here
@adrian17
adrian17 / kanji_easy.json
Last active June 2, 2023 18:43
kanji data for NHK News Web Easy
{
"desc": "kanji frequency for NHK News Web Easy, 1855 articles from 2014-12-02 to 2016-07-15",
"source": "https://gist.github.com/adrian17/836b97ee5740b20e63edbe35251d6bc1",
"label": "easy news",
"total": 158118,
"list": [
[
"人",
5093
],