Skip to content

Instantly share code, notes, and snippets.

;/***************************************************
; 版权声明
;
; 本操作系统名为:MINE
; 该操作系统未经授权不得以盈利或非盈利为目的进行开发,
; 只允许个人学习以及公开交流使用
;
; 代码最终所有权及解释权归田宇所有;
;
; 本模块作者: 田宇
from pwn import *
import sys
def malloc(size, data):
r.recvuntil("choice :")
r.sendline("1")
r.recvuntil("Size:")
r.sendline(str(size))
r.recvuntil("Data:")
from pwn import *
import sys
def create(data):
word = r.recvuntil("choice :")
print word
r.sendline("1")
word = r.recvuntil("bullet :")
print word
r.send(data)
ifeq ($(KERNELRELEASE),)
# 假如沒有定義KERNELRELEASE的話,就會跑到這個分支
# 表示現在是由命令列叫用
# 於是可以再呼叫核心建構系統
# Assume the source tree is where the running kernel was built
# You should set KERNELDIR in the environment if it's elsewhere
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
# The current directory is passed to sub-makes as argument
/*
* $Id: hi.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
*/
#include <linux/init.h>
#include <linux/module.h>
//MODULE_LICENSE("Dual BSD/GPL");
static int __init hi_init(void)
{
from pwn import *
import sys
#select remote or local
if len(sys.argv) == 2:
if sys.argv[1][0]=='l':
sh = process("./hacknote", env={"LD_LIBRARY_PATH" : "/lib32"})
#sh = process("./hacknote")
else:
# -*- coding: utf-8 -*-
from pwn import *
import sys
r=0
if sys.argv[1]=='l':
r=process("./t-memo")
elif sys.argv[1]=='r':
semaphore mutex = 1;
int next_count = 0;//等待next的個數
semaphore next = 0;
int x_count = 0;//等待x_sem的個數
semaphore x_sem = 0;
/* monitor */
/* monitor start */
monitor DiningPhilosophers
{
enum {THINKING, HUNGRY, EATING} state[5];
condition self[5];
void pickup(int i){
state[i] = HUNGRY;
test(i);
//假如沒辦法拿到筷子,進入condition variable self[i]的queue
do{
/* entry section */
wait(chopstick[i]);
wait(chopstick[(i+1) % 5]);
/* eat for a while */
/*critical section*/
/* exit section */