Skip to content

Instantly share code, notes, and snippets.

Нужны разработчики JS, Golang
Желательно чтобы вы понимали https://konvajs.org/
тк у нас игра в которой будет обработка кучи ивентов в секунду с браузера мы будем юзать чистый JS без Vue итд
Прогеры голанг желательно чтобы понимали многопоточность и сеть.
Смысл:
Канвас на котором любой человек из интернета сможет рисовать, типо the front canvas of the internet :)
@mmkhitaryan
mmkhitaryan / blockin_tcp.py
Last active February 3, 2020 12:14
Echo servers
import socket, threading
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serversocket.bind(('0.0.0.0', 8082))
serversocket.listen(5)
def connection_handler(socket):
while True:
data = socket.recv(1024)
@mmkhitaryan
mmkhitaryan / USAGE
Last active October 27, 2020 06:30
fish function to dockerify current directory ~/.config/fish/config.fish. Its not only useful, but also you can use it not to garbage host OS with all the different language versions and dependencies. Also you get better security because a malware dependency won't harm HOST OS.
dockerify python
or
dockerify node
@mmkhitaryan
mmkhitaryan / partition.py
Created December 12, 2020 13:23
Алгоритм для равномерного распределения массивов
import hashlib
import random
import collections
def random_string(N):
import string
return ''.join(random.choices(string.ascii_uppercase + string.digits, k=N))
def md5(string):
hash = hashlib.md5(string.encode('utf-8'))
@mmkhitaryan
mmkhitaryan / docker-compose.yml
Last active December 13, 2020 15:37
Bot honeypot
version: "3.9"
services:
mitmproxy:
image: mitmproxy/mitmproxy
command: "mitmweb --web-host 0.0.0.0 --mode reverse:http://web:5000/ --set block_global=false"
ports:
- "80:8080"
- "8080:8080"
- "9000:8080"
- "8000:8080"

File upload leads to Stored XSS

Вдохновение было взято с https://hackerone.com/reports/880099. Из-за того что вы не фильтруете svg картинки то можно загрузить ее на сервер, и получить stored xss. http://51.75.168.24/image.php?id=4742

Чтобы исправить это:

Проблема в том что сервер выставляет заголовок Content-Type в зависимости от загруженного файла. Если настроить nginx на раздачу хедеров только с image/png например то браузер будет выдавать MIME type mismatch on image file.

SSRF -> JWT secret key

config.php требует запроса с localhost. Можно было бы просто подменить host на localhost:

@mmkhitaryan
mmkhitaryan / deadlock.py
Created July 4, 2021 19:35
An example of python deadlock
from threading import Lock, Thread
accountone = Lock()
accounttwo = Lock()
def transfer(accountone, accounttwo):
accountone.acquire()
accounttwo.acquire()
print("Transaction done")
accountone.release()

My router has been crashing when my PC boots, and starts working good after 5 minutes of restart. So I decided to dig into reasons of the crash.

I used tcpdump and made it start on system boot. It collected all the packets, and then used tcpdump replay to try to reproduce the crashes.

When I replayed all the packets, the router crashed as suspected. But I needed to understand what specific packets were the reason of the crashing.

So I started cutting the file in half, (basically binary search) and seeing if the crash happens on. I ended up with ~20 packets, and then choose those packets that are on the scapy script.

I wanted to continue the research of the reasons of the vulnerability, emulate the router firmware and try to crash it. But I did not find router's working firmware anywhere.

@mmkhitaryan
mmkhitaryan / hello.c
Created August 30, 2022 10:13
In original article you need to specify the function address manually. I made it detect the function address automatically.
#include <stdio.h>
#include <unistd.h>
void
f (int n)
{
printf ("Number: %d\n", n);
}
int
# python stack_seeker.py some_file_in_cwd
import r2pipe
import sys
r = r2pipe.open('/bin/ls')
r.cmd('ood')
r.cmd('aaa')
file_name = sys.argv[1]