Skip to content

Instantly share code, notes, and snippets.

View cvonkleist's full-sized avatar

Christian von Kleist cvonkleist

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <openssl/evp.h>
def vxworks_sum_to_pw(int)
out = "%u" % ((int * 31695317) & 0xffffffff)
out.bytes.each_with_index do |b, i|
out[i] += '!'[0] if out[i] < '3'[0]
out[i] += '/'[0] if out[i] < '7'[0]
out[i] += 'B'[0] if out[i] < '9'[0]
end
out
end
def sum_to_pw(int)
out = "%u" % ((int * 31695317) & 0xffffffff)
out.bytes.each_with_index do |b, i|
out[i] += '!'[0] if out[i] < '3'[0]
out[i] += '/'[0] if out[i] < '7'[0]
out[i] += 'B'[0] if out[i] < '9'[0]
end
out
end
def vxworks_sum(plaintext)
int = 0
0.upto(plaintext.length - 1) do |i|
int += plaintext[i] * (i + 1) ^ (i + 1)
end
int
end
#!/usr/bin/env ruby
# can be called like this:
#
# spec_run.rb foo.rb
# spec_run.rb foo_spec.rb
# spec_run.rb foo.rb -e "some test case"
ruby_file = "" + ARGV.shift
loaded 71 hackers
testing: s.matches_are_sane? = true
getting new hackers
hacker1 will probably defeat hacker2
picking hacker1
@sequence = "L" (1)
i know about 1412 hacker matches
guessing accuracy == 0.00%
checking on last guess and getting new hackers
last guess was good
# first, run protocol.rb for a little while to get some match data into gamelog
$ ruby protocol.rb
...later...
# then, run smart.rb (reads gamelog and plays games with the server until it wins)
$ ruby smart.rb
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Socket;
import javax.swing.ImageIcon;
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char buf[14];
char *pass, *salt;
if(argc < 3) {
printf("usage: %s password salt\n", argv[0]);
return 1;
#!/usr/bin/env ruby
PASS_BIN = 'pass'
SHADOW_FILE = ARGV[0]
lines = File.read(SHADOW_FILE).split("\n")
def generate_password(user)
'houdini!@#' + user
end