- 博客(18)
- 收藏
- 关注
原创 python3通过request多进程获取驾校一点通试题库
通过开发者工具找到试题链接地址; 对试题链接的url进行分析,发现index是试题id名称,构造随机数,可使用range或者excel拉出全部; 对json数据进行字段分析 我这里分开写了两个脚本,一个是获取数据一个是转成excel,本文主要为多进程获取数据 开发环境python3.9.1/windows10/vscode #coding:utf-8import requestsfrom concurrent.futures import ProcessPoolExecutorimpo
2020-12-30 10:21:47
527
原创 python 通过输入IP去es中获取相关数据
# -*- coding: utf-8 -*-from subprocess import Popen, PIPEimport jsonimport sysimport osreload(sys)sys.setdefaultencoding('utf8')input_ip = raw_input('please input your IP:')print input_ipdef get_data(): cmd = 'curl -X POST -H \"Content-Type.
2020-08-06 16:58:23
252
原创 python 实现curl请求获取es数据
因工作需要在docker中用python获取es统计一些top数据,之前写过用了各种依赖库的,但是在docker中因种种原因不能安装,所以写了一个python实现curl来获取es数据的脚本,希望能帮到大家。# -*- coding: utf-8 -*-from subprocess import Popen, PIPEimport jsonimport sysimport osreload(sys)sys.setdefaultencoding('utf8')def get_data(
2020-08-06 16:54:10
1164
原创 python 通过Elasticsearch库操作ES获取 top数据
# -*- coding: utf-8 -*-import timefrom es_client import es_clientfrom elasticsearch_dsl import Searchimport jsonimport copyimport sysimport osreload(sys)sys.setdefaultencoding('utf8')# argvlist = sys.argv# print("读取ip路径:",argvlist[0])# print.
2020-07-20 20:05:21
890
原创 python 通过requests库连接es 获取title TOP10
# -*- coding: utf-8 -*-import requestsimport jsonimport sysimport osreload(sys)sys.setdefaultencoding('utf8')def get_data(): headers = { 'content-type': 'application/json' } data = '{"_source":["title"],"query":{"bool":{"must_n.
2020-07-20 19:59:15
1693
原创 python 连接API接口,判断获取的url存活,保存本地
# -*- coding: utf-8 -*-import loggingimport randomimport sysimport timeimport requestsimport jsonfrom selenium import webdriverimport shodanreload(sys)sys.setdefaultencoding('utf8')email, key = ('','')client = shodan.Client(email, key).
2020-06-29 11:10:32
413
原创 python2.7 json转换成excel
# -*- coding: utf-8 -*-import jsonimport pandas as pddata = [] # 用于存储每一行的Json数据with open('H3CPRODUCT.json','r') as fr: for line in fr: j = json.loads(line) data.append(j)df = pd.DataFrame() # 最后转换得到的结果for line in data: for.
2020-06-29 11:07:00
265
原创 Ubuntu16.04 安装ElasticDump
Ubuntu16.04 安装ElasticDump#查看node版本node -v#清除node缓存;sudo npm cache clean -f#安装node版本管理工具’n’;sudo npm install n -g#使用版本管理工具安装指定node或者升级到最新node版本;sudo n stable (安装node最新版本)#查看node版本,是否与下载一致node -v#查看文件地址which node (如:/usr/local/node)#添加PATH路径,到
2020-05-13 16:35:21
823
原创 把文本中以逗号隔开的文本变成换行
#-*- coding:utf-8 -*-f1 = open("pocrules.txt").read()#打开要替换的文件f2 = f1.replace(", ","\n")f3 = open("hexstring.txt","wb")#替换成功后的文件f3.write(f2)f3.close()
2020-03-19 15:26:08
5220
原创 txt 文本简单对比,查找不同
两个txt文本简单对比内容例如:txt1中:11122312345111156665txt2中:17445123451111#-*- coding:utf-8 -*-txtpath1=r"hexstring.txt" #需要对比的数据txtpath2=r"rules.txt" #对比依据数据txtpath3=r"c1.txt" #1中存在2中不存在的数据 fpa=...
2020-03-19 15:23:53
1664
原创 机器学习测试(docker)获取可行性结果
数据结构{“port”:“80”,“ip”:“78.132.233.232”,“banner”:“HTTP/1.1 200 OK\r\nServer: Router Webserver\r\nConnection: close\r\nWWW-Authenticate: Basic realm=“TP-LINK Wireless N Gigabit Router WR1043ND”\r\nCont...
2020-03-19 15:18:41
200
原创 Ubuntu Ubuntu 16.04出现E: Sub-process returned an error code有效解决方法
1.sudo pkill -KILL appstreamcli2.wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstrea...
2020-02-27 18:51:27
1048
原创 pyhon2.7 多进程爬取url返回json数据
我本次爬取的是一批物联网设备ip中的xhr返回json信息,并解析json得到具体型号。已有数据:1.物联网ip和端口2.网站登录页面F12---->XHR----Ctrl + R ----->headers,获取url...
2019-12-18 19:45:22
160
原创 线程和进程的区别(个人理解)
线程我个人理解为餐桌,进程是可坐下吃饭的位置,任务是食物。单线程和单进程就是一个人在桌子上消灭食物;单线程多进程是一个桌子多个人一起消灭食物;多线程和单进程是多个餐桌一个人消灭食物;多线程多进程是多个餐桌多个人一起消灭食物。有什么理解不对的希望能提出来,会改正。...
2019-12-18 10:33:55
145
原创 python2.7 使用requests.get出现requests.exceptions.SSLError: HTTPSConnectionPool错误
python2.7 使用requests.get出现requests.exceptions.SSLError: HTTPSConnectionPool错误html = requests.get(‘https://%s’%(query_str),headers = hea,timeout = 20 ,verify=False)在后面加入“verify=False” 选择忽略证书认证即可...
2019-12-17 10:04:06
470
原创 python解析json提取其中字符串并保存成字典
python解析本地json文件提取其中内容并保存成字典格式import jsonf = open (‘service.json’)for line in f :testdata = lineversionInfoPython = json.loads(testdata)print versionInfoPythonprint versionInfoPython.keys()pri...
2019-05-31 18:51:41
2911
原创 python两个文本模糊匹配对比
两个本地文本作对比,看其中小的文本是否存在大文本,存在的保存一个文件,不存在的也保存一个文件hello.txt内容:helloworldaccchhhworld.txt内容:hahhhhelloworldhasdjsjhworld6666dfhhhahellohdhdhjdhshadh-- coding: UTF-8 --import re ...
2019-05-31 18:28:51
7714
原创 Ubuntu16.04上pip报错ModuleNotFoundError: No module named 'pip._internal'
最近用ubuntu 16.04 把里面自带的python2.7 升级为python3.7,之后下载jupyter 报错发现这两条命令可以直接解决wget https://bootstrap.pypa.io/get-pip.py --no-check-certificatesudo python get-pip.py之后输入 pip -v 会返回版本...
2018-12-29 14:42:45
417
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人