Skip to content

Instantly share code, notes, and snippets.

from ecdsa import SigningKey
from ecdsa import VerifyingKey
import ecdsa
from ecdsa.numbertheory import inverse_mod
import hashlib
import binascii
import base64
curve_order = ecdsa.curves.NIST192p.order
@speeddragon
speeddragon / ecdsa_request.py
Last active November 24, 2018 11:23
bSidesLisbon CTF
from ecdsa import SigningKey
from ecdsa import VerifyingKey
import ecdsa
from ecdsa.numbertheory import inverse_mod
import hashlib
import binascii
import base64
import httplib
sessid = "6621a96c7db568374f2885d6d135f395010e75a94ec2233a433ff8e2"

Keybase proof

I hereby claim:

  • I am speeddragon on github.
  • I am speeddragon (https://keybase.io/speeddragon) on keybase.
  • I have a public key whose fingerprint is FAB0 09A8 4A69 FCFD CCFB AA16 213A DBC7 6991 F2D5

To claim this, I am signing this object:

@speeddragon
speeddragon / enum_benchmark.ex
Created November 16, 2018 20:51
Benchmark Enum, Stream, etc
#
# O(2N)
#
t1 = :os.system_time(:millisecond)
v1 = 1..100_000 |> Enum.with_index() |> Enum.map(fn {x, y} -> x + y end)
IO.puts("t1: #{:os.system_time(:millisecond) - t1} ms")
@speeddragon
speeddragon / schedule.ex
Last active November 13, 2018 15:17
Restaurant Scheduler - Elixir
# Structure
# schema "restaurant_schedule" do
# field(:from_weekday, :integer)
# field(:to_weekday, :integer)
#
# field(:open_time, :time)
# field(:close_time, :time)
# timestamps()
@speeddragon
speeddragon / image_validation.ex
Last active October 18, 2018 11:21
Image Validation in Elixir
defmodule ImageValidation do
@doc """
JPG magic bytes: 0xffd8
"""
@spec is_jpg?(binary()) :: boolean()
def is_jpg?(file) do
with <<head::binary-size(2)>> <> _ = file.binary,
<<255, 216>> <- head do
true
else
wget https://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-7.0.8-10.x86_64.rpm
sudo alien ImageMagick-7.0.8-10.x86_64.rpm
sudo dpkg -i imagemagick_7.0.8-11_amd64.deb
@speeddragon
speeddragon / javascript_post_commie.js
Created June 10, 2018 16:18
POST XML Request to Commie
function send_to_pastebin(captcha) {
var url = "https://commie.io/lib/router.php";
var threadId = "ImQCbHa1";
var post = "do=savecomment&uid=" + threadId + "&comment=" + captcha + "&line=0&user=" + guid;
var request = new XMLHttpRequest();
request.open("POST", url, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onreadystatechange = function() {//Call a function when the state changes.
@speeddragon
speeddragon / digispark_osx_reverse_shell.ino
Created May 1, 2018 20:07
Digispark Rubber Ducky OSX Reverse Shell PT Layout with ZSH
/*
This is an example of reverse shell for OSX with bypass of ZSH issues.
This code is for Portuguese (PT) layout keyboards.
Using Digispark USB.
*/
#include "DigiKeyboard.h"
#define KEY_TAB 43
#define KEY_DELETE 76
@speeddragon
speeddragon / travis_edeliver_deploy.sh
Last active April 3, 2018 14:32
Travis CI - Edeliver (elixir) Deploy
#!/bin/bash
if [ $? -eq 0 ]; then
echo "Travis Branch: $TRAVIS_BRANCH"
DEPLOY_BRANCH="develop"
if [ "$TRAVIS_BRANCH" == "$DEPLOY_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
# Hot swap need to know what is the current version
echo " :: Edeliver: Build"
#mix edeliver build upgrade
mix edeliver build release --branch=$DEPLOY_BRANCH