Skip to content

Instantly share code, notes, and snippets.

@Browne
Browne / exercise5.py
Last active August 29, 2015 14:13
Basic transposition cracker. Added method to check for THE in text (quicker than scouring the dictionary). Added method to strip \r \n chars from the output.
#!/usr/bin/env python
import math
def getStrings(file1):
"Get the string from the file"
with open(file1, 'r') as a:
b = a.readlines()
return (''.join(b))
@Browne
Browne / vigenere_key.py
Created January 18, 2015 23:44
Vigenere with a known key
#!/usr/bin/env python
def crack(x, y):
"""For the length of string i, get the value of the character A=1, B=2 etc
Subtract this from the value of the code at the relevant position
Modulo 26 to remove an remainders/negatives."""
result = ""
for i in range(len(x)):
result += chr((((ord(x[i].lower())) - (ord(y[i % 21].lower()))) % 26) + 97).upper()
return result
@Browne
Browne / delete.sh
Created December 24, 2012 13:10
Deleter in a given tree using the shred command. Shredding a rather secure twenty times, verbose output,
find -type f -execdir shred -n 25 -fuv '{}' \;
rm -rf *;
@Browne
Browne / calculator.adb
Created September 26, 2012 17:27
A very simple Ada Calculator - My version of a Hello World
-- Written by Eliot Brown on 26th September 2012
--A basic calculator that can calculate * + - /
--of two real numbers
with TEXT_IO; use TEXT_IO;
procedure CALCULATOR is
type REAL is digits 20; --20 digit numbers
package IO_REAL is new FLOAT_IO(REAL); use IO_REAL;
A, B, C: Real --Declare A, B, C are real. Note, C is the result
@Browne
Browne / verifyEmail.php
Created March 27, 2012 14:53
Email Verification in PHP
//Function to check email validity
function checkEmail($email) {
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters or @s
return false;
}
// Split it into sections to make shit easy
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
@Browne
Browne / keylog.pl
Created October 25, 2011 22:26
A very crude keylogger
#!/usr/bin/perl
use feature ':5.10';
while{10} {
$input = <>; #Creates infinite loop
last if $input eq "exit/n";
+er;
open(FILE, "log.txt");
print FILE $input;
@Browne
Browne / autodate.pl
Created October 25, 2011 14:57
Open source perl auto-updater for <lastmod> in XML sitemaps.
#!/usr/bin/perl
#######################################################################
#Basic perl script to update <lastmod> in an XML sitemap. #
#Works by seaching for .html files nested in <loc> and then comparing #
#to the file. It then inserts the date in the <lastmod> tag. #
# #
#This code is not subject to copyright and is free to use #
# #
#Eliot Brown 25/10/2011 #
@Browne
Browne / password.py
Created October 13, 2011 02:03
Password Validation Python - RegEx and '/usr/share/dict/words'
"""
Copyright (c) <2012> <Eliot Brown>.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by Eliot Brown. The name of the