Skip to content

Instantly share code, notes, and snippets.

View spetzreborn's full-sized avatar

Björn Fjällström spetzreborn

  • Stockholm University
  • Stockholm
View GitHub Profile
#!/usr/bin/env python3
# Wordgame rewrite from perl. Coding exercise.
# Wordgame from https://www.facebook.com/paz/photos/a.462264797743.253604.184431752743/10153126259942744/?type=1
word = "only"
orig_sentence = ["She", "told", "him", "that", "she", "loved", "him"]
sentence_beginning = orig_sentence
sentence_end = []
for i in range(len(orig_sentence) + 1):
/*
How to compile:
gcc reverse.c -g -D WORLD=\"HelloWorld\" -o hello
gcc reverse.c -g -D WORLD=\"GoodBye\" -o bye
./bye
cat hello bye > reverse && rm hello bye
chmod +x reverse
@spetzreborn
spetzreborn / pydbg_firefox.py
Created November 15, 2019 08:57 — forked from RobinDavid/pydbg_firefox.py
Pydbg: sample to hook a firefox function to retrieve credentials (Gray Hat Python book)
'''
Example taken from Gray Hat Python (book)
This script present a way to hook a DLL library in Firefox. For this example the script hook nspr4.dll which encrypt datas for SSL connection.
So we will be able to get the text before it is encrypted. Moreover we catch a pattern "password" to get all login/password before they are ciphered.
'''
from pydbg import *
from pydbg.defines import *
import utils
@spetzreborn
spetzreborn / endian.c
Created November 14, 2019 21:04 — forked from saibikalpa/endian.c
Sample C program to determine endianness
#include <stdio.h>
union s{
int n;
char b;
}x;
void main(){
x.n = 0x4142;
if(x.b == 0x42){
printf("Little Endian\n");
}
@spetzreborn
spetzreborn / bitwise.ino
Created December 25, 2018 12:26
Bitwise
void binDisplay(int program) {
// A0, A1, A2, A3, A5
// Turn display off
for (int i = 0; i < chipSet.pinsNumber; i++) {
digitalWrite(chipSet.pinsSerial[i], LOW);
}
int res;
int bitwise = 1;
@spetzreborn
spetzreborn / time.pl
Last active May 18, 2017 11:51
Print local and UTC time, and modifed time in local and UTC
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX qw/strftime/;
my $to_date = time();
my $from_date = time() - (60 * 60 * 6);
print "Local:", strftime("%Y-%m-%dT%H:%M:%SZ", localtime($from_date)), "\n";
print "UTC: ", strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($from_date)), "\n";
@spetzreborn
spetzreborn / bitwise.sh
Created September 8, 2016 06:54
bash bitwise
#!/bin/bash
value=$1
# Check bit
for check in 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536;do
if [ $(( $value & $check )) -eq $check ];then
echo "$check is set"
else
echo "$check is not set"
fi
#!/usr/bin/env perl
# Wordgame from https://www.facebook.com/paz/photos/a.462264797743.253604.184431752743/10153126259942744/?type=1
use strict;
use warnings;
my $word = "only";
my @orig_sentence = qw(She told him that she loved him.);
my @sentence = @orig_sentence;
my @sentence2;