Skip to content

Instantly share code, notes, and snippets.

View shreyansh26's full-sized avatar
👨‍🎓
Always Learning

Shreyansh Singh shreyansh26

👨‍🎓
Always Learning
View GitHub Profile
#!/usr/bin/env python
import sys
def score(text):
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.'\n"
p = 0
for s in text:
if s in charset or s == ' ' or s == '\'':
p+=1
#!/usr/bin/python3
# credit : http://jhafranco.com/2012/01/29/rsa-implementation-in-python/
def int2Text(number, size):
text = "".join([chr((number >> j) & 0xff)
for j in reversed(range(0, size << 3, 8))])
return text.lstrip("\x00")
# credit : http://stackoverflow.com/questions/4798654/modular-multiplicative-inverse-function-in-python
def egcd(a, b):
if a == 0:
open("output2.txt", "wb").write(open("output.txt", "rb").read()[::-1])
#!/usr/bin/python3
img = bytearray(open('matrix_modified.bmp', 'rb').read())
key = "matrix"
new_f = []
for i, x in enumerate(img):
new_f.append(hex(ord(key[i%6]) ^ x))
@shreyansh26
shreyansh26 / pre_legend.py
Last active November 19, 2019 17:32
RITSEC CTF 2019 Writeups
cipher = '9EEADi^^8:E9F3]4@>^4=2J32==^D@>6E9:?8\FD67F=\C:ED64'
text = ''
for i in range(1,51):
for char in cipher:
text += chr(ord(char)+i)
print(i, text)
text = ''
#include <stdio.h>
#include <stdlib.h>
int main() {
int start = 1573776000; // 15th Nov 2019, 00:00 UTC
int end = 1573948800; // // 17th Nov 2019, 00:00 UTC
for(int i=start; i<end; i++) {
srand(i);
int a = rand();

Keybase proof

I hereby claim:

  • I am shreyansh26 on github.
  • I am shreyansh26 (https://keybase.io/shreyansh26) on keybase.
  • I have a public key ASAoslMXqpms4-sn1xknNjBcBKZKk3Erypeh7HONCGuE0go

To claim this, I am signing this object:

#!/usr/bin/python3
img = bytearray(open('matrix_modified.bmp', 'rb').read())
key = "matrix"
new_f = []
for i, x in enumerate(img):
new_f.append(hex(ord(key[i%6]) ^ x))
from PIL import Image
image_enc = open('encoded_img', 'r').readlines()
print(image_enc)
pixels = []
for row in image_enc:
row = row.strip()
row = row.split('+')
if(strlen(input) != 23) {
print_wrong;
return 0;
}
if((input[4] ^ 0x6c) != 0) {
print_wrong;
return 0;
}
if(input[3] + 1 != input[6]) {