Skip to content

Instantly share code, notes, and snippets.

@gkbrk
gkbrk / list.json
Created February 23, 2015 20:25
DontBeLazy Block List
[
"http://9gag.com",
"https://www.facebook.com",
"http://www.facebook.com",
"https://www.reddit.com",
"http://www.reddit.com"
]
@gkbrk
gkbrk / scanner.py
Created March 10, 2015 21:11
Simple port scanner in Python.
import socket
import sys
import threading
import queue
import time
common_ports = {
"21": "FTP",
"22": "SSH",
"23": "Telnet",
@gkbrk
gkbrk / slowloris.py
Last active January 13, 2022 09:28
Slowloris implementation in Python. https://github.com/gkbrk/slowloris
import socket
import random
import time
import sys
log_level = 2
def log(text, level=1):
if log_level >= level:
print(text)
@gkbrk
gkbrk / gklang.py
Created April 10, 2015 21:34
Language
import io
import string
import sys
class gkexpr(list):
def a(self):
pass
def lex(stream):
while True:
@gkbrk
gkbrk / AsteroidsGame.cpp
Last active August 29, 2015 14:25
C++ Game
#include <vector>
#include <iostream>
#include <SDL2/SDL.h>
#include "GameState.h"
class AsteroidsGame: public GameState{
public:
void Draw(){
@gkbrk
gkbrk / client.py
Created August 10, 2015 16:06
Python client test
import curses
import sys
import random
import hackchat
import threading
class HackClient:
def __init__(self, nick, channel):
self.nick = nick
self.channel = channel
@gkbrk
gkbrk / dict_server.rs
Created August 25, 2015 19:01
Dictionary server in Rust.
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
use std::io::BufReader;
use std::thread;
use std::fs::File;
fn get_definitions(word: String) -> Vec<String>{
let mut dict = File::open("dict.txt").unwrap();
let mut reader = BufReader::new(dict);
let mut matches: Vec<String> = Vec::new();
[package]
name = "urlshortener"
version = "0.1.0"
authors = ["Gökberk Yaltıraklı <webdosusb@gmail.com>"]
[dependencies]
nickel = "*"
hyper = "*"
rand = "0.3.11"
@gkbrk
gkbrk / whois.rs
Created December 5, 2015 17:43
Rust whois client
use std::io::prelude::*;
use std::net::TcpStream;
use std::io::BufReader;
use std::env;
fn get_tld_server(tld: &str) -> Option<String> {
let mut stream = TcpStream::connect("whois.iana.org:43").unwrap();
stream.write_all(format!("{}\n", tld).as_bytes()).unwrap(); //Send the tld
let reader = BufReader::new(stream);
@gkbrk
gkbrk / rust_md5.md
Created December 10, 2015 20:57
Rust MD5 [AdventOfCode]

Is Rust's MD5 Slow? Heck no!

Today I came across this post on the Rust subreddit. Basically it is comparing two MD5 Miners written in Python and Rust. The miner is written for a code challenge called Advent of Code.

To be honest, speed is one of the things I love about Rust, so seeing Rust being blown away by Python (which I also like and use a lot) made me sad. I decided to make this a bit more fair for Rust so I made a very short piece of Rust code to complete this challenge FAST.

The challenge

The challenge, as written on the Advent of Code page is as follows:

  • You are given a key, for example abcdef.
  • You are looking for a string that is made by taking the MD5 of this key plus a number. This hash has to start with 5 leading zeros. (Like abcdef609043)