Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
rkrishnasanka / CS348 - Functional Hardware Verification
Last active May 18, 2024 07:51
Solutions for Udacity Course CS348 - Functional Hardware Verification
Solutions for Udacity Course CS348 - Functional Hardware Verification
@rkrishnasanka
rkrishnasanka / jl8tocbz.py
Created April 7, 2013 13:33
A simple script that downloads the JL8 Comics from http://www.limbero.org and makes it into a cbz
import urllib2
import os
import zipfile
def downloadimage(img):
r = urllib2.urlopen("http://www.limbero.org/jl8/comics/"+img)
f= open(path+'\\'+img,'wb')
f.write(r.read())
f.close()
print img + ' has been downloaded and saved ! \n'
@rkrishnasanka
rkrishnasanka / vnc
Last active December 18, 2015 14:39
Tight VNC startup script. Be sure to '''chmod 755 vnc'''
#!/bin/bash
sudo tightvncserver
sudo vncserver :1 -geometry 1366x768 -depth 24
@rkrishnasanka
rkrishnasanka / passcracker.py
Created July 7, 2013 10:52
Salted Unix password cracker (requires a dictionary aka dict.txt)
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('dict.txt','r')
for word in dictFile.readlines():
word = word.strip('\n')
cryptWord = crypt.crypt(word,salt)
if(cryptWord == cryptPass):
print "[+] Found Password: "+ word+"\n"
@rkrishnasanka
rkrishnasanka / unzipper.py
Created July 7, 2013 10:53
Zip Password Cracker (requires dictionary)
import zipfile
import optparse
from threading import Thread
def extractFile(zFile, password):
try:
zFile.extractall(pwd = password)
print '[+] Found password ' + password + '\n'
except:
pass
@rkrishnasanka
rkrishnasanka / nmapscanner.py
Created July 7, 2013 11:47
Scans comma separated port list given by -p of host ip given by -H
import nmap
import optparse
def nmapScan(tgtHost, tgtPort):
nmScan = nmap.PortScanner()
nmScan.scan(tgtHost, tgtPort)
state = nmScan[tgtHost]['tcp'][int(tgtPort)]['state']
print " [*] " + tgtHost + " tcp/" + tgtPort + " " + state
def main():
@rkrishnasanka
rkrishnasanka / pxsshCommand.py
Last active May 31, 2022 07:18
uses pexpect to automate ssh login
import pxssh
def send_command(s, cmd):
s.sendline(cmd)
s.prompt()
print s.before
def connect(user, host, password):
try:
s = pxssh.pxssh()
@rkrishnasanka
rkrishnasanka / g.py
Created July 28, 2013 13:24
HW 1 Problem 4 ,5 (uncomment relevant data)
from GF2 import one
def GF2_addLists(L1,L2): return [vx+ux for (vx,ux) in zip(L1,L2)]
def solve(u):
#data
data = {
'a':[one,one,one,0,0,0,0]
, 'b':[0,one,one,one,0,0,0]
@rkrishnasanka
rkrishnasanka / app.js
Created August 1, 2013 08:19
test socket.io server
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, path = require('path')
, io = require('socket.io').listen(server)
, spawn = require('child_process').spawn
// all environments
@rkrishnasanka
rkrishnasanka / wol.py
Created August 29, 2013 10:08
WAKE ON LAN
import socket
import struct
def wake_on_lan(macaddress):
""" Switches on remote computers using WOL. """
# Check macaddress format and try to compensate.
if len(macaddress) == 12:
pass