Skip to content

Instantly share code, notes, and snippets.

@gkbrk
gkbrk / list.json
Created Feb 23, 2015
DontBeLazy Block List
View list.json
[
"http://9gag.com",
"https://www.facebook.com",
"http://www.facebook.com",
"https://www.reddit.com",
"http://www.reddit.com"
]
@gkbrk
gkbrk / scanner.py
Created Mar 10, 2015
Simple port scanner in Python.
View scanner.py
import socket
import sys
import threading
import queue
import time
common_ports = {
"21": "FTP",
"22": "SSH",
"23": "Telnet",
@gkbrk
gkbrk / slowloris.py
Last active Jul 23, 2020
Slowloris implementation in Python. https://github.com/gkbrk/slowloris
View slowloris.py
import socket
import random
import time
import sys
log_level = 2
def log(text, level=1):
if log_level >= level:
print(text)
View gklang.py
import io
import string
import sys
class gkexpr(list):
def a(self):
pass
def lex(stream):
while True:
View AsteroidsGame.cpp
#include <vector>
#include <iostream>
#include <SDL2/SDL.h>
#include "GameState.h"
class AsteroidsGame: public GameState{
public:
void Draw(){
@gkbrk
gkbrk / client.py
Created Aug 10, 2015
Python client test
View client.py
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 Aug 25, 2015
Dictionary server in Rust.
View dict_server.rs
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();
View Cargo.toml
[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 Dec 5, 2015
Rust whois client
View whois.rs
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 Dec 10, 2015
Rust MD5 [AdventOfCode]
View rust_md5.md

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)
You can’t perform that action at this time.