Skip to content

Instantly share code, notes, and snippets.

View kezzyhko's full-sized avatar
💜
💜💜💜🤍🤍

Sergey Semushin kezzyhko

💜
💜💜💜🤍🤍
View GitHub Profile
@kezzyhko
kezzyhko / Contiki EA comparison logs
Last active July 11, 2020 12:13
Logs of simulations of different crypto algorithms integrated in Contiki | https://github.com/kezzyhko/Contiki_EA_comparison
Logs of simulations of different crypto algorithms integrated in Contiki
* Github repo with simulation code: https://github.com/kezzyhko/Contiki_EA_comparison
* Comparison table: https://docs.google.com/spreadsheets/d/1QjzWGqsHzynjnElhdrYRoawbSOMHYTp6z6I9W2rAc4Y
* `log_parser.py` is the python script used for parsing logs and getting the raw data
* Names of the log files are in form of `logs_ALG_BL_KL`, where `ALG` is the name of the algorithm, `BL` is a block length and `KL` is the key length
@kezzyhko
kezzyhko / file_client.py
Last active September 19, 2020 07:53
Python client and server to send and receive files
import socket
import sys
import os
# check arguments
def assert_(cond, message = None, print_help=True):
if (not cond):
if (message):
print()
@kezzyhko
kezzyhko / p_q_e_to_pem.py
Last active September 27, 2020 18:56
Prints .pem private RSA key given p, q and e
# This code is compilation of
# 1) code from
# https://0day.work/how-i-recovered-your-private-key-or-why-small-keys-are-bad/
# 2) modified version of code snippet from crypto stackexchange
# https://crypto.stackexchange.com/a/25499
# This code does not perform any checks on p, q and e and can give wrong result
# or throw not informative exception if p, q and/or e are not valid.
import pyasn1.codec.der.encoder
@kezzyhko
kezzyhko / rsa_common_modulus_attack.py
Last active September 17, 2020 08:39
The RSA common modulus attack
# Some parts of this code is taken from
# https://0day.work/how-i-recovered-your-private-key-or-why-small-keys-are-bad/
from Crypto.PublicKey import RSA
from base64 import b64decode
from binascii import unhexlify
# load keys (n, e1, e2)
@kezzyhko
kezzyhko / GitHub_to_php_deploy.php
Last active October 14, 2020 16:22
Script for automatic deployment of php web apps from github
<?php
// constants
define('WEBHOOK_SECRET', 'https://youtu.be/dQw4w9WgXcQ');
define('REPOSITORY_FULL_NAME', 'user/repo');
define('SSH_HOST', 'github_key1'); # see https://gist.github.com/kezzyhko/734b83a763c1feb6f38fdf096800718f
define('WEBROOT_SYMLINC', '/home/user/app');
@kezzyhko
kezzyhko / .ssh config
Last active October 9, 2020 22:45
An example of git ssh configuration for using different keys with the same host
# An example of git ssh configuration for using different keys with the same host
# You should put this file in ~/.ssh/config
# And change IdentityFile to the paths to your keys
# After that, you can use the keys like that:
# git clone ssh://github_key1/user/repo1.git
# git clone ssh://github_key2/user/repo2.git
Host github_key1
HostName github.com
User git
@kezzyhko
kezzyhko / Calculator: The Game bruteforce.php
Created November 5, 2020 17:27
A bruteforce solver for Calculator: The Game
<?php
echo '<pre>';
define('start_num', 100);
define('end_num', 101);
define('moves', 5);
define('functions', explode(' ', '0 x2 2=>10 0=>1 Reverse'));
function check($current_num, $moves_left=moves, $history='') {
if ($current_num == end_num) {
echo $history;
@kezzyhko
kezzyhko / Lowercase_base64_restore.php
Last active November 5, 2020 17:54
Restore base64 after it was accedentally lowercased (InnoCTF task)
<?php
//$s1 = 'sw5mb3jtyxrpb24gd2fudhmgdg8gymugsw5ub0nurntmcjmzxzfuzjbybtq3mtbufsbmcmvlica=';
//$s2 = 'u1c1bwizsnrzwfjwyji0z2qyrnvkse1nzec4z1ltvwdtvzv1yjbovvjudg1jak16whpgdvpqqnlivfeztvrcdwztqm1jbvzssunbpq==';
//$s1 == strtolower(base64_encode($secret))
//$s2 == strtolower(base64_encode(base64_encode($secret)))
//return $secret
function restore_base64($s1, $s2) {
@kezzyhko
kezzyhko / moodle_bruteforce_profiles.php
Created November 5, 2020 18:02
Bruteforce profile ids on your moodle to find them all
<?php
set_time_limit(0);
define('COOKIES', [
'MoodleSession' => 'lz7udac381k24ot9i6d7e7zdmf' //of course, you need to change this to you auth token
]);
define('URL', 'https://moodle.example.com/user/profile.php?id=%d'); //and change this to your moodle address
$context = stream_context_create(['http' => [
'method' => 'GET',
@kezzyhko
kezzyhko / interserver.php
Created November 5, 2020 18:09
A collection of scripts to solve server-conversation CTF tasks
<pre><?php
ini_set('max_execution_time', '0');
$sock = fsockopen("olymp.hackforces.com:9000");
while ($in = fgets($sock)) {
echo "$in";
$out = strrev($in);
//fwrite($sock, "$out\n");