上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: This is something I end up having to google for every now and then.I have a list of numbers:tmp = [1,2,3,4,5]that I want to, in PHP talk is implode(), in python you can use the string.join() method like:','.join( tmp )But it says: TypeError: sequence item 0: expected string, int found, becau 阅读全文
posted @ 2012-04-05 15:48 yarpee 阅读(424) 评论(0) 推荐(0) 编辑
摘要: def getadd(): count=[0] def incr(x): count[0]+=x print(count[0]) return incr a=getadd() a(1) def getadd(): count=0 def incr(x): count+=x print(count) return incr a=getadd() a(1) 为什么第二段代码不能成功执行,会说'count' referenced before assignment,但是第一段以列表的形式就... 阅读全文
posted @ 2012-03-30 16:36 yarpee 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 通常的缓冲区溢出就是通过重写堆栈中储存的EIP的内容,来使程序跳转到我们的shellcode处去执行。其实,即使缓冲区只溢出一个字节的时候,也有可能去执行我们的代码。单字节缓冲区溢出利用一个字节溢出来修改当前的ebp值,进而可以修改esp的值,通过控制esp的值来达到对eip值的控制http://www.nsfocus.net/index.php?act=magazine&do=view&mid=338http://wangcong.org/blog/archives/867http://en.wikipedia.org/wiki/Off-by-one_errorhttp:// 阅读全文
posted @ 2012-03-29 17:44 yarpee 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 每次都是8的倍数,Python源码中一个好方法#define ALIGNMENT 8#define ALIGNMENT_MASK (ALIGNMENT - 1)#define ROUNDUP(x) (((x) + ALIGNMENT_MASK) & ~ALIGNMENT_MASK) 阅读全文
posted @ 2012-03-27 13:57 yarpee 阅读(645) 评论(0) 推荐(0) 编辑
摘要: import signaldef signalHandler(num,frame):passsignal.signal(signal.SIGTERM,signalHandler)http://guozhiwei.iteye.com/blog/939008http://www.sugarsfree.org/?p=179信号触发: signal_handler-->Py_AddPendingCall-->Py_MakePendingCalls-->checksignals_witharg-->PyErr_CheckSignalsstatic PyObject *signal 阅读全文
posted @ 2012-03-23 17:22 yarpee 阅读(1016) 评论(0) 推荐(0) 编辑
摘要: 选择并修改http://blog.csdn.net/balabalamerobert/article/details/2327135#replyimport sysimport disimport StringIOdef parse_bytecodes(bufvalue):var_names = []bytecodes = bufvalue.split('\n')length = len(bytecodes)var_count = 0for i in range(length-1, -1, -1):bytecode = bytecodes[i]if var_count != 0 阅读全文
posted @ 2012-03-22 15:41 yarpee 阅读(611) 评论(0) 推荐(0) 编辑
摘要: http://zhidao.baidu.com/question/309760500.htmlhttp://topic.csdn.net/u/20090212/12/bd6217fd-4df3-4eae-a5b4-2b26f104f6a7.html 阅读全文
posted @ 2012-03-21 09:20 yarpee 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 备注下链接http://bbs.chinaunix.net/thread-1917263-1-1.htmlhttp://hi.baidu.com/malashang/blog/item/a0d7740ae6507d9b0b7b8259.htmlhttp://wenku.baidu.com/view/17ec517c27284b73f24250c3.htmlhttp://wenku.baidu.com/view/5c288b51ad02de80d4d84066.html 阅读全文
posted @ 2012-03-14 18:26 yarpee 阅读(224) 评论(0) 推荐(0) 编辑
摘要: >>> class MyData(object): //类作为名称空间容器... pass...>>> mathObj = MyData()>>> mathObj.x=4>>> mathObj.y=5>>> mathObj.x+mathObj.y9>>>>>> mathObj.x*mathObj.y20self(实例对象)参数自动由解释器传递类中方法只能通过实例来调用类中静态变量可以直接使用实例仅拥有数据属性在类属性可变的情况下>>> class Fo 阅读全文
posted @ 2012-03-13 21:37 yarpee 阅读(253) 评论(0) 推荐(0) 编辑
摘要: Pythona = ['1', '2', '3', '4']b = ['5', '6', '7', '8']s = '1234'将s替换为'5678'a = ['1', '2', '3', '4']b = ['5', '6', '7', '8']s = '1234'print '' 阅读全文
posted @ 2012-03-12 09:23 yarpee 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 动态特性:不需要输个数import inspectimport disdef howmany(): f=inspect.currentframe() f=f.f_back dis.disassemble(f.f_code,f.f_lasti) n=ord(f.f_code.co_code[f.f_lasti+4]) print n return range(n)if __name__=='__main__': x,y=howmany() print x,y>>> import inspect>>> def howmany(): f=inspe 阅读全文
posted @ 2012-03-10 11:45 yarpee 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 用 sys._getframe() 函数获取调用堆栈帧信息#!/usr/bin/env python# -*- coding: utf-8 -*-import sysdef test(depth = 0):frame = sys._getframe(depth)code = frame.f_codeprint "frame depth = ", depthprint "func name = ", code.co_nameprint "func filename = ", code.co_filenameprint "fun 阅读全文
posted @ 2012-03-09 21:13 yarpee 阅读(476) 评论(0) 推荐(0) 编辑
摘要: TCP segment of a reassembled PDU是什么意思,其实主机响应一个查询或者命令时如果要回应很多数据(信息)而这些数据超出了TCP的最大MSS时,主机会通过发送多个数据包来传送这些数据(注意:这些包并未被分片)。对wireshark来说这些对相应同一个查询命令的数据包被标记了“TCP segment of a reassembled PDU”问题,wireshark如何识别多个数据包是对同一个查询数据包的响应? wireshark是根据sequence number来识别,这些数据包ACK number是相同的,当然number的数值与查询数据包中的next seque 阅读全文
posted @ 2012-03-07 09:50 yarpee 阅读(4813) 评论(0) 推荐(0) 编辑
摘要: 转自CU这也是让我们更深入的理解此FREE命令,及linux内核处理内存的机制了:我的linux执行free命令显示如下:[root@Linux /tmp]# free total used free shared buffers cachedMem: 4149156 4130412 18744 0 13220 2720160-/+ buffers/cache: 1397032 2752124Swap: 6289408 144 6289264第1行total 内存总数: 4149156used 已经使用的内存数: 4130412free 空闲的内存... 阅读全文
posted @ 2012-02-28 20:21 yarpee 阅读(671) 评论(0) 推荐(0) 编辑
摘要: 几个比较流行的虚拟机的实现 * V8 (Javascript) * Tamarin (ActionScript 3) * Lua 5.0 * CPython (Python 2.7.2)虚拟机的实现可以有2种方式: * Interpreting (解释执行) 也就是通过类似while() { switch() {} }的循环,分析中间语言的每条指令,动态解释执行 * Binary Translation (这个名词大家可能比较陌生,它还有一个大家更加熟知的名字:JIT) 顾名思义,就是虚拟机实现了从中间语言,到可执行文件的转换的功能,在运行时,将中间语言转换成了可执行文件,最终执行两种计算模型 阅读全文
posted @ 2012-02-28 16:24 yarpee 阅读(226) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页