Skip to content

Instantly share code, notes, and snippets.

@amiremohamadi
amiremohamadi / plusplus.patch
Created January 14, 2025 18:40
simple implementation of ++ operator for python 3.10
diff --git a/Doc/library/token-list.inc b/Doc/library/token-list.inc
index 1a99f05..8396101 100644
--- a/Doc/library/token-list.inc
+++ b/Doc/library/token-list.inc
@@ -129,6 +129,10 @@
Token value for ``"**"``.
+.. data:: PLUSPLUS
+
@amiremohamadi
amiremohamadi / csctf2024-sole-writeup.py
Created September 1, 2024 22:16
CyberSpace CTF 2024 - Sole Writeup
import string
var = {
'27': ord('C'),
'1': ord('S'),
'2': ord('C'),
'26': ord('T'),
'3': ord('F'),
'4': ord('{'),
'23': ord('}'),
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("example.com"))
# you should complete this part
@amiremohamadi
amiremohamadi / ppk.go
Created November 7, 2023 06:23
POC: generate putty keys
package ppk
import (
"crypto/hmac"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"encoding/base64"
"encoding/binary"
"encoding/hex"
@amiremohamadi
amiremohamadi / config.json
Created January 3, 2023 10:16
Vmess V2ray Over Websocket on Cloudflare Workers
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": 80,
"protocol": "vmess",
"settings": {
"clients": [
#include <linux/bpf.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/pkt_cls.h>
#include <linux/tcp.h>
/* struct bpf_map_def reuseport_map = { */
/* .type = BPF_MAP_TYPE_ARRAY, */
@amiremohamadi
amiremohamadi / writeup_printer_challenge.md
Last active July 13, 2021 14:24
CTF 2021 - Printer challenge solution

Challenge:

http://challenges.ctfd.io:30068/index.php

Solution:

Refer to source file (index.php):

    $blocked = array("cat", "more" ,"readfile", "fopen", "file_get_contents", "file", "SplFileObject" );
    $special_block= "nc";
    $$special_block= "../flag.txt";
    foreach ($blocked as $value) {
use serde::{Deserialize, Serialize};
use std::io::prelude::Write;
use std::os::unix::net::UnixStream;
use std::time::SystemTime;
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Message {
pub source: String,
pub target: String,
pub weight: usize,
from math import sqrt, log
ITER_COUNT = 13
def make_count_flow(file):
'''read file till a spec time and make count flow map from it'''
time = 0
mapper = dict()
for line in file:
values = line.strip().split(',')
package com.rahnema.college.team3.auctionak.controllers;
import org.omg.CORBA.Object;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;