Skip to content

Instantly share code, notes, and snippets.

@DavidMah
DavidMah / stubber.py
Created June 24, 2013 21:25
Patch in Python Function Stubbing
def stub(original_function, replacements):
"""
stub(function, [((input), corresponding output)]) -> function
Stubs a function with fake input/output.
Stubbing is reentrant, and every call to stub should be reset using
`retrieve_original_function`.
Arguments:
original_function: the function to defer to in unstubbed cases.
@DavidMah
DavidMah / web200.md
Last active December 18, 2015 07:49

What is Netcat?

  • A: Nyancat's cousin
  • B: A utility that lets you control arbitrary TCP or UDP connections
  • C: A utility that lets you middle man on already established TCP or UDP connections.
  • D: A wizard.

For the callback shell described in the lesson, what construct do we use to temporarily hold output from bash before sending it back over the wire?

@DavidMah
DavidMah / web200.md
Last active December 18, 2015 07:49

Acquiring a Callback Shell

Sometimes you are attacking another system, and you've already pwned a remote code execution vulnerability, but you want a way to get a persistent connection to that box. If you connect to that box and listen on some port, then it will be really easy for a user of that box to detect your existence. On a Linux box, they could simply type netstat -lntp to reveal all applications that are listening.

Netcat is a program that lets you run arbitrary TCP or UDP

test git:(master) ✗ ./test-burgers 5 5 100
Chefs: 5, Students: 5, Burgers: 100
Chef 1 created burger 1
Chef 1 created burger 2
Chef 1 created burger 3
Chef 1 created burger 4
Chef 1 created burger 5
Chef 1 created burger 6
Chef 1 created burger 7
Chef 1 created burger 8
➜ test git:(master) ✗ ./test-burgers 5 5 100
Chefs: 5, Students: 5, Burgers: 100
Chef 1 created burger 1
Chef 2 created burger 2
Chef 3 created burger 3
Chef 4 created burger 4
Chef 5 created burger 5
Student 1 consumed burger 5
Chef 1 created burger 6
Chef 2 created burger 7
➜ test git:(master) ✗ ./test-burgers 1 1 100
Chefs: 1, Students: 1, Burgers: 100
Chef 1 created burger 1
Chef 1 created burger 2
Chef 1 created burger 3
Chef 1 created burger 4
Chef 1 created burger 5
Chef 1 created burger 6
Chef 1 created burger 7
Chef 1 created burger 8
Command:
xmonad-wallpapers
Should read from the config file and apply any changes to the current setup.
You can call it whatever you want though. xmonad-wallpapers is just something
I thought of just now. xmomar-wallpapers... xchiefdump...
~/.xmonad-wallpapers file format:
Every line is of the following format:
Index <Absolute path of image> <Position> <Color>
public class ExampleClass {
int exampleField;
public Example() {
exampleField = 5;
}
public void exampleMethod() {
System.out.println("This is the exampleMethod printing from ExampleClass, and exampleField is: " + exampleField);
}
/**
* David Mah
*
*
* ArrayStack
* The Array Stack is an implementation of the DStack of doubles
*
* The isEmpty and peek operations run in constant time
* The push and pop operations run in amortized constant time
*/
➜ orsen git:(master) ✗ mongo
MongoDB shell version: 2.0.6
connecting to: test
> show db
Tue Mar 12 00:50:38 uncaught exception: don't know how to show [db]
> show dbs
local (empty)
test 0.203125GB
test-1037351273 0.203125GB
test-1045012380 0.203125GB