Archive for the ‘Programming’ Category
Sunday, February 7th, 2010 by mopey
This program takes a regular expression for a problem and returns the
affected hosts. It iterates through all reports saved in a .nessus file
making no attempt at uniqueness, (eg if you scanned a host more than once)
searching through titles, data, port, and IDs for matches.
Tags: grep, nessus, python
Posted in Programming | No Comments »
Sunday, January 3rd, 2010 by mopey
The code is pretty self explanatory. It searches through a .nessus file and spits out matching hosts.
Tags: nessus, python
Posted in GrayHat, Programming | No Comments »
Wednesday, December 30th, 2009 by mopey
Kind of an annoying problem, but sometimes nikto runs out of control. This is made worse by nessus, which can have a lot of nikto instances running at once.
Tags: nikto, python
Posted in GrayHat, Programming | No Comments »
Friday, November 13th, 2009 by mopey
I had to change this script a lot, so take with a grain of salt. That said, we changed about 1000 LOCAL passwords in a couple hours – which would have really taken all day and been more boring.
Tags: python
Posted in Network, Programming | No Comments »
Saturday, October 31st, 2009 by mopey
This program is a hillclimbing program solution to the 8 queens problem. The algorithm is silly in some places, but suits the purposes for this assignment I think. It was tested with python 2.6.1 with psyco installed. If big runs are being tried, having psyco may be important to maintain sanity, since it will speed things up significanlty. Otherwise, you may want to stick to –numrun being less than around 50.
Tags: artificial intelligence, python
Posted in Programming | No Comments »
Wednesday, October 14th, 2009 by mopey
This is a stupid script to scan a class b network. I only wanted a detailed scan of hosts that exist (which I generated with a ping scan). I also wanted this information separated by file.
Tags: nmap
Posted in GrayHat, Network, Programming | 2 Comments »
Sunday, July 26th, 2009 by mopey
This is something obvious to statisticians but maybe less obvious to most programmers. I recently came across some code that essentially looks like this: x = rand^2. The programer was for some reason assuming that x was still uniform between [0,1]. Of course, this isn’t the case. Although the domain is still between [0,1] the numbers will now be squished down closer to 0.
Posted in Programming | No Comments »
Saturday, July 25th, 2009 by mopey
This is an RTOS developed by myself, with some code taken from FreeRTOS. This is some of the most difficult code I have ever written, although it really doesn’t do anything useful. Man, context switching in C can be a bear! It’s like a programatic buffer overflow! (seriously, you do a function call and just pop off enough stuff to overwrite the instruction pointer).
Tags: avr atmega16 rtos
Posted in Bits and Bytes, Programming | 2 Comments »
Tuesday, June 30th, 2009 by mopey
From the system man page, it explicitely says:
Do not use system() from a program with set-user-ID or set-group-ID privileges, because strange values for some environment variables might be used to subvert system integrity.
Since system is basically a fork and wait, it’s pretty easy to use execv instead. Here is a snippet from the goog_pam module [...]
Tags: C
Posted in Linux, Programming | No Comments »
Tuesday, May 26th, 2009 by mopey
In CS 504:Real Time Operating Systems, the class built a functional Real Time Operating system based on the UIK API. In my implementation, I heavily relied on the source code of FreeRTOS. The process focused primarily on demonstrating the atmel processor, multitasking, and and basic interprocess communication, which are fundamental parts of an RTOS. In this project, the same problems are achieved with a very different architecture. Namely, all the first programming projects – generating a sound wave, counting LEDs, timing how long buttons were pressed, and handling hardware events – were programmed similarly and multi-tasked on the propeller chip. This project included interfacing with the ntsc and peripheral drivers, writing a sound driver, learning spin and propeller assembly, and comprehending the propeller architecture.
Tags: atmel propeller parallax rtos
Posted in Bits and Bytes, Programming | No Comments »
Monday, May 4th, 2009 by mopey
A musical “note” is a waveform that has a certain fundamental frequency. A perfect sine wave consists only of the fundamental frequency, and sounds very “pure” or mellow, like a flute. For this project, you are to use interrupts to generate the notes of a musical scale, while at the same time using another interrupt to update a count. We will generate square waves by toggling a bit within a port on and off. Specifically, your program should play the notes from middle C to the next higher C, each of approximately one second in duration. These notes should be playing at the same time that an 8-bit binary count is being displayed in the LED’s, updating at approximately 1/4 second.
Tags: atmega, avr, C
Posted in Bits and Bytes, Programming | No Comments »
Wednesday, April 8th, 2009 by mopey
The purpose of this assignment is to give you experience with the AVR’s timers and the use of interrupts. You are to repeat assignment #1, this time performing the timing using an interrupt-driven timer. You are to write an interrupt service routine (ISR) for one of the hardware timers on the AVR. Each time the timer interrupts, you should update a counter variable. Then, when determining the amount of time that the switch is held down, use the counter value. Then, use the counter again to determine how long to turn on the LED. As before, in addition to writing the code, determine the size of the code in your program, including main and the ISR.
Posted in Bits and Bytes, Programming | No Comments »
Saturday, April 4th, 2009 by mopey
Does my title sound like buz-word central? You bet it does. That’s because it was a bit difficult to find any good introductory material on this. Maybe that’s because there’s so much information out there…
Tags: avr
Posted in Bits and Bytes, Linux, Programming | 2 Comments »
Thursday, February 26th, 2009 by mopey
“find . -type f -exec cat {} \; | wc -l;” and if you don’t want repeats “find . -type f -exec cat {} \; | egrep \\S | wc -l”
Tags: bash
Posted in Linux, Programming | No Comments »
Saturday, January 24th, 2009 by mopey
I was reading an oriley bash scripting book, and they had an entire chapter dedicated to error checking in bash. For me, this was a little weird since I think the way they handled it made the code cluttered.
Posted in Programming | 1 Comment »
Monday, December 22nd, 2008 by mopey
“The pixels in the above image are numbered 0..99 for the first row, 100..199 for the second row etc. White pixels represent ascii codes. The ascii code for a particular white pixel is equal to the offset from the last white pixel. For example, the first white pixel at location 65 would represent ascii code 65 (‘A’), the next at location 131 would represent ascii code (131 – 65) = 66 (‘B’) and so on.
Tags: hackthissite, python
Posted in GrayHat, Programming | No Comments »
Monday, December 8th, 2008 by mopey
Trying to do this in a somewhat intelligent way this time. The results are better. timing in at around 4 seconds instead of the brute force 11 minutes. I’m very positive it could be sped up much much more by writing in C, but this is just algorithmic, and I’m writing in python.
Tags: benchmark, python
Posted in Programming | No Comments »
Saturday, December 6th, 2008 by mopey
Stupid single core opteron vs xeon benchmark. This benchmark is to test the single core speed of some operations of a 2.2 GHz Opteron 170 vs a Xeon X5460 3.16 GHz. Our old main server had 4 Opteron cores simlar to the ones used in the benchmard, and the Xeon is the processor in our new server.
Tags: benchmark, python
Posted in Programming | No Comments »
Sunday, October 19th, 2008 by mopey
This is a simple – not efficient – but doable way to do modular exponentiation
Tags: python
Posted in Programming | No Comments »
Saturday, September 27th, 2008 by mopey
This is my alarm clock script. It plays a random song from /home/lundeen/alarm
#!/bin/sh
/usr/bin/X11/xterm -display :0 -bg black -fg white \
-e /usr/bin/mplayer -shuffle /home/lundeen/alarm/*
It runs in cron
lundeen@mopey-mythy:~$ crontab -l
# m h dom mon dow command
00 07 * * 1-5 /home/lundeen/alarm.sh
Tags: bash
Posted in Linux, Programming | No Comments »