Skip to content

Instantly share code, notes, and snippets.

View sampritipanda's full-sized avatar

Sampriti Panda sampritipanda

View GitHub Profile
@sampritipanda
sampritipanda / pppvm.py
Created April 14, 2024 21:25
Plaid Parallel Processing VM
from pwn import *
CODE_SIZE = 0x4000
OP_NOP = 0x00
OP_PUSH = 0x01
OP_POP = 0x02
OP_DUP = 0x03
OP_SWAP = 0x04
@sampritipanda
sampritipanda / black_box.c
Last active January 25, 2022 04:27
Real World CTF 2022 - Black Box
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/in.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/string.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("sampriti");
MODULE_DESCRIPTION("qemu cve");
@sampritipanda
sampritipanda / solve.c
Created March 21, 2021 01:04
LINECTF pprofile
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#define CMD_ADD 32
#define CMD_FREE 64
#define CMD_READ 16
typedef struct {
@sampritipanda
sampritipanda / solve.c
Created November 29, 2020 14:34
HITCON CTF 2020 - Spark Exploit
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <pthread.h>
#include <errno.h>
@sampritipanda
sampritipanda / find_m_prime.sage
Last active August 20, 2020 04:22
babyROCA - Hackers Playground SSTF
M = 136798100663240822199584482903026244896116416344106704058806838213895795474149605111042853590
primes = [2]
for x in range(1201):
primes.append(next_prime(primes[-1]))
sice = []
for x in primes:
if M % x == 0:
sice.append(x)
# Jiahui Chen et al. cryptosystem, 80-bit security
# WARNING: very slow implementation.
import sys
q,n,a,s = (3,59,10,25)
m = n+1-a+s
FF = GF(q)
R = PolynomialRing(FF, ["x{}".format(i) for i in range(n)])
xs = R.gens()
def keygen():
#include <iostream>
#include <algorithm>
#include <vector>
#include <stdint.h>
using namespace std;
int tbl1[16] = {9, 240, 193, 169, 186, 195, 141, 128, 161, 69, 210, 242, 3, 200, 152, 183};
int tbl2[16] = {218, 218, 238, 202, 208, 137, 128, 90, 199, 249, 162, 67, 79, 90, 82, 253};
@sampritipanda
sampritipanda / solve.sage
Created June 16, 2019 14:58
Midnight Sun Finals 2019 - RZA2
from Crypto.Util.number import *
n = 118173998641659433141031218423093267548048945830460552160732748274571974743297930821423113390029083098858035838064885829588967199550126084897009304331836294104589302387252278933370240317467378376797843379485665856003112996215247651060003047081838833325054418881162956647931078011461049685774070539302432802113792476309961767049580409488915273417272971605423056480946448420246170538977427027687185230659802277819960185028241326766028592105200802992171
a = 47702774091583083413514954181005338733744246354146014100833529117112767
c = 12568593503732225284833930665556838287412199439692821417647372971869231723559992154443706678410038339647264823124946805716114186285024175170040286493705539280834058460961400557745983656762142889655126327977159776509025806614615683229732063597008220981903454189924787333897642661119487550976064177525965960903757425676552365701751129959682193371999227133565308776511273796468549993234547730548169945552741777405821627017605337784463424463117997971328
e = 6
# ansible.cfg
[defaults]
host_key_checking = False
# hosts
all:
hosts:
192.168.3.12:
@sampritipanda
sampritipanda / dog_or_frog.py
Last active July 20, 2019 10:57
PicoCTF 2018 - Dog or Frog
import numpy as np
from keras.applications.mobilenet import preprocess_input
from keras.models import load_model
from keras.preprocessing.image import img_to_array, array_to_img
from PIL import Image
from imagehash import phash
import foolbox
import keras